camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/4] camel git commit: CAMEL-8125: Avoid potential NPE when using @PropertyInject with Camel main.
Date Mon, 08 Dec 2014 11:18:27 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.14.x 52a8cc7b2 -> 777b6ab47
  refs/heads/master c00bc44d1 -> 36e7b6681


CAMEL-8125: Avoid potential NPE when using @PropertyInject with Camel main.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/07caaa4f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/07caaa4f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/07caaa4f

Branch: refs/heads/master
Commit: 07caaa4f39112deca295a6677402fec9d3fc4019
Parents: c00bc44
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Dec 8 11:07:24 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Dec 8 11:07:24 2014 +0100

----------------------------------------------------------------------
 .../org/apache/camel/impl/CamelPostProcessorHelper.java   | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/07caaa4f/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java
b/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java
index 88df2f4..04dbc4d 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java
@@ -37,6 +37,7 @@ import org.apache.camel.Service;
 import org.apache.camel.component.bean.BeanInfo;
 import org.apache.camel.component.bean.BeanProcessor;
 import org.apache.camel.component.bean.ProxyHelper;
+import org.apache.camel.component.properties.PropertiesComponent;
 import org.apache.camel.processor.CamelInternalProcessor;
 import org.apache.camel.processor.UnitOfWorkProducer;
 import org.apache.camel.util.CamelContextHelper;
@@ -229,7 +230,14 @@ public class CamelPostProcessorHelper implements CamelContextAware {
             String key;
             String prefix = getCamelContext().getPropertyPrefixToken();
             String suffix = getCamelContext().getPropertySuffixToken();
-            if (!propertyName.contains(prefix)) {
+
+            if (prefix == null && suffix == null) {
+                // if no custom prefix/suffix then use defaults
+                prefix = PropertiesComponent.DEFAULT_PREFIX_TOKEN;
+                suffix = PropertiesComponent.DEFAULT_SUFFIX_TOKEN;
+            }
+
+            if (!propertyName.startsWith(prefix)) {
                 // must enclose the property name with prefix/suffix to have it resolved
                 key = prefix + propertyName + suffix;
             } else {


Mime
View raw message