Bug 49744

Summary: new org.apache.tools.tar.TarEntry("/").isDirectory() returns false
Product: Ant Reporter: Christian Schlichtherle <christian>
Component: CoreAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: regression    
Priority: P2    
Version: 1.8.2   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Christian Schlichtherle 2010-08-12 08:54:15 UTC
This is a regression since Ant 1.7.1.

In Ant 1.8.1, the constructor public TarEntry(String name) and others call the method normalizeFileName in order to (you guessed it) normalize the file name. However, this method normalizes "/" into "". As a consequence, the method isDirectory() returns false for this entry.

Rationale: A TarEntry with the name "/" is created by TrueZIP 6.7 (https://truezip.dev.java.net) as a virtual root directory. This TarEntry is actually never written to the TAR file, but solely used in order to associate meta data with the TAR file itself. Later on, the last modification time of this virtual root directory is used to post-fix the last modification time of the TAR file itself.

Work-around: Call the newly introduced constructor public TarEntry(String name, boolean preserveLeadingSlashes) with true as its boolean parameter.
Comment 1 Christian Schlichtherle 2010-08-12 09:21:30 UTC
This issue has also been filed to TrueZIP's Issue Tracker: https://truezip.dev.java.net/issues/show_bug.cgi?id=36