Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
Unknown
Description
Starting from Camel 4.0.0. It works with 3.22.x and below.
Reproducer: https://github.com/DenisIstomin/camel-intercept-bug
If route is configured like this:
public void configure() { onException(Exception.class) .log(LoggingLevel.ERROR, "handler", "called"); from("direct:start").routeId("main-route-id") .doTry() .throwException(new Exception()) .doCatch(Exception.class) .setBody(constant("expected")) .end(); }
And then this route is adviced:
AdviceWith.adviceWith(context, "main-route-id", routeBuilder -> { routeBuilder.intercept().log("intercepted"); });
Error handler will not catch an exception. Body will not be equal to "expected".
XML:
<route xmlns="http://camel.apache.org/schema/spring" id="main-route-id"> <from uri="direct:start"/> <onException> <exception>java.lang.Exception</exception> <log logName="handler" message="called" loggingLevel="ERROR"/> </onException> <intercept> <log message="intercepted"/> </intercept> <doTry> <throwException/> <doCatch> <exception>java.lang.Exception</exception> <setBody> <constant>expected</constant> </setBody> </doCatch> </doTry> </route>
Attachments
Issue Links
- links to