This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 29891a8  CAMEL-17626: camel-health - SPI to plugin custom manipulation 
of health check
29891a8 is described below

commit 29891a85db89c0d695922f1a1b45234cf3920ab6
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Feb 10 16:05:45 2022 +0100

    CAMEL-17626: camel-health - SPI to plugin custom manipulation of health 
check
---
 .../java/org/apache/camel/impl/health/AbstractHealthCheck.java    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/core/camel-health/src/main/java/org/apache/camel/impl/health/AbstractHealthCheck.java
 
b/core/camel-health/src/main/java/org/apache/camel/impl/health/AbstractHealthCheck.java
index 8ffa124..e651225 100644
--- 
a/core/camel-health/src/main/java/org/apache/camel/impl/health/AbstractHealthCheck.java
+++ 
b/core/camel-health/src/main/java/org/apache/camel/impl/health/AbstractHealthCheck.java
@@ -208,9 +208,11 @@ public abstract class AbstractHealthCheck implements 
HealthCheck, CamelContextAw
     protected abstract void doCall(HealthCheckResultBuilder builder, 
Map<String, Object> options);
 
     private HealthCheckResultStrategy customHealthCheckResponseStrategy() {
-        Set<HealthCheckResultStrategy> set = 
camelContext.getRegistry().findByType(HealthCheckResultStrategy.class);
-        if (set.size() == 1) {
-            return set.iterator().next();
+        if (camelContext != null) {
+            Set<HealthCheckResultStrategy> set = 
camelContext.getRegistry().findByType(HealthCheckResultStrategy.class);
+            if (set.size() == 1) {
+                return set.iterator().next();
+            }
         }
         return null;
     }

Reply via email to