commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ozeigerm...@apache.org
Subject svn commit: r573315 - /commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/file/FileResourceManager.java
Date Thu, 06 Sep 2007 16:28:42 GMT
Author: ozeigermann
Date: Thu Sep  6 09:28:42 2007
New Revision: 573315

URL: http://svn.apache.org/viewvc?rev=573315&view=rev
Log:
Speed enhancement fix for deletes as described in https://issues.apache.org/jira/browse/TRANSACTION-26.
Thanks to Bojan Vukojevic.

Modified:
    commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/file/FileResourceManager.java

Modified: commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/file/FileResourceManager.java
URL: http://svn.apache.org/viewvc/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/file/FileResourceManager.java?rev=573315&r1=573314&r2=573315&view=diff
==============================================================================
--- commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/file/FileResourceManager.java
(original)
+++ commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/file/FileResourceManager.java
Thu Sep  6 09:28:42 2007
@@ -145,35 +145,33 @@
      *  
      */
 
-    protected static void applyDeletes(File removeDir, File targetDir, File rootDir) throws
IOException {
+    protected static void applyDeletes(File removeDir, File targetDir, File rootDir)
+            throws IOException {
         if (removeDir.isDirectory() && targetDir.isDirectory()) {
             File[] files = removeDir.listFiles();
             for (int i = 0; i < files.length; i++) {
                 File removeFile = files[i];
                 File targetFile = new File(targetDir, removeFile.getName());
-                if (!removeFile.isDirectory()) {
+                if (removeFile.isFile()) {
                     if (targetFile.exists()) {
                         if (!targetFile.delete()) {
                             throw new IOException("Could not delete file " + removeFile.getName()
                                     + " in directory targetDir");
                         }
-                    } else if (!targetFile.isFile()) {
-                        // this is likely a dangling link
-                        targetFile.delete();
-                    } 
+                    }
                     // indicate, this has been done
                     removeFile.delete();
                 } else {
                     applyDeletes(removeFile, targetFile, rootDir);
                 }
-                // delete empty target directories, except root dir
-                if (!targetDir.equals(rootDir) && targetDir.list().length == 0) {
-                    targetDir.delete();
-                }
+            }
+            // delete empty target directories, except root dir
+            if (!targetDir.equals(rootDir) && targetDir.list().length == 0) {
+                targetDir.delete();
             }
         }
     }
-
+    
     /*
      * --- object members ---
      * 



Mime
View raw message