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 2014/12/08 12:18:29 UTC

[3/4] camel git commit: CAMEL-8125: Avoid potential NPE when using @PropertyInject with Camel main.

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/497cdca5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/497cdca5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/497cdca5

Branch: refs/heads/camel-2.14.x
Commit: 497cdca541e8c365675d996e6aedeba8473736bb
Parents: 52a8cc7
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Dec 8 11:07:24 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Dec 8 12:18:01 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/497cdca5/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 {