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 2015/04/21 14:42:10 UTC
[2/4] camel git commit: CAMEL-6069: A bit better check before and
after
CAMEL-6069: A bit better check before and after
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/682a057a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/682a057a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/682a057a
Branch: refs/heads/camel-2.15.x
Commit: 682a057a0fa580e06de3ddd85635e0aa88dcb142
Parents: 499a697
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Apr 21 14:34:56 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Apr 21 14:44:42 2015 +0200
----------------------------------------------------------------------
camel-core/src/main/java/org/apache/camel/util/FileUtil.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/682a057a/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 8500d9a..3f978ed 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
@@ -583,9 +583,15 @@ public final class FileUtil {
* @throws IOException is thrown if error creating the new file
*/
public static boolean createNewFile(File file) throws IOException {
+ // need to check first
+ if (file.exists()) {
+ return false;
+ }
try {
return file.createNewFile();
} catch (IOException e) {
+ // and check again if the file was created as createNewFile may create the file
+ // but throw a permission error afterwards when using some NAS
if (file.exists()) {
return true;
} else {