[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    [jira] [Created] (COMPRESS-310) "No Archiver found for the stream signature" for empty .tar.gz
From:       "Nikolai Amelichev (JIRA)" <jira () apache ! org>
Date:       2015-02-28 1:56:04
Message-ID: JIRA.12778421.1425088549000.40050.1425088564957 () Atlassian ! JIRA
[Download RAW message or body]

Nikolai Amelichev created COMPRESS-310:
------------------------------------------

             Summary: "No Archiver found for the stream signature" for empty .tar.gz
                 Key: COMPRESS-310
                 URL: https://issues.apache.org/jira/browse/COMPRESS-310
             Project: Commons Compress
          Issue Type: Bug
          Components: Archivers
    Affects Versions: 1.9
         Environment: Ubuntu 14.04.1 LTS, x64, Oracle JDK 1.8.0_25
            Reporter: Nikolai Amelichev


GNU tar can unpack empty gzipped tar archive *uzhos.tar.gz* without any problems. \
commons-compress detects gzip compression, but not tar archive format of the \
uncompressed data.

The archive was created by running GNU tar in an empty directory like this: \
{noformat}tar xzf uzhos.tar.gz .{noformat} and then manually deleting the *'.'* \
directory entry in *file-roller* archive manager.

Minimal test demonstrating the problem:
{code:java}
package ru.zombator;

import java.io.*;
import org.apache.commons.compress.archivers.*;
import org.apache.commons.compress.compressors.*;
import org.junit.Test;
import org.junit.Assert;

public class UzhosTest {
  @Test
  public void unpack_empty_gzipped_tar() throws IOException, ArchiveException, \
CompressorException {  try (FileInputStream in = new FileInputStream("uzhos.tar.gz");
         BufferedInputStream bis = new BufferedInputStream(in);
         InputStream comp = new \
CompressorStreamFactory().createCompressorInputStream(bis);  BufferedInputStream \
                compBis = new BufferedInputStream(comp);
         ArchiveInputStream arch = new \
ArchiveStreamFactory().createArchiveInputStream(compBis)) {  \
Assert.assertNull(arch.getNextEntry());  }
  }
}
{code}

Stacktrace:
{code:java}
org.apache.commons.compress.archivers.ArchiveException: No Archiver found for the \
stream signature  at \
org.apache.commons.compress.archivers.ArchiveStreamFactory.createArchiveInputStream(ArchiveStreamFactory.java:359)
  at ru.zombator.UzhosTest.unpack_empty_gzipped_tar(ShittyTest.java:16)
	<23 internal calls>
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic