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

lburgazzoli 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 7163c10  core: set the error handler to RouteDefinition (take 2)
7163c10 is described below

commit 7163c101e5a178b2c36335857a57c25ff6e16546
Author: Luca Burgazzoli <[email protected]>
AuthorDate: Mon Feb 15 12:52:51 2021 +0100

    core: set the error handler to RouteDefinition (take 2)
---
 .../src/main/java/org/apache/camel/model/RoutesDefinition.java    | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git 
a/core/camel-core-model/src/main/java/org/apache/camel/model/RoutesDefinition.java
 
b/core/camel-core-model/src/main/java/org/apache/camel/model/RoutesDefinition.java
index 3421801..85adf9e 100644
--- 
a/core/camel-core-model/src/main/java/org/apache/camel/model/RoutesDefinition.java
+++ 
b/core/camel-core-model/src/main/java/org/apache/camel/model/RoutesDefinition.java
@@ -193,11 +193,9 @@ public class RoutesDefinition extends 
OptionalIdentifiedDefinition<RoutesDefinit
      */
     public RouteDefinition route(RouteDefinition route) {
         // must set the error handler if not already set on the route
-        if (route.getErrorHandlerFactory() != null && 
route.getErrorHandlerRef() != null) {
-            ErrorHandlerFactory handler = getErrorHandlerFactory();
-            if (handler != null) {
-                route.setErrorHandlerFactory(handler);
-            }
+        ErrorHandlerFactory handler = getErrorHandlerFactory();
+        if (handler != null) {
+            route.setErrorHandlerFactoryIfNull(handler);
         }
 
         // must prepare the route before we can add it to the routes list

Reply via email to