United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4910572 : jarFile.getInputStream dumps core if JarFile is closed.

Details
Type:
Bug
Submit Date:
2003-08-21
Status:
Closed
Updated Date:
2004-04-26
Project Name:
JDK
Resolved Date:
2003-09-12
Component:
core-libs
OS:
solaris_2.5,solaris_2.6
Sub-Component:
java.util.jar
CPU:
sparc
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.2.0,5.0
Fixed Versions:
5.0 (tiger)

Related Reports
Duplicate:

Sub Tasks

Description

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] :
    api/java_util/jar/JarFile/index.html#EntrGet[JarFile2004]


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);
            jarFile.close();
            jarFile.getInputStream(testEntry);
        } 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:
==========================
/java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests

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

======================================================================

                                    

Comments
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
                                     
2003-08-23
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger

FIXED IN:
tiger

INTEGRATED IN:
tiger
tiger-b20

VERIFIED IN:
tiger-b41


                                     
2004-06-14



Hardware and Software, Engineered to Work Together