Between JDK 1.2.2 and JDK 1.3, a finalizer was added to java.util.zip.ZipFile
which calls close(). However, the jlong pointing to the underlying C data
structure is being passed around as an identifier rather than the Java object.
The specific application code which now fails is:
- Create ZipFile
- Obtain InputStream (ZipFileInputStream)
- Release Java reference to ZipFile
The ZipFile will then be GC'd while the application is reading from the input
stream, leading to a crash in native code.
which calls close(). However, the jlong pointing to the underlying C data
structure is being passed around as an identifier rather than the Java object.
The specific application code which now fails is:
- Create ZipFile
- Obtain InputStream (ZipFileInputStream)
- Release Java reference to ZipFile
The ZipFile will then be GC'd while the application is reading from the input
stream, leading to a crash in native code.
- duplicates
-
JDK-4351422 ZipFileInputStreams become invalid when ZipFiles are garbage collected
-
- Closed
-