ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r552156 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Move.java
Date Sat, 30 Jun 2007 15:05:15 GMT
Author: mbenson
Date: Sat Jun 30 08:05:14 2007
New Revision: 552156

URL: http://svn.apache.org/viewvc?view=rev&rev=552156
Log:
refactor

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Move.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Move.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Move.java?view=diff&rev=552156&r1=552155&r2=552156
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Move.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Move.java Sat Jun 30 08:05:14 2007
@@ -20,6 +20,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.Iterator;
+
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
@@ -324,20 +325,18 @@
      */
     protected boolean renameFile(File sourceFile, File destFile, boolean filtering,
                                  boolean overwrite) throws IOException, BuildException {
-        boolean renamed = false;
-        if ((getFilterSets().size() + getFilterChains().size() == 0)
-                && !(filtering || destFile.isDirectory())) {
-            // ensure that parent dir of dest file exists!
-            File parent = destFile.getParentFile();
-            if (parent != null && !parent.exists()) {
-                parent.mkdirs();
-            }
-            if (destFile.isFile() && !getFileUtils().fileNameEquals(sourceFile, destFile)
-                    && !destFile.delete()) {
-                throw new BuildException("Unable to remove existing " + "file " + destFile);
-            }
-            renamed = sourceFile.renameTo(destFile);
+        if (destFile.isDirectory() || filtering || getFilterSets().size() > 0
+                || getFilterChains().size() > 0) {
+            return false;
+        }
+        // ensure that parent dir of dest file exists!
+        File parent = destFile.getParentFile();
+        if (parent != null && !parent.exists()) {
+            parent.mkdirs();
+        } else if (destFile.isFile() && !getFileUtils().fileNameEquals(sourceFile,
destFile)
+                && !destFile.delete()) {
+            throw new BuildException("Unable to remove existing file " + destFile);
         }
-        return renamed;
+        return sourceFile.renameTo(destFile);
     }
 }



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


Mime
View raw message