commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomisław Kityński (JIRA) <>
Subject [jira] [Created] (COMPRESS-452) "Stream is not in the BZip2 format" exception on valid archive
Date Sun, 06 May 2018 21:24:00 GMT
Tomisław Kityński created COMPRESS-452:

             Summary: "Stream is not in the BZip2 format" exception on valid archive
                 Key: COMPRESS-452
             Project: Commons Compress
          Issue Type: Bug
          Components: Archivers, Compressors
    Affects Versions: 1.16.1
            Reporter: Tomisław Kityński
             Fix For: 1.16.1
         Attachments: txt.7z

The included 7z archive (with only one file), that is password protected, can be properly
decompressed with 7z tool. Yet, getNextEntry() throws "Stream is not in the BZip2 format"

The code is:

{{private static final byte[] PASSWORD = "iBlm8NTigvru0Jr0".getBytes();}}

{{public static void main(String[] args) throws IOException {}}
{{    String fileName = "r:/txt.7z";}}
{{    SevenZArchiveEntry entry;}}
{{    try (SevenZFile arch = new SevenZFile(new File(fileName), PASSWORD)) {}}
{{        while ((entry = arch.getNextEntry()) != null) }}{{{}}
{{            System.out.println(entry.getName());}}
{{        }}}

{{    }}}

The same exception is thrown when one uses SevenZFile(SeekableByteBuffer, byte[]) constructor.
Password seems to be OK, since changing it yields different exception (and it also works in
7z tool).

Full exception is:

{{Exception in thread "main" Stream is not in the BZip2 format}}
{{ at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.init(}}
{{ at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.<init>(}}
{{ at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.<init>(}}
{{ at org.apache.commons.compress.archivers.sevenz.Coders$BZIP2Decoder.decode(}}
{{ at org.apache.commons.compress.archivers.sevenz.Coders.addDecoder(}}
{{ at org.apache.commons.compress.archivers.sevenz.SevenZFile.buildDecoderStack(}}
{{ at org.apache.commons.compress.archivers.sevenz.SevenZFile.buildDecodingStream(}}
{{ at org.apache.commons.compress.archivers.sevenz.SevenZFile.getNextEntry(}}
{{ at UnpackTest.main(}}




This message was sent by Atlassian JIRA

View raw message