Samuel Padou created CAMEL-16821:
------------------------------------
Summary: BeanProcessor with Process bean does not handle Throwable
Key: CAMEL-16821
URL: https://issues.apache.org/jira/browse/CAMEL-16821
Project: Camel
Issue Type: Bug
Components: camel-bean
Affects Versions: 3.11.0
Reporter: Samuel Padou
Invoking a Processor bean with BeanProcessor does not handle a non Exception
Throwable thrown by the Processor, for example if the Processor throw an
AssertionError. The throwable will be caught and logged by theĀ
DefaultReactiveExecutor above, but because it is ignored and prevented the
execution of callbacks the route is stuck.
With the following route:
{code:java}
@Component
public static class Route extends RouteBuilder {
@Override
public void configure() throws Exception {
from("direct:test")
.bean(Service.class);
}
}
@Component
public static class Service implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
throw new AssertionError("test");
}
}
@Component
public static class Runner implements CommandLineRunner {
@Autowired
private CamelContext camelContext;
@Autowired
private ProducerTemplate producerTemplate;
@Override
public void run(String... args) throws Exception {
var exchange = new DefaultExchange(camelContext)
producerTemplate.send("direct:test", exchange);
}
}
{code}
The code will block indefinitely on the producerTemplate.send(...)
This is not an issue when a method is invoked directly because the
AssertionError is wrapped in an InvocationTargetException, it only occurs when
a Processor is used.
It look like a regression from this commit
[https://github.com/apache/camel/commit/ab217659e3c9013322a5e7793db5dff904dc4c67]
that changed the catch Throwable in catch Exception when the processor is
invoked in AbstractBeanProcessor.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)