Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4910572

jarFile.getInputStream dumps core if JarFile is closed.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 5.0
    • 1.2.0, 5.0
    • core-libs
    • tiger
    • sparc
    • solaris_2.5, solaris_2.6
    • Verified



      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

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

            martin Martin Buchholz
            aycsunw Ayc Ayc (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: