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 2017/03/14 17:34:42 UTC
[04/10] camel git commit: CAMEL-10791-added option to handle empty
directories while unzipping
CAMEL-10791-added option to handle empty directories while unzipping
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/741b0472
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/741b0472
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/741b0472
Branch: refs/heads/master
Commit: 741b0472f41c4cc32b40c9d1c540af21ce4efa14
Parents: 968fd2b
Author: onders86 <on...@gmail.com>
Authored: Mon Mar 13 11:03:35 2017 +0300
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 14 18:29:38 2017 +0100
----------------------------------------------------------------------
.../org/apache/camel/component/file/GenericFileProducer.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/741b0472/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java
index a4769ec..7e8cd61 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java
@@ -274,7 +274,11 @@ public class GenericFileProducer<T> extends DefaultProducer {
log.trace("About to write [{}] to [{}] from exchange [{}]", new Object[]{fileName, getEndpoint(), exchange});
}
- boolean success = operations.storeFile(fileName, exchange);
+ // if filename indicates the current directory and the directory is created
+ // but no need to store a file under the directory like touch <dir>
+ // this is added due to considering to handle empty directories in zipfile
+ boolean success = !fileName.substring(fileName.lastIndexOf(File.separator) + 1, fileName.length()).equals(".")
+ ? operations.storeFile(fileName, exchange) : true;
if (!success) {
throw new GenericFileOperationFailedException("Error writing file [" + fileName + "]");
}