You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/06/17 20:41:12 UTC

[1/2] git commit: CAMEL-7518: FileUtil.renameFile - should return true if file was renamed using copy/delete approach. Thanks to David R. Hoffman for reporting, and providing the solution.

Repository: camel
Updated Branches:
  refs/heads/camel-2.13.x 516fe25ad -> 4f7b3c8c4
  refs/heads/master 79729b10f -> 1b0337e6e


CAMEL-7518: FileUtil.renameFile - should return true if file was renamed using copy/delete approach. Thanks to David R. Hoffman for reporting, and providing the solution.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1b0337e6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1b0337e6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1b0337e6

Branch: refs/heads/master
Commit: 1b0337e6e8d0fdc62f9516421ac202b06f3b78ce
Parents: 79729b1
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jun 17 20:39:04 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jun 17 20:39:04 2014 +0200

----------------------------------------------------------------------
 camel-core/src/main/java/org/apache/camel/util/FileUtil.java | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1b0337e6/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/FileUtil.java b/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
index 6376c44..128c600 100644
--- a/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
+++ b/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
@@ -425,7 +425,7 @@ public final class FileUtil {
         if (!renamed && copyAndDeleteOnRenameFail) {
             // now do a copy and delete as all rename attempts failed
             LOG.debug("Cannot rename file from: {} to: {}, will now use a copy/delete approach instead", from, to);
-            renameFileUsingCopy(from, to);
+            renamed = renameFileUsingCopy(from, to);
         }
 
         if (LOG.isDebugEnabled() && count > 0) {
@@ -449,18 +449,14 @@ public final class FileUtil {
             return false;
         }
 
-        boolean renamed = false;
-
         LOG.debug("Rename file '{}' to '{}' using copy/delete strategy.", from, to);
 
         copyFile(from, to);
         if (!deleteFile(from)) {
             throw new IOException("Renaming file from '" + from + "' to '" + to + "' failed: Cannot delete file '" + from + "' after copy succeeded");
-        } else {
-            renamed = true;
         }
 
-        return renamed;
+        return true;
     }
 
     public static void copyFile(File from, File to) throws IOException {


[2/2] git commit: CAMEL-7518: FileUtil.renameFile - should return true if file was renamed using copy/delete approach. Thanks to David R. Hoffman for reporting, and providing the solution.

Posted by da...@apache.org.
CAMEL-7518: FileUtil.renameFile - should return true if file was renamed using copy/delete approach. Thanks to David R. Hoffman for reporting, and providing the solution.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4f7b3c8c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4f7b3c8c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4f7b3c8c

Branch: refs/heads/camel-2.13.x
Commit: 4f7b3c8c465c329adac7e625e49012ed3016a500
Parents: 516fe25
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jun 17 20:39:04 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jun 17 20:39:40 2014 +0200

----------------------------------------------------------------------
 camel-core/src/main/java/org/apache/camel/util/FileUtil.java | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4f7b3c8c/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/FileUtil.java b/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
index 6376c44..128c600 100644
--- a/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
+++ b/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
@@ -425,7 +425,7 @@ public final class FileUtil {
         if (!renamed && copyAndDeleteOnRenameFail) {
             // now do a copy and delete as all rename attempts failed
             LOG.debug("Cannot rename file from: {} to: {}, will now use a copy/delete approach instead", from, to);
-            renameFileUsingCopy(from, to);
+            renamed = renameFileUsingCopy(from, to);
         }
 
         if (LOG.isDebugEnabled() && count > 0) {
@@ -449,18 +449,14 @@ public final class FileUtil {
             return false;
         }
 
-        boolean renamed = false;
-
         LOG.debug("Rename file '{}' to '{}' using copy/delete strategy.", from, to);
 
         copyFile(from, to);
         if (!deleteFile(from)) {
             throw new IOException("Renaming file from '" + from + "' to '" + to + "' failed: Cannot delete file '" + from + "' after copy succeeded");
-        } else {
-            renamed = true;
         }
 
-        return renamed;
+        return true;
     }
 
     public static void copyFile(File from, File to) throws IOException {