RFA: 8169556: Wrapping of FileInputStream's native skip and available methods (original) (raw)

Roger Riggs roger.riggs at oracle.com
Fri Mar 10 13:05:03 UTC 2017


Hi Sunny,

yes, the openjdk mail lists filter attachments that don't appear to be text. The in-line patch is fine.

I think we need approval from the jdk8u maintenance lead and a sponsor to commit it (I can volunteer if no one else does).

Thanks, Roger

On 3/10/17 2:33 AM, Chan, Sunny wrote:

(It seems like the mailing list filtered the attachment so I am going to inline the patch)

Hello, I would like to propose backporting JDK-8169556 to JDK8u-dev. The patch mostly applies cleanly except for the make/mapfiles/libjava/mapfile-vers. As a result I have attached the JDK 8 patch in the email. The patch has been tested with java.io test cases. JBS: https://bugs.openjdk.java.net/browse/JDK-8169556 JDK9 changeset: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/47a8e055bab1 JDK9 patch review thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-November/044614.html # HG changeset patch # User Sunny Chan <sunny.chan at gs.com> # Date 1489128533 0 # Fri Mar 10 06:48:53 2017 +0000 # Node ID 0d1759fe196541b8d171c63e4cdfca0b6a20031c # Parent d355fca1b03770f97fc6747ee27d55bb839029a9 8169556: Wrapping of FileInputStream's native skip and available methods Summary: Wrap further native methods in FileInputStreams Contributed-by: sunny.chan at gs.com diff --git a/make/mapfiles/libjava/mapfile-vers b/make/mapfiles/libjava/mapfile-vers --- a/make/mapfiles/libjava/mapfile-vers +++ b/make/mapfiles/libjava/mapfile-vers @@ -76,13 +76,13 @@ JavajavaioFileDescriptorinitIDs; JavajavaioFileDescriptorsync; - JavajavaioFileInputStreamavailable; + JavajavaioFileInputStreamavailable0; JavajavaioFileInputStreamclose0; JavajavaioFileInputStreaminitIDs; JavajavaioFileInputStreamopen0; JavajavaioFileInputStreamread0; JavajavaioFileInputStreamreadBytes; - JavajavaioFileInputStreamskip; + JavajavaioFileInputStreamskip0; JavajavaioFileOutputStreamclose0; JavajavaioFileOutputStreaminitIDs; JavajavaioFileOutputStreamopen0; diff --git a/make/mapfiles/libjava/reorder-sparc b/make/mapfiles/libjava/reorder-sparc --- a/make/mapfiles/libjava/reorder-sparc +++ b/make/mapfiles/libjava/reorder-sparc @@ -48,7 +48,7 @@ text: .text%fileOpen; text: .text%JavajavaioFileInputStreamreadBytes; text: .text%readBytes; -text: .text%JavajavaioFileInputStreamavailable; +text: .text%JavajavaioFileInputStreamavailable0; text: .text%JavajavaioFileInputStreamclose0; text: .text%JavajavalangSystemmapLibraryName; text: .text%JavajavaioUnixFileSystemgetBooleanAttributes0; diff --git a/make/mapfiles/libjava/reorder-sparcv9 b/make/mapfiles/libjava/reorder-sparcv9 --- a/make/mapfiles/libjava/reorder-sparcv9 +++ b/make/mapfiles/libjava/reorder-sparcv9 @@ -51,7 +51,7 @@ text: .text%fileOpen; text: .text%JavajavaioFileInputStreamreadBytes; text: .text%readBytes; -text: .text%JavajavaioFileInputStreamavailable; +text: .text%JavajavaioFileInputStreamavailable0; text: .text%JavajavaioFileInputStreamclose0; text: .text%JavajavalangCompilerregisterNatives; text: .text%JavajavasecurityAccessControllerdoPrivileged_LjavasecurityPrivilegedExceptionAction2; diff --git a/make/mapfiles/libjava/reorder-x86 b/make/mapfiles/libjava/reorder-x86 --- a/make/mapfiles/libjava/reorder-x86 +++ b/make/mapfiles/libjava/reorder-x86 @@ -78,7 +78,7 @@ text: .text%JNUGetEnv; text: .text%JavajavaioUnixFileSystemcheckAccess; text: .text%JavasunreflectNativeMethodAccessorImplinvoke0; -text: .text%JavajavaioFileInputStreamavailable; +text: .text%JavajavaioFileInputStreamavailable0; text: .text%JavajavalangreflectArraynewArray; text: .text%JavajavalangThrowablegetStackTraceDepth; text: .text%JavajavalangThrowablegetStackTraceElement; diff --git a/src/share/classes/java/io/FileInputStream.java b/src/share/classes/java/io/FileInputStream.java --- a/src/share/classes/java/io/FileInputStream.java +++ b/src/share/classes/java/io/FileInputStream.java @@ -279,7 +279,11 @@ * @exception IOException if n is negative, if the stream does not * support seek, or if an I/O error occurs. */ - public native long skip(long n) throws IOException; + public long skip(long n) throws IOException { + return skip0(n); + } + + private native long skip0(long n) throws IOException; /** * Returns an estimate of the number of remaining bytes that can be read (or @@ -298,7 +302,11 @@ * @exception IOException if this file input stream has been closed by calling * {@code close} or an I/O error occurs. */ - public native int available() throws IOException; + public int available() throws IOException { + return available0(); + } + + private native int available0() throws IOException; /** * Closes this file input stream and releases any system resources diff --git a/src/share/native/java/io/FileInputStream.c b/src/share/native/java/io/FileInputStream.c --- a/src/share/native/java/io/FileInputStream.c +++ b/src/share/native/java/io/FileInputStream.c @@ -73,7 +73,7 @@ } JNIEXPORT jlong JNICALL -JavajavaioFileInputStreamskip(JNIEnv *env, jobject this, jlong toSkip) { +JavajavaioFileInputStreamskip0(JNIEnv *env, jobject this, jlong toSkip) { jlong cur = jlongzero; jlong end = jlongzero; FD fd = GETFD(this, fisfd); @@ -90,7 +90,7 @@ } JNIEXPORT jint JNICALL -JavajavaioFileInputStreamavailable(JNIEnv *env, jobject this) { +JavajavaioFileInputStreamavailable0(JNIEnv *env, jobject this) { jlong ret; FD fd = GETFD(this, fisfd); if (fd == -1) {

Sunny Chan Executive Director Technology Goldman Sachs (Asia) L.L.C. | 39th Floor | The Center | 99 Queens Road Central | Hong Kong Email: sunny.chan at gs.com | Tel: +852 2978 6481 | Fax: +852 2978 0633 Learn more about Goldman Sachs GS.com<http://www.goldmansachs.com/> | Blog<http://www.goldmansachs.com/careers/blog/index.html> | LinkedIn<http://www.linkedin.com/company/goldman-sachs/careers> | YouTube<http://www.youtube.com/goldmansachs> | Twitter<http://www.twitter.com/goldmansachs> This message may contain information that is confidential or privileged. If you are not the intended recipient, please advise the sender immediately and delete this message. See http://www.gs.com/disclaimer/email for further information on confidentiality and the risks inherent in electronic communication.



More information about the jdk8u-dev mailing list