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/06/25 12:06:37 UTC
[camel] branch master updated: camel-main - Add a bit more
empty/null check for invalid properties
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
The following commit(s) were added to refs/heads/master by this push:
new 8653f7d camel-main - Add a bit more empty/null check for invalid properties
8653f7d is described below
commit 8653f7d24381e5ecd8c4a5098273fa027c25b1bc
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jun 25 14:06:17 2019 +0200
camel-main - Add a bit more empty/null check for invalid properties
---
.../java/org/apache/camel/main/MainSupport.java | 48 ++++++++++++++--------
1 file changed, 32 insertions(+), 16 deletions(-)
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
index ac8a5a2..9e8ebf1 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
@@ -810,17 +810,23 @@ public abstract class MainSupport extends ServiceSupport {
// grab the value
String value = prop.getProperty(key);
String option = key.substring(14);
- properties.put(option, value);
+ if (ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
+ properties.put(option, value);
+ }
} else if (key.startsWith("camel.hystrix.")) {
// grab the value
String value = prop.getProperty(key);
String option = key.substring(14);
- hystrixProperties.put(option, value);
+ if (ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
+ hystrixProperties.put(option, value);
+ }
} else if (key.startsWith("camel.rest.")) {
// grab the value
String value = prop.getProperty(key);
String option = key.substring(11);
- restProperties.put(option, value);
+ if (ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
+ restProperties.put(option, value);
+ }
}
}
if (!properties.isEmpty()) {
@@ -862,9 +868,11 @@ public abstract class MainSupport extends ServiceSupport {
// grab the value
String value = prop.getProperty(key);
String option = key.substring(dot + 1);
- Map<String, Object> values = properties.getOrDefault(component, new LinkedHashMap<>());
- values.put(option, value);
- properties.put(component, values);
+ if (ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
+ Map<String, Object> values = properties.getOrDefault(component, new LinkedHashMap<>());
+ values.put(option, value);
+ properties.put(component, values);
+ }
}
}
@@ -890,7 +898,9 @@ public abstract class MainSupport extends ServiceSupport {
// grab the value
String value = prop.getProperty(key);
String option = key.substring(11);
- properties.put(option, value);
+ if (ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
+ properties.put(option, value);
+ }
}
}
@@ -947,9 +957,11 @@ public abstract class MainSupport extends ServiceSupport {
// grab the value
String value = prop.getProperty(key);
String option = key.substring(dot + 1);
- Map<String, Object> values = properties.getOrDefault(component, new LinkedHashMap<>());
- values.put(option, value);
- properties.put(component, values);
+ if (ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
+ Map<String, Object> values = properties.getOrDefault(component, new LinkedHashMap<>());
+ values.put(option, value);
+ properties.put(component, values);
+ }
}
dot = key.indexOf(".", 17);
if (key.startsWith("camel.dataformat.") && dot > 0) {
@@ -959,9 +971,11 @@ public abstract class MainSupport extends ServiceSupport {
// grab the value
String value = prop.getProperty(key);
String option = key.substring(dot + 1);
- Map<String, Object> values = properties.getOrDefault(dataformat, new LinkedHashMap<>());
- values.put(option, value);
- properties.put(dataformat, values);
+ if (ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
+ Map<String, Object> values = properties.getOrDefault(dataformat, new LinkedHashMap<>());
+ values.put(option, value);
+ properties.put(dataformat, values);
+ }
}
dot = key.indexOf(".", 15);
if (key.startsWith("camel.language.") && dot > 0) {
@@ -971,9 +985,11 @@ public abstract class MainSupport extends ServiceSupport {
// grab the value
String value = prop.getProperty(key);
String option = key.substring(dot + 1);
- Map<String, Object> values = properties.getOrDefault(language, new LinkedHashMap<>());
- values.put(option, value);
- properties.put(language, values);
+ if (ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
+ Map<String, Object> values = properties.getOrDefault(language, new LinkedHashMap<>());
+ values.put(option, value);
+ properties.put(language, values);
+ }
}
}