Robin Schimpf created COMPRESS-571: -------------------------------------- Summary: 7z random access failes on shuffled entry list Key: COMPRESS-571 URL: https://issues.apache.org/jira/browse/COMPRESS-571 Project: Commons Compress Issue Type: Bug Affects Versions: 1.20 Reporter: Robin Schimpf
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 {code:java} @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)); } } } {code} This is the exception {code:java} 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) {code} This also fails on the current master with the same error -- This message was sent by Atlassian Jira (v8.3.4#803005)