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 bc8d54a0 core: set the error handler to RouteDefinition
bc8d54a0 is described below
commit bc8d54a0641cb41f18b68fee6ea0697442cd281a
Author: Luca Burgazzoli <[email protected]>
AuthorDate: Mon Feb 15 09:34:10 2021 +0100
core: set the error handler to RouteDefinition
---
.../main/java/org/apache/camel/model/RoutesDefinition.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
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 a878578..3421801 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
@@ -192,9 +192,18 @@ public class RoutesDefinition extends
OptionalIdentifiedDefinition<RoutesDefinit
* @return the builder
*/
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);
+ }
+ }
+
// must prepare the route before we can add it to the routes list
RouteDefinitionHelper.prepareRoute(getCamelContext(), route,
getOnExceptions(), getIntercepts(), getInterceptFroms(),
getInterceptSendTos(), getOnCompletions());
+
getRoutes().add(route);
// mark this route as prepared
route.markPrepared();
@@ -253,7 +262,7 @@ public class RoutesDefinition extends
OptionalIdentifiedDefinition<RoutesDefinit
/**
* Adds an on exception
- *
+ *
* @param exception the exception
* @return the builder
*/