You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "PeterL in (JIRA)" <ji...@apache.org> on 2014/04/23 10:21:16 UTC

[jira] [Updated] (COMPRESS-279) TarArchiveInputStream silently finished when unexpected EOF occured

     [ https://issues.apache.org/jira/browse/COMPRESS-279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

PeterL in updated COMPRESS-279:
-------------------------------

    Attachment: trim.tar
                trim.tar.bz2
                complete.tar

The complete.tar (golden) will generate:
LICENSE.txt 11357
NOTICE.txt 433
README.txt 1632
RELEASE-NOTES.txt *2648*

The command tar xf trim.tar will generate:
LICENSE.txt 11357
NOTICE.txt 433
README.txt 1632
RELEASE-NOTES.txt *2560*

Using the code above will generate:
LICENSE.txt 11357
NOTICE.txt 433
README.txt 1632
RELEASE-NOTES.txt *2616*


> TarArchiveInputStream silently finished when unexpected EOF occured
> -------------------------------------------------------------------
>
>                 Key: COMPRESS-279
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-279
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.7
>         Environment: Common Compress 1.7 + openJDK 1.7
>            Reporter: PeterL in
>              Labels: regression
>         Attachments: complete.tar, trim.tar, trim.tar.bz2
>
>
> I just found the following test case didn't raise an IOException as it used to be for a *tar trimmed on purpose* 
> @Test
>   public void testCorruptedBzip2() throws IOException {
>     String archivePath = PathUtil.join(testdataDir, "test.tar.bz2");
>     TarArchiveInputStream input = null;
>     input = new TarArchiveInputStream(new BZip2CompressorInputStream(
>         GoogleFile.SYSTEM.newInputStream(archivePath), true));
>     ArchiveEntry nextMatchedEntry = input.getNextEntry();
>     while (nextMatchedEntry != null) {
>       logger.infofmt("Extracting %s", nextMatchedEntry.getName());
>       String outputPath = PathUtil.join("/tmp/", nextMatchedEntry.getName());
>       OutputStream out = new FileOutputStream(outputPath);
>       ByteStreams.copy(input, out);
>       out.close();
>       nextMatchedEntry = input.getNextEntry();
>     }
>   }



--
This message was sent by Atlassian JIRA
(v6.2#6252)