[camel] branch master updated: Fixed potential NPE
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 378ecb3 Fixed potential NPE 378ecb3 is described below commit 378ecb3477334e9fd4ccf3d2a3cd847cbcfc26e3 Author: Claus Ibsen AuthorDate: Tue May 26 09:38:30 2020 +0200 Fixed potential NPE --- .../java/org/apache/camel/main/DefaultConfigurationConfigurer.java | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java index 12b0ccc..da6b116 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java @@ -370,8 +370,11 @@ public final class DefaultConfigurationConfigurer { LOG.info("Using HealthCheckRegistry: {}", healthCheckRegistry); camelContext.setExtension(HealthCheckRegistry.class, healthCheckRegistry); } else { +// okay attempt to inject this camel context into existing health check (if any) healthCheckRegistry = HealthCheckRegistry.get(camelContext); -healthCheckRegistry.setCamelContext(camelContext); +if (healthCheckRegistry != null) { +healthCheckRegistry.setCamelContext(camelContext); +} } Set hcrs = registry.findByType(HealthCheckRepository.class); if (!hcrs.isEmpty()) {
[camel] branch master updated: Fixed potential NPE
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 2a209d8 Fixed potential NPE 2a209d8 is described below commit 2a209d81018f345f4056c2ca033c23d53f868649 Author: Claus Ibsen AuthorDate: Tue Jul 30 11:59:43 2019 +0200 Fixed potential NPE --- core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java | 3 +++ 1 file changed, 3 insertions(+) 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 ed57803..3dd16f1 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 @@ -643,6 +643,9 @@ public abstract class MainSupport extends ServiceSupport { protected void initCamelContext() throws Exception { camelContext = createCamelContext(); +if (camelContext == null) { +throw new IllegalStateException("Created CamelContext is null"); +} postProcessCamelContext(camelContext); }
[camel] branch master updated: Fixed potential NPE
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 791979c Fixed potential NPE 791979c is described below commit 791979c8e037cba89d538b8f119be374afae42bc Author: Claus Ibsen AuthorDate: Mon Apr 29 12:21:50 2019 +0200 Fixed potential NPE --- .../runtimecatalog/impl/AbstractCamelCatalog.java| 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/core/camel-base/src/main/java/org/apache/camel/runtimecatalog/impl/AbstractCamelCatalog.java b/core/camel-base/src/main/java/org/apache/camel/runtimecatalog/impl/AbstractCamelCatalog.java index bb2b00c..1023876 100644 --- a/core/camel-base/src/main/java/org/apache/camel/runtimecatalog/impl/AbstractCamelCatalog.java +++ b/core/camel-base/src/main/java/org/apache/camel/runtimecatalog/impl/AbstractCamelCatalog.java @@ -765,15 +765,17 @@ public abstract class AbstractCamelCatalog { boolean multiValued = isPropertyMultiValue(rows, key); if (multiValued) { String prefix = getPropertyPrefix(rows, key); -// extra all the multi valued options -Map values = URISupport.extractProperties(parameters, prefix); -// build a string with the extra multi valued options with the prefix and & as separator -String csb = values.entrySet().stream() -.map(multi -> prefix + multi.getKey() + "=" + (multi.getValue() != null ? multi.getValue().toString() : "")) -.collect(Collectors.joining("&")); -// append the extra multi-values to the existing (which contains the first multi value) -if (!csb.isEmpty()) { -value = value + "&" + csb; +if (prefix != null) { +// extra all the multi valued options +Map values = URISupport.extractProperties(parameters, prefix); +// build a string with the extra multi valued options with the prefix and & as separator +String csb = values.entrySet().stream() +.map(multi -> prefix + multi.getKey() + "=" + (multi.getValue() != null ? multi.getValue().toString() : "")) +.collect(Collectors.joining("&")); +// append the extra multi-values to the existing (which contains the first multi value) +if (!csb.isEmpty()) { +value = value + "&" + csb; +} } }