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/07/09 12:08:10 UTC

[4/4] camel git commit: CAMEL-8768: hdfs2 component overwrite option is also being applied to directory filesystem path. Thanks to Hassan Faouaz for the patch.

CAMEL-8768: hdfs2 component overwrite option is also being applied to directory filesystem path. Thanks to Hassan Faouaz for the patch.


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

Branch: refs/heads/camel-2.15.x
Commit: f2330378362ddf729f69f23f3da440615ddd3736
Parents: 4d719eb
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jul 9 12:13:58 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jul 9 12:14:29 2015 +0200

----------------------------------------------------------------------
 .../apache/camel/component/hdfs/HdfsOutputStream.java    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f2330378/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsOutputStream.java
----------------------------------------------------------------------
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsOutputStream.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsOutputStream.java
index 8a7b336..a8f8db1 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsOutputStream.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsOutputStream.java
@@ -59,10 +59,13 @@ public class HdfsOutputStream implements Closeable {
             }
         } else {
             if (ret.info.getFileSystem().exists(new Path(ret.actualPath))) {
-                if (configuration.isOverwrite()) {
-                    ret.info.getFileSystem().delete(new Path(ret.actualPath), true);
-                } else {
-                    throw new RuntimeCamelException("The file already exists");
+                //only check if not directory
+                if (!ret.info.getFileSystem().isDirectory(new Path(ret.actualPath))) {
+                    if (configuration.isOverwrite()) {
+                        ret.info.getFileSystem().delete(new Path(ret.actualPath), true);
+                    } else {
+                        throw new RuntimeCamelException("The file already exists");
+                    }
                 }
             }
         }