Execptions cannot be propagated to the parent route when using LogEIP
---------------------------------------------------------------------
Key: CAMEL-4388
URL: https://issues.apache.org/jira/browse/CAMEL-4388
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: Sergey Zhemzhitsky
Priority: Critical
Here is unit test that demonstrates the problem.
For the unit test pass successfully it's necessary to delete LogEIP from the
route.
{code}
package org.apache.camel.impl;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class PropagateExceptionTest extends CamelTestSupport {
@Test
public void failure() throws Exception {
getMockEndpoint("mock:handleFailure").whenAnyExchangeReceived(new
Processor() {
@Override
public void process(Exchange exchange) throws Exception {
throw new RuntimeException("TEST EXCEPTION");
}
});
getMockEndpoint("mock:exceptionFailure").expectedMessageCount(1);
sendBody("direct:startFailure", "Hello World");
assertMockEndpointsSatisfied();
}
@Test
public void success() throws Exception {
getMockEndpoint("mock:handleSuccess").whenAnyExchangeReceived(new
Processor() {
@Override
public void process(Exchange exchange) throws Exception {
throw new RuntimeException("TEST EXCEPTION");
}
});
getMockEndpoint("mock:exceptionSuccess").expectedMessageCount(1);
sendBody("direct:startSuccess", "Hello World");
assertMockEndpointsSatisfied();
}
@Override
protected RouteBuilder[] createRouteBuilders() throws Exception {
return new RouteBuilder[] {
new RouteBuilder() {
public void configure() throws Exception {
from("direct:startFailure")
.onException(Throwable.class)
.to("mock:exceptionFailure")
.end()
.to("direct:handleFailure")
.to("mock:resultFailure");
from("direct:handleFailure")
.errorHandler(noErrorHandler())
.log("FAULTY LOG")
.to("mock:handleFailure");
}
},
new RouteBuilder() {
public void configure() throws Exception {
from("direct:startSuccess")
.onException(Throwable.class)
.to("mock:exceptionSuccess")
.end()
.to("direct:handleSuccess")
.to("mock:resultSuccess");
from("direct:handleSuccess")
.errorHandler(noErrorHandler())
.to("mock:handleSuccess");
}
}
};
}
}
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira