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

Gary D. Gregory resolved COMPRESS-699.
--------------------------------------
    Fix Version/s: 1.28.0
       Resolution: Fixed

This is fixed in git master and in the Maven snapshot repository at 
[https://repository.apache.org/content/repositories/snapshots/]

Please verify and close this ticket if your use case works.

TY

> ArchiveStreamFactory.detect(inputStream) ArchiveException for TAR regression
> ----------------------------------------------------------------------------
>
>                 Key: COMPRESS-699
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-699
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.26.1, 1.26.2, 1.27.0, 1.27.1
>            Reporter: Michael Nguyen
>            Assignee: Gary D. Gregory
>            Priority: Major
>             Fix For: 1.28.0
>
>         Attachments: icure_medical_device_dart_sdk-1.2.10.tar
>
>
> Prior to version 1.26.1, calling ArchiveStreamFactory.detect on the attached 
> TAR file identifies it as a TAR file properly but now throws an 
> ArchiveException. It seems related to the changes to address COMPRESS-644, 
> specifically the the entry.getSize() > 0 check on line 288 of 
> ArchiveStreamFactory.java.
> Below is some sample code to reproduce the error (the below code runs without 
> errors when tested on 1.26.0):
> {code:java}
> import org.apache.commons.compress.archivers.ArchiveStreamFactory;
> import org.apache.commons.io.FileUtils;
> import org.junit.Test;
> import java.io.BufferedInputStream;
> import java.io.File;
> import java.nio.file.Files;
> import static 
> com.sonatype.data.testing.utils.ResourcesUtils.getResourceAsInputStream;
> public class TarArchiveTest
> {
>   @Test
>   public void testTarArchive() throws Exception {
>     String fileToTest = "icure_medical_device_dart_sdk-1.2.10.tar";
>     File sourceFile = new File(fileToTest);
>     FileUtils.copyInputStreamToFile(getResourceAsInputStream(fileToTest), 
> sourceFile);
>     BufferedInputStream fileInputStream = new 
> BufferedInputStream(Files.newInputStream(sourceFile.toPath()));
>     System.out.println("Detected archive type: " + 
> ArchiveStreamFactory.detect(fileInputStream));
>   }
> } {code}



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

Reply via email to