I am using commons-compress to process tarball files and noticed that even files which are not tar seem to be processed. Why is this -- is there a better library to detect valid tar files
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.20</version>
</dependency>
bug689.csv is a CSV file, the test fails because apparently te.isFile() returns true. te.getName() seems to return the contents of the CSV. Is this a bug of am I using the package incorrectly -- I'd expect the InputStream to not be successfully converted to TarArchiveEntry
@Test
public void testTarball() throws IOException{
InputStream tarData = this.getClass().getResourceAsStream("/bug689.csv");
TarArchiveInputStream tis = new TarArchiveInputStream(tarData);
TarArchiveEntry te = tis.getNextTarEntry();
assertFalse(te.isFile());
}
tis.getNextTarEntry()returnsnull. If I run it on a tar file (which happens to have a csv file suffix), and which contains a regular csv file, thente.isFile()returnstrue. All as I would expect. Are you absolutely surebug689.csvis an uncompressed file (forgive me for asking)? - andrewjames