From: John L. <je...@pi...> - 2001-10-08 17:51:51
|
> Hello, > > you have done a good job, I use jazzlib as a replacement for java.util.zip > (which does not work) for a Swing-based Zip tool. > > First let me allow the hint that Sun does not permit the usage of "java.util" > packages for third parties. Maybe you get into trouble. These classes are now part of the Classpath project (http://www.gnu.org/software/classpath/). The Classpath project is a replacement for Sun's class libraries, so java.util.zip is the correct place for these classes. > Now my contribution. There is a bug in your java.util.ZipFile. > > According to > > www.pkware.com/support/appnote.html > > there can be variable-length comments at the end of the file. Your code > assumes the central directory size is fixed, but it's not. Some "odd" Zips > will fail with a ZipException "Missing end of central directory". > > Attached you find a util.ZipFile source file for your convenience. It fixes > this bug by seeking backward from end of file minus minimum size of the > central directory. All Zips I have are recognized now. > > My fix throws a "invalid zip or broken" if it fails to find the header > signature. Your contribution would be more useful if you downloaded the latest version of ZipFile (from http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/util/zip/ZipFile.java?rev=1.3&content-type=text/vnd.viewcvs-markup ) And gave us a diff which showed the changes. Do you have an example of a zip file that has a comment at the end? Thanks John Leuner |