You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Peter Lee (Jira)" <ji...@apache.org> on 2021/03/17 02:03:00 UTC
[jira] [Commented] (COMPRESS-571) 7z random access failes on
shuffled entry list
[ https://issues.apache.org/jira/browse/COMPRESS-571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17303018#comment-17303018 ]
Peter Lee commented on COMPRESS-571:
------------------------------------
The _getEntries()_ returns exactly the same list of entries so the shuffle may also affect the same amout of entries.
Maybe we should return a copy of entries in _getEntries()_ ?
> 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
> Priority: Major
>
> 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)