[
https://issues.apache.org/jira/browse/CAMEL-20778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17847340#comment-17847340
]
Denis Istomin commented on CAMEL-20778:
---------------------------------------
Hi [~davsclaus], thank you for the fix. Would it be possible to backport this
fix to the latest LTS branch - 4.4.x?
So 4.4.3 LTS will have that fix.
[https://github.com/apache/camel/commit/4543f953c48e5c55ec07ffcfe38dbb33b7bbcd1f]
> 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.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)