Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.7.1
-
None
-
Unknown
Description
Here is unit test that demonstrates the problem.
For the unit test pass successfully it's necessary to delete LogEIP from the route.
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"); } } }; } }