RFR 8080225: FileInputStream cleanup should be improved

mandy chung mandy.chung at oracle.com
Thu Oct 12 18:00:14 UTC 2017

On 10/4/17 7:35 AM, Roger Riggs wrote:
> Updated the webrev in place:
> http://cr.openjdk.java.net/~rriggs/webrev-fis-cleanup-8080225/

Looks good.  One minor comment:

251 private static native void cleanupClose0(int fd);
75 Java_java_io_FileDescriptor_cleanupClose0(JNIEnv *env, jclass 
fdClass, jint fd) {
76 if (close(fd) == -1) {
77 JNU_ThrowIOExceptionWithLastError(env, "close failed");
78 }
79 }

The native implementation throws IOException when there is any error.

Not directly related to this change: when there is any error in closing 
FIS/FOS,  the exception will be ignored by the cleaner.   I wonder if we 
could enhance the Cleaner's diagnosability to log any exception thrown; 
of course this is a separate RFE that might have been considered.


More information about the core-libs-dev mailing list