[ 
https://issues.apache.org/jira/browse/CAMEL-20778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-20778:
--------------------------------
    Fix Version/s: 4.4.3

> Intercept created using AdviceWithRouteBuilder causes issues with error 
> handling (regression)
> ---------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-20778
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20778
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Denis Istomin
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.4.3, 4.7.0
>
>
> 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:
> {code:java}
>     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();
>     }
> {code}
> And then this route is adviced:
> {code:java}
>         AdviceWith.adviceWith(context, "main-route-id", routeBuilder -> {
>             routeBuilder.intercept().log("intercepted");
>         });
> {code}
>  
> Error handler will not catch an exception. Body will not be equal to 
> "expected".
> XML:
> {code: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>
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to