https://issues.apache.org/bugzilla/show_bug.cgi?id=44913
Summary: org.apache.tools.zip unable to unzip file created by
org.apache.tools.zip
Product: Ant
Version: 1.7.0
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Other
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
Created an attachment (id=21888)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=21888)
Source code to demonstrate the bug. The main class is ZipUtils.
I have a simple class that can compress and extract zip files using the classes
in the package org.apache.tools.zip. The compression works fine and several zip
programs are able to read the file: Info-zip, ALZip, etc. However when I
attempt to extract the zip file again using the classes in org.apache.tools.zip
it fails. There is no exception thrown, instead the method getEntries() returns
a value of 0, indicating that this is a completely empty zip file.
If you modify this line of code in my ZipUtils class, it will start working:
WORKS:
final ZipOutputStream jos = new ZipOutputStream( new BufferedOutputStream( new
FileOutputStream( outfile ) ) );
DOESN'T WORK:
final ZipOutputStream jos = new ZipOutputStream( outfile );
The subsequent line causes the ZipOutputStream to use a RandomAccessFile when
making the zip file. I would prefer to use the RandomAccessFile because it does
not result in the creation of extra Data Descriptor chunks that waste space. I
don't know if the problem is with the compression or the extraction, but my
guess is the extraction since I can open the created zip file in many native
programs.
I have attached my code to this bug.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.