You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by jk...@apache.org on 2004/12/11 23:43:05 UTC

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

jkf         2004/12/11 14:43:05

  Modified:    src/main/org/apache/tools/ant/util FileUtils.java
               src/main/org/apache/tools/ant/taskdefs Zip.java FixCRLF.java
                        Copy.java Expand.java Move.java Available.java
                        XSLTProcess.java Concat.java
               src/testcases/org/apache/tools/ant/taskdefs
                        XmlPropertyTest.java
               src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  If we can use File.getParentFile, there is presumably no reason to use FileUtils.getParentFile, right?
  (Comment re-used from jglick)
  
  Revision  Changes    Path
  1.77      +4 -4      ant/src/main/org/apache/tools/ant/util/FileUtils.java
  
  Index: FileUtils.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- FileUtils.java	10 Dec 2004 23:18:22 -0000	1.76
  +++ FileUtils.java	11 Dec 2004 22:43:04 -0000	1.77
  @@ -507,7 +507,7 @@
   
               // ensure that parent dir of dest file exists!
               // not using getParentFile method to stay 1.1 compat
  -            File parent = getParentFile(destFile);
  +            File parent = destFile.getParentFile();
               if (parent != null && !parent.exists()) {
                   parent.mkdirs();
               }
  @@ -709,7 +709,7 @@
           while (tok.hasMoreTokens()) {
               String part = tok.nextToken();
               if (part.equals("..")) {
  -                helpFile = getParentFile(helpFile);
  +                helpFile = helpFile.getParentFile();
                   if (helpFile == null) {
                       String msg = "The file or path you specified ("
                           + filename + ") is invalid relative to "
  @@ -1260,7 +1260,7 @@
               throw new IOException("Failed to delete " + to
                                     + " while trying to rename " + from);
           }
  -        File parent = getParentFile(to);
  +        File parent = to.getParentFile();
           if (parent != null && !parent.exists() && !parent.mkdirs()) {
               throw new IOException("Failed to create directory " + parent
                                     + " while trying to rename " + from);
  
  
  
  1.130     +1 -1      ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.129
  retrieving revision 1.130
  diff -u -r1.129 -r1.130
  --- Zip.java	22 Nov 2004 09:23:28 -0000	1.129
  +++ Zip.java	11 Dec 2004 22:43:05 -0000	1.130
  @@ -407,7 +407,7 @@
               if (doUpdate) {
                   renamedFile =
                       fileUtils.createTempFile("zip", ".tmp",
  -                                             fileUtils.getParentFile(zipFile));
  +                                             zipFile.getParentFile());
                   renamedFile.deleteOnExit();
   
                   try {
  
  
  
  1.62      +2 -1      ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  
  Index: FixCRLF.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- FixCRLF.java	12 Nov 2004 15:14:59 -0000	1.61
  +++ FixCRLF.java	11 Dec 2004 22:43:05 -0000	1.62
  @@ -1000,3 +1000,4 @@
       }
   
   }
  +
  
  
  
  1.77      +2 -2      ant/src/main/org/apache/tools/ant/taskdefs/Copy.java
  
  Index: Copy.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Copy.java,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- Copy.java	6 Dec 2004 19:27:13 -0000	1.76
  +++ Copy.java	11 Dec 2004 22:43:05 -0000	1.77
  @@ -509,7 +509,7 @@
           }
   
           if (destFile != null) {
  -            destDir = fileUtils.getParentFile(destFile);
  +            destDir = destFile.getParentFile();
           }
   
       }
  
  
  
  1.57      +1 -1      ant/src/main/org/apache/tools/ant/taskdefs/Expand.java
  
  Index: Expand.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Expand.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- Expand.java	6 Dec 2004 19:27:13 -0000	1.56
  +++ Expand.java	11 Dec 2004 22:43:05 -0000	1.57
  @@ -241,7 +241,7 @@
               log("expanding " + entryName + " to " + f,
                   Project.MSG_VERBOSE);
               // create intermediary directories - sometimes zip don't add them
  -            File dirF = fileUtils.getParentFile(f);
  +            File dirF = f.getParentFile();
               if (dirF != null) {
                   dirF.mkdirs();
               }
  
  
  
  1.49      +2 -2      ant/src/main/org/apache/tools/ant/taskdefs/Move.java
  
  Index: Move.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Move.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- Move.java	22 Nov 2004 09:23:28 -0000	1.48
  +++ Move.java	11 Dec 2004 22:43:05 -0000	1.49
  @@ -74,7 +74,7 @@
               destFile = (destFile == null)
                   ? new File(destDir, file.getName()) : destFile;
               destDir = (destDir == null)
  -                ? fileUtils.getParentFile(destFile) : destDir;
  +                ? destFile.getParentFile() : destDir;
   
               completeDirMap.put(file, destFile);
               file = null;
  
  
  
  1.62      +2 -3      ant/src/main/org/apache/tools/ant/taskdefs/Available.java
  
  Index: Available.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Available.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- Available.java	9 Mar 2004 16:48:04 -0000	1.61
  +++ Available.java	11 Dec 2004 22:43:05 -0000	1.62
  @@ -330,8 +330,7 @@
                       return false;
                   }
   
  -                FileUtils fileUtils = FileUtils.newFileUtils();
  -                File parent = fileUtils.getParentFile(path);
  +                File parent = path.getParentFile();
                   // **   full-pathname specified == parent dir of path in list
                   if (parent != null && parent.exists()
                       && file.equals(parent.getAbsolutePath())) {
  @@ -364,7 +363,7 @@
   
                   // **   simple name specified   == parent of parent dir + name
                   if (parent != null) {
  -                    File grandParent = fileUtils.getParentFile(parent);
  +                    File grandParent = parent.getParentFile();
                       if (grandParent != null && grandParent.exists()) {
                           if (checkFile(new File(grandParent, file),
                                         file + " in " + grandParent)) {
  
  
  
  1.89      +2 -2      ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  
  Index: XSLTProcess.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- XSLTProcess.java	22 Nov 2004 09:23:28 -0000	1.88
  +++ XSLTProcess.java	11 Dec 2004 22:43:05 -0000	1.89
  @@ -562,7 +562,7 @@
        */
       private void ensureDirectoryFor(File targetFile)
            throws BuildException {
  -        File directory = fileUtils.getParentFile(targetFile);
  +        File directory = targetFile.getParentFile();
           if (!directory.exists()) {
               if (!directory.mkdirs()) {
                   throw new BuildException("Unable to create directory: "
  
  
  
  1.39      +1 -1      ant/src/main/org/apache/tools/ant/taskdefs/Concat.java
  
  Index: Concat.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Concat.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- Concat.java	12 Nov 2004 10:30:48 -0000	1.38
  +++ Concat.java	11 Dec 2004 22:43:05 -0000	1.39
  @@ -561,7 +561,7 @@
                       os = new LogOutputStream(this, Project.MSG_WARN);
                   } else {
                       // ensure that the parent dir of dest file exists
  -                    File parent = fileUtils.getParentFile(destinationFile);
  +                    File parent = destinationFile.getParentFile();
                       if (!parent.exists()) {
                           parent.mkdirs();
                       }
  
  
  
  1.15      +2 -2      ant/src/testcases/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
  
  Index: XmlPropertyTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/XmlPropertyTest.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- XmlPropertyTest.java	7 Dec 2004 09:10:38 -0000	1.14
  +++ XmlPropertyTest.java	11 Dec 2004 22:43:05 -0000	1.15
  @@ -123,7 +123,7 @@
               // folder of the input file.  Otherwise, its the "current" dir..
               File workingDir;
               if ( localRoot ) {
  -                workingDir = fileUtils.getParentFile(inputFile);
  +                workingDir = inputFile.getParentFile();
               } else {
                   workingDir = fileUtils.resolveFile(new File("."), ".");
               }
  @@ -285,7 +285,7 @@
                   + ".properties";
           }
   
  -        File dir = fileUtils.getParentFile(fileUtils.getParentFile(input));
  +        File dir = input.getParentFile().getParentFile();
   
           String goldFileFolder = "goldfiles/";
   
  
  
  
  1.62      +2 -2      ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- FTP.java	23 Aug 2004 20:27:37 -0000	1.61
  +++ FTP.java	11 Dec 2004 22:43:05 -0000	1.62
  @@ -1310,7 +1310,7 @@
   
           try {
               if (action == LIST_FILES) {
  -                File pd = fileUtils.getParentFile(listing);
  +                File pd = listing.getParentFile();
   
                   if (!pd.exists()) {
                       pd.mkdirs();
  @@ -1782,7 +1782,7 @@
                        + file.getAbsolutePath());
               }
   
  -            File pdir = fileUtils.getParentFile(file);
  +            File pdir = file.getParentFile();
   
               if (!pdir.exists()) {
                   pdir.mkdirs();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org