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/08/12 09:57:36 UTC

[camel] 07/07: CAMEL-13860: camel-properties: get[Inital|Override]Properties should never return null

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 8b25edf7dc960f9323c63bc2d6e04137706ac810
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Mon Aug 12 10:49:52 2019 +0200

    CAMEL-13860: camel-properties: get[Inital|Override]Properties should never return null
---
 .../camel/component/properties/PropertiesComponent.java   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java b/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
index 29845c6..22366f9 100644
--- a/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
+++ b/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
@@ -401,7 +401,14 @@ public class PropertiesComponent extends DefaultComponent implements org.apache.
         this.ignoreMissingLocation = ignoreMissingLocation;
     }
 
+    /**
+     * @return a list of properties which will be used before any locations are resolved (can't be null).
+     */
     public Properties getInitialProperties() {
+        if (initialProperties == null) {
+            initialProperties = new Properties();
+        }
+
         return initialProperties;
     }
 
@@ -413,7 +420,14 @@ public class PropertiesComponent extends DefaultComponent implements org.apache.
         this.initialProperties = initialProperties;
     }
 
+    /**
+     * @return a list of properties that take precedence and will use first, if a property exist (can't be null).
+     */
     public Properties getOverrideProperties() {
+        if (overrideProperties == null) {
+            overrideProperties = new Properties();
+        }
+
         return overrideProperties;
     }
 
@@ -488,6 +502,7 @@ public class PropertiesComponent extends DefaultComponent implements org.apache.
     public void setEnvironmentVariableMode(int environmentVariableMode) {
         this.environmentVariableMode = environmentVariableMode;
     }
+
     public boolean isAutoDiscoverPropertiesSources() {
         return autoDiscoverPropertiesSources;
     }