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

ZipFile refuses to open valid ZIP files.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7
    • 1.4.1
    • core-libs
    • b64
    • x86
    • linux



      Name: gm110360 Date: 11/08/2002


      FULL PRODUCT VERSION :
      java version "1.4.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
      Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      RedHat Linux 7.3
       
      Note: this bug can be reproduced on Windows too, and also
      appears in older Sun JDK versions!

      A DESCRIPTION OF THE PROBLEM :
      I have encountered two ZIP files that are valid according
      to WinZIP (on Windows), unzip (on Linux) and even test and
      extract fine with Java's own "jar" command. However, they
      cause an exception when you try to open them using the
      ZipFile class.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Download the two test ZIP files from my site:
         http://www.xs4all.nl/~mfo/45_mIIb1.cup.zip
         http://www.xs4all.nl/~mfo/green.zip
      2. Compile and run the test code provided below and start
         the class using either downloaded file as the sole
         command line argument.
      3. You will now see an exception!
       
      and:
       
      4. Verify the archives with the jar tool, they can be
         extracted without problems.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I expect that ZIP files that can be opened with jar,
      WinZIP and unzip and test and extract well, can also be
      opened by the ZipFile class.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.util.zip.ZipException: error in opening zip file
              at java.util.zip.ZipFile.open(Native Method)
              at java.util.zip.ZipFile.<init>(ZipFile.java:112)
              at java.util.zip.ZipFile.<init>(ZipFile.java:72)
              at ZipTest.main(Unknown Source)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.zip.*;
       
      public class ZipTest {
       
          public static void main(String[] args) {
              try {
                  ZipFile z = new ZipFile(args[0]);
              }
              catch (Throwable t) {
                  t.printStackTrace();
              }
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      None really, other than using a different ZIP file
      implementation.
      (Review ID: 166848)
      ======================================================================

            sherman Xueming Shen
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: