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 24bfdbf CAMEL-15084: Move health implementation in camel-base into camel-health 24bfdbf is described below commit 24bfdbfa7c6173be7f4955058a9439fd3fc39b9f Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon May 25 06:45:00 2020 +0200 CAMEL-15084: Move health implementation in camel-base into camel-health --- .../org/apache/camel/impl/engine/AbstractCamelContext.java | 14 +++++++++----- .../org/apache/camel/impl/health/RouteHealthCheckTest.java | 5 ++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java index 324423b..4e3a469 100644 --- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java +++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java @@ -431,15 +431,19 @@ public abstract class AbstractCamelContext extends BaseService @Override public <T> void setExtension(Class<T> type, T module) { - try { - extensions.put(type, doAddService(module)); - } catch (Exception e) { - throw RuntimeCamelException.wrapRuntimeCamelException(e); + if (module != null) { + try { + extensions.put(type, doAddService(module)); + } catch (Exception e) { + throw RuntimeCamelException.wrapRuntimeCamelException(e); + } } } public <T> void setDefaultExtension(Class<T> type, Supplier<T> module) { - extensions.putIfAbsent(type, module); + if (module != null) { + extensions.putIfAbsent(type, module); + } } @Override diff --git a/core/camel-health/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java b/core/camel-health/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java index 29a5e63..c869f07 100644 --- a/core/camel-health/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java +++ b/core/camel-health/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java @@ -18,7 +18,6 @@ package org.apache.camel.impl.health; import java.util.Collections; -import junit.framework.TestCase; import org.apache.camel.CamelContext; import org.apache.camel.Route; import org.apache.camel.builder.RouteBuilder; @@ -26,12 +25,12 @@ import org.apache.camel.health.HealthCheckResultBuilder; import org.apache.camel.impl.DefaultCamelContext; import org.junit.Test; -public class RouteHealthCheckTest extends TestCase { +public class RouteHealthCheckTest { private static final String TEST_ROUTE_ID = "Test-Route"; @Test - public void testDoCallDoesNotHaveNPEWhenJmxDisabled() throws Exception{ + public void testDoCallDoesNotHaveNPEWhenJmxDisabled() throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() { @Override