JDK-4910572 : jarFile.getInputStream dumps core if JarFile is closed.
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 1.2.0,5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_2.5,solaris_2.6
  • CPU: sparc
  • Submitted: 2003-08-21
  • Updated: 2017-05-16
  • Resolved: 2003-09-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
5.0 tigerFixed
Related Reports
Duplicate :  

Name: acR10002			Date: 08/21/2003

Filed By      : SPB JCK team (###@###.###)
JDK           : java full version "1.5.0-beta-b15"
JCK           : 1.5
Platform[s]   : Solaris
switch/Mode   : 
JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
Failing Test [s] :

Problem description
Please see the test below which produces core dump in JDK 1.5. 
The steps to reproduce:
1) Copy attached test.jar into your working dircetory
2) Compile and run the Test.jar in the same directory.

Under 1.4.1 the test would produce:
->/set/java/jdk1.4.1/solaris/bin/java  Test
Exception in thread "main" java.lang.IllegalStateException: zip file closed
        at java.util.zip.ZipFile.ensureOpen(ZipFile.java:398)
        at java.util.zip.ZipFile.getEntry(ZipFile.java:145)
        at java.util.jar.JarFile.getEntry(JarFile.java:184)
        at java.util.jar.JarFile.getJarEntry(JarFile.java:171)
        at java.util.jar.JarFile.getManifest(JarFile.java:129)
        at java.util.jar.JarFile.getInputStream(JarFile.java:307)
        at Test.main(Test.java:15)

while under 1.4.2 and 1.5.0 it dumps a core now.

Minimized test:
------- Test.java -------
import java.io.*;
import java.util.jar.*;
import java.util.zip.*;

public class Test {

    public static void main(String args[]) {

        File file = new File("test.jar");
        String testEntryName = "entry3.dat";
        try {
            JarFile jarFile = new JarFile(file);
            ZipEntry testEntry = jarFile.getEntry(testEntryName);
        } catch (IOException e) {
            System.out.println("Unexpected " + e + " thrown");


------- end-of-Test.java -------

Minimized test output:
->java Test
Assertion failed: zfile != 0, file ../../../src/share/native/java/util/zip/ZipFile.c, line 220
Abort (core dumped)

JCK test source location:

Specific Machine Info:
SunOS mars 5.9 Beta_Refresh sun4u sparc SUNW,Ultra-60


CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b20 VERIFIED IN: tiger-b41

EVALUATION The crash occurs in getMetaInfEntryNames. It seems reasonable for Java code to call this without first calling ensureOpen() - it seems more reasonable for the C code itself to throw an error instead of aborting. ###@###.### 2003-08-23