You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2020/02/12 02:45:19 UTC

[camel] 09/18: Fix support for extra properties on dataformat

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

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

commit 764bf19b61b59034eaa0511e102e5259269539ce
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Tue Feb 11 07:11:32 2020 +0100

    Fix support for extra properties on dataformat
---
 .../camel/language/tokenizer/TokenizeLanguage.java |  2 +-
 .../org/apache/camel/reifier/AbstractReifier.java  | 24 ++++++++++++----------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java b/core/camel-base/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java
index 8fafba9..8980751 100644
--- a/core/camel-base/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java
+++ b/core/camel-base/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java
@@ -241,7 +241,7 @@ public class TokenizeLanguage implements Language, IsSingleton, GeneratedPropert
     }
 
     public void setGroup(String group) {
-        this.group = group;
+        this.group = "0".equals(group) ? null : group;
     }
 
     public String getGroupDelimiter() {
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/AbstractReifier.java b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/AbstractReifier.java
index b10c685..33efa72 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/AbstractReifier.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/AbstractReifier.java
@@ -88,18 +88,20 @@ public abstract class AbstractReifier {
     protected void addOtherAttributes(Object definition, Map<String, Object> properties) {
         if (definition instanceof OtherAttributesAware) {
             Map<Object, Object> others = ((OtherAttributesAware) definition).getOtherAttributes();
-            others.forEach((k, v) -> {
-                String ks = k.toString();
-                if (ks.startsWith(PREFIX) && v instanceof String) {
-                    // value must be enclosed with placeholder tokens
-                    String s = (String) v;
-                    if (!s.startsWith(PropertiesComponent.PREFIX_TOKEN) && !s.endsWith(PropertiesComponent.SUFFIX_TOKEN)) {
-                        s = PropertiesComponent.PREFIX_TOKEN + s + PropertiesComponent.SUFFIX_TOKEN;
+            if (others != null) {
+                others.forEach((k, v) -> {
+                    String ks = k.toString();
+                    if (ks.startsWith(PREFIX) && v instanceof String) {
+                        // value must be enclosed with placeholder tokens
+                        String s = (String) v;
+                        if (!s.startsWith(PropertiesComponent.PREFIX_TOKEN) && !s.endsWith(PropertiesComponent.SUFFIX_TOKEN)) {
+                            s = PropertiesComponent.PREFIX_TOKEN + s + PropertiesComponent.SUFFIX_TOKEN;
+                        }
+                        String kk = ks.substring(PREFIX.length());
+                        properties.put(kk, s);
                     }
-                    String kk = ks.substring(PREFIX.length());
-                    properties.put(kk, s);
-                }
-            });
+                });
+            }
         }
     }