Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.20
-
None
-
None
Description
I noticed a problem on a 7z file and could reproduce the error if the InputStream is retrieved after shuffling the entries.
This test fails with a checksum verification error
@Test public void retrieveInputStreamForShuffledEntries() throws IOException { try (final SevenZFile sevenZFile = new SevenZFile(getFile("COMPRESS-256.7z"))) { List<SevenZArchiveEntry> entries = (List<SevenZArchiveEntry>) sevenZFile.getEntries(); Collections.shuffle(entries); for (final SevenZArchiveEntry entry : entries) { IOUtils.toByteArray(sevenZFile.getInputStream(entry)); } } }
This is the exception
java.io.IOException: Checksum verification failed at org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:94) at org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:74) at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:87) at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:62) at org.apache.commons.compress.utils.IOUtils.toByteArray(IOUtils.java:247) at org.apache.commons.compress.archivers.sevenz.SevenZFileTest.retrieveInputStreamForShuffledEntries(SevenZFileTest.java:616)
This also fails on the current master with the same error