From 492a3f16d503556ba83c6f5ac03e4c782c969cbf Mon Sep 17 00:00:00 2001 From: rriggs Date: Tue, 14 Mar 2017 10:21:45 -0400 Subject: [PATCH] 8169556: Wrapping of FileInputStream's native skip and available methods Summary: Wrap further native methods in FileInputStreams Reviewed-by: chegar, bpb, rriggs Contributed-by: sunny.chan@gs.com --- make/mapfiles/libjava/mapfile-vers | 4 ++-- make/mapfiles/libjava/reorder-sparc | 2 +- make/mapfiles/libjava/reorder-sparcv9 | 2 +- make/mapfiles/libjava/reorder-x86 | 2 +- src/share/classes/java/io/FileInputStream.java | 12 ++++++++++-- src/share/native/java/io/FileInputStream.c | 4 ++-- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/make/mapfiles/libjava/mapfile-vers b/make/mapfiles/libjava/mapfile-vers index 1b371a2c6..0d3e9e059 100644 --- a/make/mapfiles/libjava/mapfile-vers +++ b/make/mapfiles/libjava/mapfile-vers @@ -76,13 +76,13 @@ SUNWprivate_1.1 { 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 index d10037652..96f8e735d 100644 --- a/make/mapfiles/libjava/reorder-sparc +++ b/make/mapfiles/libjava/reorder-sparc @@ -48,7 +48,7 @@ text: .text%Java_java_io_FileInputStream_open0; 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 index 2609711c2..c10007b78 100644 --- a/make/mapfiles/libjava/reorder-sparcv9 +++ b/make/mapfiles/libjava/reorder-sparcv9 @@ -51,7 +51,7 @@ text: .text%Java_java_io_FileInputStream_open0; 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 index b8ea2d43d..e0566b325 100644 --- a/make/mapfiles/libjava/reorder-x86 +++ b/make/mapfiles/libjava/reorder-x86 @@ -78,7 +78,7 @@ text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_Pri 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 index 47d13a99a..d1a902d42 100644 --- a/src/share/classes/java/io/FileInputStream.java +++ b/src/share/classes/java/io/FileInputStream.java @@ -279,7 +279,11 @@ class FileInputStream extends InputStream * @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 @@ class FileInputStream extends InputStream * @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 index dc1aea5cd..db565e61d 100644 --- a/src/share/native/java/io/FileInputStream.c +++ b/src/share/native/java/io/FileInputStream.c @@ -73,7 +73,7 @@ Java_java_io_FileInputStream_readBytes(JNIEnv *env, jobject this, } 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 @@ Java_java_io_FileInputStream_skip(JNIEnv *env, jobject this, jlong toSkip) { } 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) { -- GitLab