-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
6u23
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows XP SP3, Windows 7
A DESCRIPTION OF THE PROBLEM :
java.util.zip.ZipInputStream generates incomplete entries: ZipEntry.getCompressedSize() and ZipEntry.getCrc() data is missing.
At the same time java.util.zip.ZipFile processes the same archive fine.
The jar-archive is created in 3.7 M4 with Oracle 1.6 JRE
The reference SPR in Eclipse bug tracking system:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=333073
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Package a simple jar-file via Eclipse 3.6.2 or 3.7.0
The source code can be downloaded from http://www.devdaily.com/java/jwarehouse/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/jarpackagerfat/JarWriter4.java.shtml and used in a separate test.
Contact me if you would like to have the existing file for testing.
2) Create an application for reading the jar-files using the code in the Source code section.
3) Run the application: CRC and Size are missing
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ENTRY 1 : META-INF/MANIFEST.MF : E80AFD6E : 65
ENTRY 2 : ListZipFiles.class : 4CC7B653 : 1164
ACTUAL -
Opening zip file ListZipFiles.jar
ENTRY 1 : META-INF/MANIFEST.MF : FFFFFFFFFFFFFFFF : -1
ENTRY 2 : ListZipFiles.class : FFFFFFFFFFFFFFFF : -1
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
The code below doesn’t retrieve crc and size:
FileInputStream fin = new FileInputStream(zipFileName);
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry z = zin.getNextEntry();
while (z != null) {
...
System.out.println("ENTRY " + counter + " : " + zipEntryName + " : " + Long.toHexString(z.getCrc()).toUpperCase()+ " : " + z.getCompressedSize());
z = zin.getNextEntry();
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
This code works fine:
ZipFile zipFile = new ZipFile(zipFileName);
for ( Enumeration<? extends ZipEntry> entries = zipFile.entries(); entries.hasMoreElements(); )
{
ZipEntry z = entries.nextElement();
System.out.println( Long.toHexString(z.getCrc()).toUpperCase()+ " : " + z.getCompressedSize());
}
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows XP SP3, Windows 7
A DESCRIPTION OF THE PROBLEM :
java.util.zip.ZipInputStream generates incomplete entries: ZipEntry.getCompressedSize() and ZipEntry.getCrc() data is missing.
At the same time java.util.zip.ZipFile processes the same archive fine.
The jar-archive is created in 3.7 M4 with Oracle 1.6 JRE
The reference SPR in Eclipse bug tracking system:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=333073
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Package a simple jar-file via Eclipse 3.6.2 or 3.7.0
The source code can be downloaded from http://www.devdaily.com/java/jwarehouse/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/jarpackagerfat/JarWriter4.java.shtml and used in a separate test.
Contact me if you would like to have the existing file for testing.
2) Create an application for reading the jar-files using the code in the Source code section.
3) Run the application: CRC and Size are missing
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ENTRY 1 : META-INF/MANIFEST.MF : E80AFD6E : 65
ENTRY 2 : ListZipFiles.class : 4CC7B653 : 1164
ACTUAL -
Opening zip file ListZipFiles.jar
ENTRY 1 : META-INF/MANIFEST.MF : FFFFFFFFFFFFFFFF : -1
ENTRY 2 : ListZipFiles.class : FFFFFFFFFFFFFFFF : -1
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
The code below doesn’t retrieve crc and size:
FileInputStream fin = new FileInputStream(zipFileName);
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry z = zin.getNextEntry();
while (z != null) {
...
System.out.println("ENTRY " + counter + " : " + zipEntryName + " : " + Long.toHexString(z.getCrc()).toUpperCase()+ " : " + z.getCompressedSize());
z = zin.getNextEntry();
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
This code works fine:
ZipFile zipFile = new ZipFile(zipFileName);
for ( Enumeration<? extends ZipEntry> entries = zipFile.entries(); entries.hasMoreElements(); )
{
ZipEntry z = entries.nextElement();
System.out.println( Long.toHexString(z.getCrc()).toUpperCase()+ " : " + z.getCompressedSize());
}
- relates to
-
JDK-8278165 Clarify that ZipInputStream does not access the CEN fields for a ZipEntry
-
- Resolved
-