git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270959 13f79535-47bb-0310-9956-ffa450edef68master
@@ -232,32 +232,33 @@ public class Tar | |||||
private void tarFile( final File file, | private void tarFile( final File file, | ||||
final TarOutputStream output, | final TarOutputStream output, | ||||
String path, | |||||
final String path, | |||||
final TarFileSet tarFileSet ) | final TarFileSet tarFileSet ) | ||||
throws IOException, TaskException | throws IOException, TaskException | ||||
{ | { | ||||
String storedPath = path; | |||||
// don't add "" to the archive | // don't add "" to the archive | ||||
if( path.length() <= 0 ) | |||||
if( storedPath.length() <= 0 ) | |||||
{ | { | ||||
return; | return; | ||||
} | } | ||||
if( file.isDirectory() && !path.endsWith( "/" ) ) | |||||
if( file.isDirectory() && !storedPath.endsWith( "/" ) ) | |||||
{ | { | ||||
path += "/"; | |||||
storedPath += "/"; | |||||
} | } | ||||
if( path.length() >= TarEntry.NAMELEN ) | |||||
if( storedPath.length() >= TarEntry.NAMELEN ) | |||||
{ | { | ||||
if( longFileMode.isOmitMode() ) | if( longFileMode.isOmitMode() ) | ||||
{ | { | ||||
final String message = "Omitting: " + path; | |||||
final String message = "Omitting: " + storedPath; | |||||
getLogger().info( message ); | getLogger().info( message ); | ||||
return; | return; | ||||
} | } | ||||
else if( longFileMode.isWarnMode() ) | else if( longFileMode.isWarnMode() ) | ||||
{ | { | ||||
final String message = "Entry: " + path + " longer than " + | |||||
final String message = "Entry: " + storedPath + " longer than " + | |||||
TarEntry.NAMELEN + " characters."; | TarEntry.NAMELEN + " characters."; | ||||
getLogger().warn( message ); | getLogger().warn( message ); | ||||
if( !longWarningGiven ) | if( !longWarningGiven ) | ||||
@@ -270,7 +271,7 @@ public class Tar | |||||
} | } | ||||
else if( longFileMode.isFailMode() ) | else if( longFileMode.isFailMode() ) | ||||
{ | { | ||||
final String message = "Entry: " + path + " longer than " + | |||||
final String message = "Entry: " + storedPath + " longer than " + | |||||
TarEntry.NAMELEN + "characters."; | TarEntry.NAMELEN + "characters."; | ||||
throw new TaskException( message ); | throw new TaskException( message ); | ||||
} | } | ||||
@@ -279,7 +280,7 @@ public class Tar | |||||
FileInputStream input = null; | FileInputStream input = null; | ||||
try | try | ||||
{ | { | ||||
final TarEntry entry = new TarEntry( path ); | |||||
final TarEntry entry = new TarEntry( storedPath ); | |||||
entry.setModTime( file.lastModified() ); | entry.setModTime( file.lastModified() ); | ||||
if( !file.isDirectory() ) | if( !file.isDirectory() ) | ||||
{ | { | ||||
@@ -232,32 +232,33 @@ public class Tar | |||||
private void tarFile( final File file, | private void tarFile( final File file, | ||||
final TarOutputStream output, | final TarOutputStream output, | ||||
String path, | |||||
final String path, | |||||
final TarFileSet tarFileSet ) | final TarFileSet tarFileSet ) | ||||
throws IOException, TaskException | throws IOException, TaskException | ||||
{ | { | ||||
String storedPath = path; | |||||
// don't add "" to the archive | // don't add "" to the archive | ||||
if( path.length() <= 0 ) | |||||
if( storedPath.length() <= 0 ) | |||||
{ | { | ||||
return; | return; | ||||
} | } | ||||
if( file.isDirectory() && !path.endsWith( "/" ) ) | |||||
if( file.isDirectory() && !storedPath.endsWith( "/" ) ) | |||||
{ | { | ||||
path += "/"; | |||||
storedPath += "/"; | |||||
} | } | ||||
if( path.length() >= TarEntry.NAMELEN ) | |||||
if( storedPath.length() >= TarEntry.NAMELEN ) | |||||
{ | { | ||||
if( longFileMode.isOmitMode() ) | if( longFileMode.isOmitMode() ) | ||||
{ | { | ||||
final String message = "Omitting: " + path; | |||||
final String message = "Omitting: " + storedPath; | |||||
getLogger().info( message ); | getLogger().info( message ); | ||||
return; | return; | ||||
} | } | ||||
else if( longFileMode.isWarnMode() ) | else if( longFileMode.isWarnMode() ) | ||||
{ | { | ||||
final String message = "Entry: " + path + " longer than " + | |||||
final String message = "Entry: " + storedPath + " longer than " + | |||||
TarEntry.NAMELEN + " characters."; | TarEntry.NAMELEN + " characters."; | ||||
getLogger().warn( message ); | getLogger().warn( message ); | ||||
if( !longWarningGiven ) | if( !longWarningGiven ) | ||||
@@ -270,7 +271,7 @@ public class Tar | |||||
} | } | ||||
else if( longFileMode.isFailMode() ) | else if( longFileMode.isFailMode() ) | ||||
{ | { | ||||
final String message = "Entry: " + path + " longer than " + | |||||
final String message = "Entry: " + storedPath + " longer than " + | |||||
TarEntry.NAMELEN + "characters."; | TarEntry.NAMELEN + "characters."; | ||||
throw new TaskException( message ); | throw new TaskException( message ); | ||||
} | } | ||||
@@ -279,7 +280,7 @@ public class Tar | |||||
FileInputStream input = null; | FileInputStream input = null; | ||||
try | try | ||||
{ | { | ||||
final TarEntry entry = new TarEntry( path ); | |||||
final TarEntry entry = new TarEntry( storedPath ); | |||||
entry.setModTime( file.lastModified() ); | entry.setModTime( file.lastModified() ); | ||||
if( !file.isDirectory() ) | if( !file.isDirectory() ) | ||||
{ | { | ||||