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 2022/08/30 11:12:34 UTC

[camel] 01/02: feat(core): hasErrorHandlerFactory helper method (#8238)

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

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

commit c675f471c034311419d1167f1028c3038951c2f5
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Tue Aug 30 13:11:42 2022 +0200

    feat(core): hasErrorHandlerFactory helper method (#8238)
    
    Adding this method allows to check if any errorHandlerFactory exists, before to be initialized by the getErrorHandlerFactory method (which set a default one if it does not exists).
---
 .../src/main/java/org/apache/camel/builder/BuilderSupport.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java b/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java
index c19eba435c6..1b8036a6bd9 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java
@@ -547,7 +547,7 @@ public abstract class BuilderSupport implements CamelContextAware {
     }
 
     public ErrorHandlerFactory getErrorHandlerFactory() {
-        if (errorHandlerFactory == null) {
+        if (!hasErrorHandlerFactory()) {
             errorHandlerFactory = createErrorHandlerBuilder();
         }
         return errorHandlerFactory;
@@ -564,4 +564,12 @@ public abstract class BuilderSupport implements CamelContextAware {
         this.errorHandlerFactory = errorHandlerFactory;
     }
 
+    /**
+     * 
+     * @return true if it an error handler factory was initialized
+     */
+    public boolean hasErrorHandlerFactory() {
+        return this.errorHandlerFactory != null;
+    }
+
 }