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

java.util.ZipFile fails on zipfiles > 4 GB (extracted)

XMLWordPrintable

      FULL PRODUCT VERSION :
      jdk1.8.0_60
      jdk1.7.0_51

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 enterprise

      A DESCRIPTION OF THE PROBLEM :
      I'm using the ZipFile Class to get the ZipEntry of a zipfile . And depending on their name I stream the entries to a database.
      This works using : ZipFile zipFile = new ZipFile(file);
      But only when the zipfile extracted size is below 4 GB . When bigger this gives a ZipException: invalid CEN header (bad signature).


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
                  ZipFile zipFile = new ZipFile(file);
                  final Enumeration<? extends ZipEntry> entries = zipFile.entries();
                  while (entries.hasMoreElements()) {
                      ZipEntry nextElement = entries.nextElement();
                      System.out.println("nextElement " + nextElement.getName());

                  }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A print of the entries.
      ACTUAL -
      A print of the entries when the extracted size is below 4 GB, an error otherwise.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.util.zip.ZipException: invalid CEN header (bad signature)
      at java.util.zip.ZipFile.open(Native Method)
      at java.util.zip.ZipFile.<init>(ZipFile.java:215)
      at java.util.zip.ZipFile.<init>(ZipFile.java:145)
      at java.util.zip.ZipFile.<init>(ZipFile.java:159)
      at testing.ZipFileRead.withZipFile(ZipFileRead.java:41)
      at testing.ZipFileRead.main(ZipFileRead.java:153)

      REPRODUCIBILITY :
      This bug can be reproduced always.

            sherman Xueming Shen
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: