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 2019/02/28 07:36:23 UTC

[camel] branch master updated: CAMEL-13272: File producer - Issue with toD when using moveExisting

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new d202ee2  CAMEL-13272: File producer - Issue with toD when using moveExisting
d202ee2 is described below

commit d202ee2e03541bdf1e9ae1f3be3b8fd665fd57df
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Feb 28 08:21:37 2019 +0100

    CAMEL-13272: File producer - Issue with toD when using moveExisting
---
 .../file/GenericFileSendDynamicAware.java          | 23 +++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileSendDynamicAware.java b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileSendDynamicAware.java
index 2d54745..b3d5d3e 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileSendDynamicAware.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileSendDynamicAware.java
@@ -49,16 +49,37 @@ public abstract class GenericFileSendDynamicAware implements SendDynamicAware {
 
     @Override
     public String resolveStaticUri(Exchange exchange, DynamicAwareEntry entry) throws Exception {
+        boolean fileName = entry.getProperties().containsKey("fileName");
+        boolean tempFileName = entry.getProperties().containsKey("tempFileName");
+        boolean idempotentKey = entry.getProperties().containsKey("idempotentKey");
         boolean move = entry.getProperties().containsKey("move");
         boolean moveFailed = entry.getProperties().containsKey("moveFailed");
         boolean preMove = entry.getProperties().containsKey("preMove");
         boolean moveExisting = entry.getProperties().containsKey("moveExisting");
         // if any of the above are in use, then they should not be pre evaluated
         // and we need to rebuild a new uri with them as-is
-        if (move || moveFailed || preMove || moveExisting) {
+        if (fileName || tempFileName || idempotentKey || move || moveFailed || preMove || moveExisting) {
             Map<String, String> params = new LinkedHashMap<>(entry.getProperties());
 
             Map<String, Object> originalParams = URISupport.parseQuery(entry.getOriginalUri());
+            if (fileName) {
+                Object val = originalParams.get("fileName");
+                if (val != null) {
+                    params.put("fileName", val.toString());
+                }
+            }
+            if (tempFileName) {
+                Object val = originalParams.get("tempFileName");
+                if (val != null) {
+                    params.put("tempFileName", val.toString());
+                }
+            }
+            if (idempotentKey) {
+                Object val = originalParams.get("idempotentKey");
+                if (val != null) {
+                    params.put("idempotentKey", val.toString());
+                }
+            }
             if (move) {
                 Object val = originalParams.get("move");
                 if (val != null) {