You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Andrii Hudz (Jira)" <ji...@apache.org> on 2022/10/06 15:02:00 UTC

[jira] [Created] (COMPRESS-629) AssertionError on 7z multiple compress methods

Andrii Hudz created COMPRESS-629:
------------------------------------

             Summary: AssertionError on 7z multiple compress methods
                 Key: COMPRESS-629
                 URL: https://issues.apache.org/jira/browse/COMPRESS-629
             Project: Commons Compress
          Issue Type: Bug
          Components: Archivers
    Affects Versions: 1.21
            Reporter: Andrii Hudz


AssertionError on specific compression methods: BZIP2 + LZMA2

No exception if uncomment 'entry.setContentMethods(methods)'

Please check if it is an issue.

 
{code:java}
public class ApacheCompress_1_21_AssertionError_7z_Test {
    @Test
    public void testStackOfContentCompressions() throws Exception {
        File file = File.createTempFile("test",".7z");
        try (final SevenZOutputFile archive = new SevenZOutputFile(file)) {
            final ArrayList<SevenZMethodConfiguration> methods = new ArrayList<>();
            methods.add(new SevenZMethodConfiguration(SevenZMethod.BZIP2));
            methods.add(new SevenZMethodConfiguration(SevenZMethod.LZMA2));
            archive.setContentMethods(methods);
            final SevenZArchiveEntry entry = new SevenZArchiveEntry();
            entry.setName("bar.txt");
            //entry.setContentMethods(methods);
            archive.putArchiveEntry(entry);
            archive.write(new byte[] { 'a' });
            archive.closeArchiveEntry();
        }
        finally {
            file.deleteOnExit();
        }
    }
} {code}
 

Exception:

 
{code:java}
java.lang.AssertionError
    at org.tukaani.xz.lz.LZEncoder.processPendingBytes(Unknown Source)
    at org.tukaani.xz.lz.LZEncoder.setFlushing(Unknown Source)
    at org.tukaani.xz.LZMA2OutputStream.flush(Unknown Source)
    at java.base/java.io.FilterOutputStream.flush(FilterOutputStream.java:153)
    at java.base/java.io.FilterOutputStream.close(FilterOutputStream.java:182)
    at org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream.close(BZip2CompressorOutputStream.java:505)
    at java.base/java.io.FilterOutputStream.close(FilterOutputStream.java:188)
    at org.apache.commons.compress.archivers.sevenz.SevenZOutputFile.closeArchiveEntry(SevenZOutputFile.java:207)
    at ApacheCompress_1_21_AssertionError_7z_Test.testStackOfContentCompressions(ApacheCompress_1_21_AssertionError_7z_Test.java:25){code}
 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)