git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270244 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -275,7 +275,7 @@ public class Available | |||||
| } | } | ||||
| FileUtils fileUtils = FileUtils.newFileUtils(); | FileUtils fileUtils = FileUtils.newFileUtils(); | ||||
| File parent = fileUtils.getParentFile( path ); | |||||
| File parent = path.getParentFile(); | |||||
| // ** full-pathname specified == parent dir of path in list | // ** full-pathname specified == parent dir of path in list | ||||
| if( parent != null && parent.exists() | if( parent != null && parent.exists() | ||||
| && file.equals( parent.getAbsolutePath() ) ) | && file.equals( parent.getAbsolutePath() ) ) | ||||
| @@ -317,7 +317,7 @@ public class Available | |||||
| // ** simple name specified == parent of parent dir + name | // ** simple name specified == parent of parent dir + name | ||||
| if( parent != null ) | if( parent != null ) | ||||
| { | { | ||||
| File grandParent = fileUtils.getParentFile( parent ); | |||||
| File grandParent = parent.getParentFile(); | |||||
| if( grandParent != null && grandParent.exists() ) | if( grandParent != null && grandParent.exists() ) | ||||
| { | { | ||||
| if( checkFile( new File( grandParent, file ), | if( checkFile( new File( grandParent, file ), | ||||
| @@ -251,7 +251,7 @@ public class Expand extends MatchingTask | |||||
| log( "expanding " + entryName + " to " + f, | log( "expanding " + entryName + " to " + f, | ||||
| Project.MSG_VERBOSE ); | Project.MSG_VERBOSE ); | ||||
| // create intermediary directories - sometimes zip don't add them | // create intermediary directories - sometimes zip don't add them | ||||
| File dirF = fileUtils.getParentFile( f ); | |||||
| File dirF = f.getParentFile(); | |||||
| dirF.mkdirs(); | dirF.mkdirs(); | ||||
| if( isDirectory ) | if( isDirectory ) | ||||
| @@ -296,7 +296,7 @@ public class Replace extends MatchingTask | |||||
| } | } | ||||
| File temp = fileUtils.createTempFile( "rep", ".tmp", | File temp = fileUtils.createTempFile( "rep", ".tmp", | ||||
| fileUtils.getParentFile( src ) ); | |||||
| src.getParentFile() ); | |||||
| Reader reader = null; | Reader reader = null; | ||||
| Writer writer = null; | Writer writer = null; | ||||
| @@ -237,7 +237,7 @@ public class Zip extends MatchingTask | |||||
| { | { | ||||
| FileUtils fileUtils = FileUtils.newFileUtils(); | FileUtils fileUtils = FileUtils.newFileUtils(); | ||||
| renamedFile = fileUtils.createTempFile( "zip", ".tmp", | renamedFile = fileUtils.createTempFile( "zip", ".tmp", | ||||
| fileUtils.getParentFile( zipFile ) ); | |||||
| zipFile.getParentFile() ); | |||||
| try | try | ||||
| { | { | ||||
| @@ -38,7 +38,6 @@ import org.apache.tools.ant.types.FilterSetCollection; | |||||
| public class FileUtils | public class FileUtils | ||||
| { | { | ||||
| private static Random rand = new Random( System.currentTimeMillis() ); | private static Random rand = new Random( System.currentTimeMillis() ); | ||||
| private static Object lockReflection = new Object(); | |||||
| /** | /** | ||||
| * Empty constructor. | * Empty constructor. | ||||
| @@ -57,26 +56,6 @@ public class FileUtils | |||||
| return new FileUtils(); | return new FileUtils(); | ||||
| } | } | ||||
| /** | |||||
| * Emulation of File.getParentFile for JDK 1.1 | |||||
| * | |||||
| * @param f Description of Parameter | |||||
| * @return The ParentFile value | |||||
| * @since 1.10 | |||||
| */ | |||||
| public File getParentFile( File f ) | |||||
| { | |||||
| if( f != null ) | |||||
| { | |||||
| String p = f.getParent(); | |||||
| if( p != null ) | |||||
| { | |||||
| return new File( p ); | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| /** | /** | ||||
| * Compares the contents of two files. | * Compares the contents of two files. | ||||
| * | * | ||||
| @@ -300,7 +279,7 @@ public class FileUtils | |||||
| // ensure that parent dir of dest file exists! | // ensure that parent dir of dest file exists! | ||||
| // not using getParentFile method to stay 1.1 compat | // not using getParentFile method to stay 1.1 compat | ||||
| File parent = getParentFile( destFile ); | |||||
| File parent = destFile.getParentFile(); | |||||
| if( !parent.exists() ) | if( !parent.exists() ) | ||||
| { | { | ||||
| parent.mkdirs(); | parent.mkdirs(); | ||||
| @@ -577,7 +556,7 @@ public class FileUtils | |||||
| String part = tok.nextToken(); | String part = tok.nextToken(); | ||||
| if( part.equals( ".." ) ) | if( part.equals( ".." ) ) | ||||
| { | { | ||||
| helpFile = getParentFile( helpFile ); | |||||
| helpFile = helpFile.getParentFile(); | |||||
| if( helpFile == null ) | if( helpFile == null ) | ||||
| { | { | ||||
| String msg = "The file or path you specified (" | String msg = "The file or path you specified (" | ||||
| @@ -275,7 +275,7 @@ public class Available | |||||
| } | } | ||||
| FileUtils fileUtils = FileUtils.newFileUtils(); | FileUtils fileUtils = FileUtils.newFileUtils(); | ||||
| File parent = fileUtils.getParentFile( path ); | |||||
| File parent = path.getParentFile(); | |||||
| // ** full-pathname specified == parent dir of path in list | // ** full-pathname specified == parent dir of path in list | ||||
| if( parent != null && parent.exists() | if( parent != null && parent.exists() | ||||
| && file.equals( parent.getAbsolutePath() ) ) | && file.equals( parent.getAbsolutePath() ) ) | ||||
| @@ -317,7 +317,7 @@ public class Available | |||||
| // ** simple name specified == parent of parent dir + name | // ** simple name specified == parent of parent dir + name | ||||
| if( parent != null ) | if( parent != null ) | ||||
| { | { | ||||
| File grandParent = fileUtils.getParentFile( parent ); | |||||
| File grandParent = parent.getParentFile(); | |||||
| if( grandParent != null && grandParent.exists() ) | if( grandParent != null && grandParent.exists() ) | ||||
| { | { | ||||
| if( checkFile( new File( grandParent, file ), | if( checkFile( new File( grandParent, file ), | ||||
| @@ -251,7 +251,7 @@ public class Expand extends MatchingTask | |||||
| log( "expanding " + entryName + " to " + f, | log( "expanding " + entryName + " to " + f, | ||||
| Project.MSG_VERBOSE ); | Project.MSG_VERBOSE ); | ||||
| // create intermediary directories - sometimes zip don't add them | // create intermediary directories - sometimes zip don't add them | ||||
| File dirF = fileUtils.getParentFile( f ); | |||||
| File dirF = f.getParentFile(); | |||||
| dirF.mkdirs(); | dirF.mkdirs(); | ||||
| if( isDirectory ) | if( isDirectory ) | ||||
| @@ -296,7 +296,7 @@ public class Replace extends MatchingTask | |||||
| } | } | ||||
| File temp = fileUtils.createTempFile( "rep", ".tmp", | File temp = fileUtils.createTempFile( "rep", ".tmp", | ||||
| fileUtils.getParentFile( src ) ); | |||||
| src.getParentFile() ); | |||||
| Reader reader = null; | Reader reader = null; | ||||
| Writer writer = null; | Writer writer = null; | ||||
| @@ -237,7 +237,7 @@ public class Zip extends MatchingTask | |||||
| { | { | ||||
| FileUtils fileUtils = FileUtils.newFileUtils(); | FileUtils fileUtils = FileUtils.newFileUtils(); | ||||
| renamedFile = fileUtils.createTempFile( "zip", ".tmp", | renamedFile = fileUtils.createTempFile( "zip", ".tmp", | ||||
| fileUtils.getParentFile( zipFile ) ); | |||||
| zipFile.getParentFile() ); | |||||
| try | try | ||||
| { | { | ||||
| @@ -38,7 +38,6 @@ import org.apache.tools.ant.types.FilterSetCollection; | |||||
| public class FileUtils | public class FileUtils | ||||
| { | { | ||||
| private static Random rand = new Random( System.currentTimeMillis() ); | private static Random rand = new Random( System.currentTimeMillis() ); | ||||
| private static Object lockReflection = new Object(); | |||||
| /** | /** | ||||
| * Empty constructor. | * Empty constructor. | ||||
| @@ -57,26 +56,6 @@ public class FileUtils | |||||
| return new FileUtils(); | return new FileUtils(); | ||||
| } | } | ||||
| /** | |||||
| * Emulation of File.getParentFile for JDK 1.1 | |||||
| * | |||||
| * @param f Description of Parameter | |||||
| * @return The ParentFile value | |||||
| * @since 1.10 | |||||
| */ | |||||
| public File getParentFile( File f ) | |||||
| { | |||||
| if( f != null ) | |||||
| { | |||||
| String p = f.getParent(); | |||||
| if( p != null ) | |||||
| { | |||||
| return new File( p ); | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| /** | /** | ||||
| * Compares the contents of two files. | * Compares the contents of two files. | ||||
| * | * | ||||
| @@ -300,7 +279,7 @@ public class FileUtils | |||||
| // ensure that parent dir of dest file exists! | // ensure that parent dir of dest file exists! | ||||
| // not using getParentFile method to stay 1.1 compat | // not using getParentFile method to stay 1.1 compat | ||||
| File parent = getParentFile( destFile ); | |||||
| File parent = destFile.getParentFile(); | |||||
| if( !parent.exists() ) | if( !parent.exists() ) | ||||
| { | { | ||||
| parent.mkdirs(); | parent.mkdirs(); | ||||
| @@ -577,7 +556,7 @@ public class FileUtils | |||||
| String part = tok.nextToken(); | String part = tok.nextToken(); | ||||
| if( part.equals( ".." ) ) | if( part.equals( ".." ) ) | ||||
| { | { | ||||
| helpFile = getParentFile( helpFile ); | |||||
| helpFile = helpFile.getParentFile(); | |||||
| if( helpFile == null ) | if( helpFile == null ) | ||||
| { | { | ||||
| String msg = "The file or path you specified (" | String msg = "The file or path you specified (" | ||||