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 adc87b142dc feat(core): hasErrorHandlerFactory helper method (#8238)
adc87b142dc is described below

commit adc87b142dcb5b81347cce4a1a262c65cd2c98bd
Author: Pasquale Congiusti <[email protected]>
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;
+    }
+
 }

Reply via email to