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/04/29 10:25:30 UTC

[camel] branch camel-2.22.x updated: Fixed potential NPE

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

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


The following commit(s) were added to refs/heads/camel-2.22.x by this push:
     new d4d8a3e  Fixed potential NPE
d4d8a3e is described below

commit d4d8a3ec537cdc57158e2cae80398a22e3e85f23
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Apr 29 12:24:12 2019 +0200

    Fixed potential NPE
---
 .../camel/runtimecatalog/AbstractCamelCatalog.java | 24 ++++++++++++----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/runtimecatalog/AbstractCamelCatalog.java b/camel-core/src/main/java/org/apache/camel/runtimecatalog/AbstractCamelCatalog.java
index 3e58ce4..4505d4b 100644
--- a/camel-core/src/main/java/org/apache/camel/runtimecatalog/AbstractCamelCatalog.java
+++ b/camel-core/src/main/java/org/apache/camel/runtimecatalog/AbstractCamelCatalog.java
@@ -746,17 +746,19 @@ public abstract class AbstractCamelCatalog {
             boolean multiValued = isPropertyMultiValue(rows, key);
             if (multiValued) {
                 String prefix = getPropertyPrefix(rows, key);
-                // extra all the multi valued options
-                Map<String, Object> values = URISupport.extractProperties(parameters, prefix);
-                // build a string with the extra multi valued options with the prefix and & as separator
-                CollectionStringBuffer csb = new CollectionStringBuffer("&");
-                for (Map.Entry<String, Object> multi : values.entrySet()) {
-                    String line = prefix + multi.getKey() + "=" + (multi.getValue() != null ? multi.getValue().toString() : "");
-                    csb.append(line);
-                }
-                // append the extra multi-values to the existing (which contains the first multi value)
-                if (!csb.isEmpty()) {
-                    value = value + "&" + csb.toString();
+                if (prefix != null) {
+                    // extra all the multi valued options
+                    Map<String, Object> values = URISupport.extractProperties(parameters, prefix);
+                    // build a string with the extra multi valued options with the prefix and & as separator
+                    CollectionStringBuffer csb = new CollectionStringBuffer("&");
+                    for (Map.Entry<String, Object> multi : values.entrySet()) {
+                        String line = prefix + multi.getKey() + "=" + (multi.getValue() != null ? multi.getValue().toString() : "");
+                        csb.append(line);
+                    }
+                    // append the extra multi-values to the existing (which contains the first multi value)
+                    if (!csb.isEmpty()) {
+                        value = value + "&" + csb.toString();
+                    }
                 }
             }