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:08 UTC

[2/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/cb70b368
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cb70b368
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cb70b368

Branch: refs/heads/master
Commit: cb70b368775f3bf570a26c5d2d75704a8b3357c7
Parents: ef2e421
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:13:58 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/cb70b368/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");
+                    }
                 }
             }
         }