You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stefan Bodewig (JIRA)" <ji...@apache.org> on 2016/10/07 15:57:20 UTC
[jira] [Resolved] (COMPRESS-366) TarArchiveEntry:
getDirectoryEntries not working
[ https://issues.apache.org/jira/browse/COMPRESS-366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stefan Bodewig resolved COMPRESS-366.
-------------------------------------
Resolution: Fixed
fixed with git commit f010260
> TarArchiveEntry: getDirectoryEntries not working
> ------------------------------------------------
>
> Key: COMPRESS-366
> URL: https://issues.apache.org/jira/browse/COMPRESS-366
> Project: Commons Compress
> Issue Type: Bug
> Components: Archivers
> Affects Versions: 1.12
> Environment: Eclipse 4.6, Linux 64 Bit
> Reporter: Casi Colada
> Priority: Minor
> Fix For: 1.13
>
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> TarArchiveEntry.getDirectoryEntries() always returns an empty array. This is because entry.getFile() returns null for a directory entry.
> Let folder.tar be a Tar Archive which contains a folder, and that folder contains a file. Consider the following snippet:
> ----
> import java.io.FileInputStream;
> import org.apache.commons.compress.archivers.tar.*;
> public class GetDirectoryEntriesBug {
> public static void main(String[] args) throws Exception {
> TarArchiveInputStream tais = new TarArchiveInputStream(new FileInputStream("folder.tar"));
> for(TarArchiveEntry entry; (entry = tais.getNextTarEntry()) != null; ) {
> System.out.println("Name: " + entry.getName() + ", isDirectory: " + entry.isDirectory() + ", getDirectoryEntries().length: " + entry.getDirectoryEntries().length);
> }
> tais.close();
> }
> }
> ----
> Output:
> Name: folder/file, isDirectory: false, getDirectoryEntries().length: 0
> Name: folder/, isDirectory: true, getDirectoryEntries().length: 0
> I expected that, for "folder/", getDirectoryEntries() will not return an empty array.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)