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

commit 0d2f3e996b80a068efbf4213741010bfe889d600
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sat Aug 22 18:35:47 2020 +0200

    CAMEL-15394: PropertyBindingSupport: Fixed NPE
---
 .../java/org/apache/camel/support/PropertyBindingSupport.java  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
index a2a558f..5e53862 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
@@ -589,8 +589,10 @@ public final class PropertyBindingSupport {
                 return Integer.compare(n1, n2);
             }
             // 2) sort by reference (as it may refer to other beans in the 
OGNL graph)
-            boolean ref1 = map.get(o1).toString().startsWith("#");
-            boolean ref2 = map.get(o2).toString().startsWith("#");
+            Object v1 = map.get(o1);
+            Object v2 = map.get(o2);
+            boolean ref1 = v1 != null && v1.toString().startsWith("#");
+            boolean ref2 = v2 != null && v2.toString().startsWith("#");
             if (ref1 != ref2) {
                 return Boolean.compare(ref1, ref2);
             }
@@ -630,6 +632,10 @@ public final class PropertyBindingSupport {
             boolean reference, boolean placeholder,
             PropertyConfigurer configurer) {
 
+        if (properties == null || properties.isEmpty()) {
+            return false;
+        }
+
         boolean answer = false;
 
         if (optionPrefix != null) {

Reply via email to