Repository: camel Updated Branches: refs/heads/master 4491c080c -> 55223cf81
CAMEL-9305: PropertiesComponent.isDefaultCreated method only check the absence of defined locations Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/55223cf8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/55223cf8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/55223cf8 Branch: refs/heads/master Commit: 55223cf81f2709bb3ca81c098ee4492af70a87fa Parents: 4491c08 Author: Antonin Stefanutti <anto...@stefanutti.fr> Authored: Tue Nov 10 15:00:17 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Wed Nov 11 14:29:03 2015 +0100 ---------------------------------------------------------------------- .../camel/component/properties/PropertiesComponent.java | 9 +++++++-- .../main/java/org/apache/camel/util/CamelContextHelper.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/55223cf8/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java index 952606c..33866d6 100644 --- a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java @@ -92,6 +92,7 @@ public class PropertiesComponent extends DefaultComponent { private final Map<String, PropertiesFunction> functions = new HashMap<String, PropertiesFunction>(); private PropertiesResolver propertiesResolver = new DefaultPropertiesResolver(this); private PropertiesParser propertiesParser = new DefaultPropertiesParser(this); + private boolean isDefaultCreated; private String[] locations; private boolean ignoreMissingLocation; private String encoding; @@ -115,7 +116,11 @@ public class PropertiesComponent extends DefaultComponent { addFunction(new ServiceHostPropertiesFunction()); addFunction(new ServicePortPropertiesFunction()); } - + + public PropertiesComponent(boolean isDefaultCreated) { + this.isDefaultCreated = isDefaultCreated; + } + public PropertiesComponent(String location) { this(); setLocation(location); @@ -207,7 +212,7 @@ public class PropertiesComponent extends DefaultComponent { * Is this component created as a default by {@link org.apache.camel.CamelContext} during starting up Camel. */ public boolean isDefaultCreated() { - return locations == null; + return isDefaultCreated; } public String[] getLocations() { http://git-wip-us.apache.org/repos/asf/camel/blob/55223cf8/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java b/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java index 1b01fef..d22fcff 100644 --- a/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java +++ b/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java @@ -582,7 +582,7 @@ public final class CamelContextHelper { // create a default properties component to be used as there may be default values we can use LOG.info("No existing PropertiesComponent has been configured, creating a new default PropertiesComponent with name: properties"); // do not auto create using getComponent as spring auto-wire by constructor causes a side effect - answer = new PropertiesComponent(); + answer = new PropertiesComponent(true); camelContext.addComponent("properties", answer); } return answer;