I believe this issue is still not fixed (tested in 2.9.0). The attached simple example of writing a zip archive with just two directories using ZipOutputStream and then reading with ZipInputStream fails to read the second entry.
The offending code seems to be in ZipInputStream.read(byte[], int, int) lines 155-157:
if (localFileHeader.isDirectory()) { return -1; }
Since this stops reading before endOfCompressedDataRecord() can be called, and subsequently read the data descriptor block. Reading the next entry then silently fails because the signature is for a data descriptor and not a local file header.
Zip4jDirectoryDataDescriptorBug.zip
Originally posted by @mbach979 in #309 (comment)
I believe this issue is still not fixed (tested in 2.9.0). The attached simple example of writing a zip archive with just two directories using ZipOutputStream and then reading with ZipInputStream fails to read the second entry.
The offending code seems to be in ZipInputStream.read(byte[], int, int) lines 155-157:
if (localFileHeader.isDirectory()) { return -1; }Since this stops reading before endOfCompressedDataRecord() can be called, and subsequently read the data descriptor block. Reading the next entry then silently fails because the signature is for a data descriptor and not a local file header.
Zip4jDirectoryDataDescriptorBug.zip
Originally posted by @mbach979 in #309 (comment)