You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2021/07/30 10:44:00 UTC

[jira] [Resolved] (CAMEL-16821) camel-bean - BeanProcessor with Process bean does not handle Throwable

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

Claus Ibsen resolved CAMEL-16821.
---------------------------------
    Resolution: Fixed

> camel-bean - 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
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 3.11.1, 3.12.0
>
>
> 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)