Invalid zip file coming through from applet
Posted: Fri Jul 18, 2008 4:12 am
We are using the zip feature of jfileupload to compress files before uploading to the server.
In some cases an erroneous zip file comes through. This results in an exception similar to the following:
java.util.zip.ZipException: invalid END header (bad central directory offset)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
...
On command line:
$ zipinfo /tmp/insideflap.zip
[/tmp/insideflap.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.
zipinfo: cannot find zipfile directory in one of /tmp/insideflap.zip or
/tmp/insideflap.zip.zip, and cannot find /tmp/insideflap.zip.ZIP, period.
I am able to reproduce this type of error when the zip output stream is not closed (in a test program). It is ok when zipentry, zipoutputstream and FileOutputStream all are properly closed.
Can you confirm that this is not an issue within jfileupload?
In some cases an erroneous zip file comes through. This results in an exception similar to the following:
java.util.zip.ZipException: invalid END header (bad central directory offset)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
...
On command line:
$ zipinfo /tmp/insideflap.zip
[/tmp/insideflap.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.
zipinfo: cannot find zipfile directory in one of /tmp/insideflap.zip or
/tmp/insideflap.zip.zip, and cannot find /tmp/insideflap.zip.ZIP, period.
I am able to reproduce this type of error when the zip output stream is not closed (in a test program). It is ok when zipentry, zipoutputstream and FileOutputStream all are properly closed.
Can you confirm that this is not an issue within jfileupload?