RFA: 8169556: Wrapping of FileInputStream's native skip and available methods
Rob McKenna
rob.mckenna at oracle.com
Fri Mar 10 13:58:49 UTC 2017
Approved
-Rob
On 10/03/17 08:05, Roger Riggs wrote:
> 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 @@
> > Java_java_io_FileDescriptor_initIDs;
> > Java_java_io_FileDescriptor_sync;
> >- Java_java_io_FileInputStream_available;
> >+ Java_java_io_FileInputStream_available0;
> > Java_java_io_FileInputStream_close0;
> > Java_java_io_FileInputStream_initIDs;
> > Java_java_io_FileInputStream_open0;
> > Java_java_io_FileInputStream_read0;
> > Java_java_io_FileInputStream_readBytes;
> >- Java_java_io_FileInputStream_skip;
> >+ Java_java_io_FileInputStream_skip0;
> > Java_java_io_FileOutputStream_close0;
> > Java_java_io_FileOutputStream_initIDs;
> > Java_java_io_FileOutputStream_open0;
> >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%Java_java_io_FileInputStream_readBytes;
> >text: .text%readBytes;
> >-text: .text%Java_java_io_FileInputStream_available;
> >+text: .text%Java_java_io_FileInputStream_available0;
> >text: .text%Java_java_io_FileInputStream_close0;
> >text: .text%Java_java_lang_System_mapLibraryName;
> >text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
> >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%Java_java_io_FileInputStream_readBytes;
> >text: .text%readBytes;
> >-text: .text%Java_java_io_FileInputStream_available;
> >+text: .text%Java_java_io_FileInputStream_available0;
> >text: .text%Java_java_io_FileInputStream_close0;
> >text: .text%Java_java_lang_Compiler_registerNatives;
> >text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
> >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%JNU_GetEnv;
> >text: .text%Java_java_io_UnixFileSystem_checkAccess;
> >text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
> >-text: .text%Java_java_io_FileInputStream_available;
> >+text: .text%Java_java_io_FileInputStream_available0;
> >text: .text%Java_java_lang_reflect_Array_newArray;
> >text: .text%Java_java_lang_Throwable_getStackTraceDepth;
> >text: .text%Java_java_lang_Throwable_getStackTraceElement;
> >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
> >-Java_java_io_FileInputStream_skip(JNIEnv *env, jobject this, jlong toSkip) {
> >+Java_java_io_FileInputStream_skip0(JNIEnv *env, jobject this, jlong toSkip) {
> > jlong cur = jlong_zero;
> > jlong end = jlong_zero;
> > FD fd = GET_FD(this, fis_fd);
> >@@ -90,7 +90,7 @@
> >}
> > JNIEXPORT jint JNICALL
> >-Java_java_io_FileInputStream_available(JNIEnv *env, jobject this) {
> >+Java_java_io_FileInputStream_available0(JNIEnv *env, jobject this) {
> > jlong ret;
> > FD fd = GET_FD(this, fis_fd);
> > 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