Bug 49744 - new org.apache.tools.tar.TarEntry("/").isDirectory() returns false
Summary: new org.apache.tools.tar.TarEntry("/").isDirectory() returns false
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.8.2
Hardware: All All
: P2 regression (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2010-08-12 08:54 UTC by Christian Schlichtherle
Modified: 2010-12-27 11:12 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
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