invalid archives with java.util.zip



Hi,

I have a problem with ZIP files in JDK 1.5.
I'm using the following code to create a ZIP file from an XML
document:

Document doc;
// create document and set root element
ZipOutputStream out = new ZipOutputStream(new
FileOutputStream(filenameZIP));
out.putNextEntry(new ZipEntry(filenameXML));
// fill document and write it to output stream
out.close();

This runs without problems, never throws an exception and always
produces a ZIP file.
But sometimes and not reproducible the file cannot be unzipped. Then I
get the following error using unzip:

Archive: filename.zip
End-of-central-directory signature not found. Either this file is
not
a zipfile, or it constitutes one disk of a multi-part archive. In
the
latter case the central directory and zipfile comment will be found
on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of filename.zip or
filename.zip.zip, and cannot find filename.zip.ZIP, period.

When I try to unzip it with jar, I get:

java.io.EOFException: Unexpected end of ZLIB input stream
at
java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:216)
at
java.util.zip.InflaterInputStream.read(InflaterInputStream.java:134)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:139)
at sun.tools.jar.Main.extractFile(Main.java:714)
at sun.tools.jar.Main.extract(Main.java:677)
at sun.tools.jar.Main.run(Main.java:189)
at sun.tools.jar.Main.main(Main.java:903)

Again: This only happens in very few cases.
Has anyone an idea what could be wrong?

Thanks
Jan Strube
.



Relevant Pages

  • Re: help unzipping large (2G plus) zip
    ... are able to handle big gzip files so it might handle big zip files too. ... I've also tried unzip 5.51 on Linux rebuilt with - ... a zipfile, or it constitutes one disk of a multi-part archive. ... latter case the central directory and zipfile comment will be found ...
    (comp.os.linux.misc)
  • Re: Bad zip archive
    ... a zipfile, or it constitutes one disk of a multi-part archive. ... latter case the central directory and zipfile comment will be found on ... Are you just using the Finder unzip? ...
    (uk.comp.sys.mac)
  • Re: Bad zip archive
    ... a zipfile, or it constitutes one disk of a multi-part archive. ... latter case the central directory and zipfile comment will be found on ... Are you just using the Finder unzip? ...
    (uk.comp.sys.mac)
  • problem unziping large file
    ... a zipfile, or it constitutes one disk of a multi-part archive. ... latter case the central directory and zipfile comment will be found on ... $ unzip test.zip ... I have 200 gigs free, so space is not a problem. ...
    (Fedora)
  • Re: help unzipping large (2G plus) zip
    ... so I was actually able to get unzip to work on this! ... or within zipfile ... but they are running on the Windows platform. ... buying a Windows license and a WinZip license. ...
    (comp.os.linux.misc)