ZipOutputStream, ZipFile and Linux unzip do not agree on the file count in zip

C

C B

I think there is a bug in ZipFile...

I use ZipOutputStream to build a zip file. The program zipped 72417
files, but after checking it with ZipFile, ZipFile.size() reported
only 6881 files in the file. So unfortunately, Java is unable to read
all the entries in the zip file, but Linux's PK-INFO (unzip) is able
to read the file.


I went on an older UNIX (non linux) server around here and tried
unzip, it said:
note: didn't find end-of-central-dir signature at end of central dir.
(please check that you have transferred or created the zipfile in
the
appropriate BINARY mode and that you have compiled UnZip properly)

The zip file is not corrupt, there isn't any data loss (with Linux's
unzip I can read all entries).
I'm using an IBM JVM, Java 1.4.2.

Any suggestions?
 
R

Real Gagnon

I think there is a bug in ZipFile...
I use ZipOutputStream to build a zip file. The program zipped 72417
files, but after checking it with ZipFile, ZipFile.size() reported
only 6881 files in the file. So unfortunately, Java is unable to read
all the entries in the zip file, but Linux's PK-INFO (unzip) is able
to read the file.

It's possible, check this bug
"Cannot handle zip files with more than 65535 files" at

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5084334

Bye.
 
T

Thomas Weidenfeller

C said:
I use ZipOutputStream to build a zip file. The program zipped 72417
files, but after checking it with ZipFile, ZipFile.size() reported
only 6881 files in the file. So unfortunately, Java is unable to read
all the entries in the zip file, but Linux's PK-INFO (unzip) is able
to read the file.

If you subtract the numbers, you will get a very familiar number (old
trick in such cases - play with the numbers. Looking at the binary
representation also often provides clues). Here the result indicates
that you most likely have a short (16 bit) integer overflow. I can't
tell you if this happens in your code, in Sun's Java code, in the C ZIP
library use by Sun, or if this might even be a limitation of the ZIP
file format.

/Thomas
 
C

Chris Uppal

Thomas said:
I can't
tell you if this happens in your code, in Sun's Java code, in the C ZIP
library use by Sun, or if this might even be a limitation of the ZIP
file format.

It's a limit of the ZIP file format. The bug-report link that Real posted has
some more detail.

-- chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top