You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2008/04/30 21:28:40 UTC

DO NOT REPLY [Bug 44913] New: org.apache.tools. zip unable to unzip file created by org.apache.tools.zip

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: notifications@ant.apache.org
        ReportedBy: jacob.abrams@glu.com


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.

DO NOT REPLY [Bug 44913] org.apache.tools.zip unable to unzip file created by org.apache.tools.zip

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44913


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 44913] org.apache.tools.zip unable to unzip file created by org.apache.tools.zip

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44913


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |WORKSFORME




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 44913] org.apache.tools. zip unable to unzip file created by org.apache.tools.zip

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44913





--- Comment #4 from David Green <da...@maketechnologies.com>  2008-05-07 11:48:42 PST ---
interesting thing about this problem:  after creating the zip file, unzip it
and discover that jar files that were zipped are now exactly double their
original size.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44913] org.apache.tools. zip unable to unzip file created by org.apache.tools.zip

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44913





--- Comment #5 from David Green <da...@maketechnologies.com>  2008-05-07 12:32:52 PST ---
stupid me... turns out that my Ant build script was copying these jar files
with a filterset prior to zipping them up.  Please ignore my previous comments.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44913] org.apache.tools. zip unable to unzip file created by org.apache.tools.zip

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44913


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |notifications@ant.apache.org
         AssignedTo|notifications@ant.apache.org|bodewig@apache.org




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.

DO NOT REPLY [Bug 44913] org.apache.tools. zip unable to unzip file created by org.apache.tools.zip

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44913





--- Comment #2 from David Green <da...@maketechnologies.com>  2008-05-07 09:50:10 PST ---
I suspect that the zip file creation is the culprit, since 3rd party tools
cannot unzip the file correctly.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44913] org.apache.tools. zip unable to unzip file created by org.apache.tools.zip

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44913





--- Comment #6 from Stefan Bodewig <bo...@apache.org>  2008-07-18 04:02:50 PST ---
Jacob, does this happen independent of the input you use?

Roundtripping archives is part of Ant's testsuite so I'm pretty certain that it
works when used the way Ant uses it (<zip> uses the file argument constructor).
 It could be related to the things you are trying to compress/extract.

With the attachment on its own it seems to work for me.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 44913] org.apache.tools. zip unable to unzip file created by org.apache.tools.zip

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44913





--- Comment #1 from David Green <da...@maketechnologies.com>  2008-05-07 09:47:44 PST ---
I have encountered the same problem, however the problem only comes up when
using a simple Ant build script.

The Ant build script does the following steps:

1. Create a zip file containing one file, a jar
1.a. Test unzipping the original jar file to ensure that it is valid/works
2. Unzip the zip file
3. Unzip the jar file from the unzipped zip file

At step 3 the unzip operation fails.  Note that this problem occurs only using
an Ant build script with no custom classes or coding.  Here's the exception
that I get:

java.io.EOFException
        at java.io.RandomAccessFile.readFully(RandomAccessFile.java:383)
        at java.io.RandomAccessFile.readFully(RandomAccessFile.java:361)
        at
org.apache.tools.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:267)
        at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:143)
        at org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:136)
        at org.apache.tools.ant.taskdefs.Expand.execute(Expand.java:106)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44913] org.apache.tools. zip unable to unzip file created by org.apache.tools.zip

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44913





--- Comment #3 from David Green <da...@maketechnologies.com>  2008-05-07 11:20:27 PST ---
this may be an OS-specific or VM-specific issue, as the same build succeeds on
MacOS X but fails on Linux 2.6.18-53.1.14.el5PAE #1 SMP Wed Mar 5 12:07:47 EST
2008 i686 i686 i386 GNU/Linux

VM configuration:

[echoproperties] java.runtime.name=Java(TM) SE Runtime Environment
[echoproperties] java.runtime.version=1.6.0_06-b02
[echoproperties] java.specification.name=Java Platform API Specification
[echoproperties] java.specification.vendor=Sun Microsystems Inc.
[echoproperties] java.specification.version=1.6
[echoproperties] java.vendor=Sun Microsystems Inc.
[echoproperties] java.vendor.url=http\://java.sun.com/
[echoproperties] java.vendor.url.bug=http\://java.sun.com/cgi-bin/bugreport.cgi
[echoproperties] java.version=1.6.0_06
[echoproperties] java.vm.info=mixed mode
[echoproperties] java.vm.name=Java HotSpot(TM) Server VM
[echoproperties] java.vm.specification.name=Java Virtual Machine Specification
[echoproperties] java.vm.specification.vendor=Sun Microsystems Inc.
[echoproperties] java.vm.specification.version=1.0
[echoproperties] java.vm.vendor=Sun Microsystems Inc.
[echoproperties] java.vm.version=10.0-b22


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44913] org.apache.tools. zip unable to unzip file created by org.apache.tools.zip

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44913


David Green <da...@maketechnologies.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |david.green@maketechnologies
                   |                            |.com




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.