-
Type:
Improvement
-
Status: Resolved
-
Priority:
Minor
-
Resolution: Not A Problem
-
Affects Version/s: 2.23.1
-
Fix Version/s: 3.0.0
-
Component/s: camel-core
-
Labels:
-
Estimated Complexity:Unknown
Following StackOverflow: File component's [consumer.]bridgeErrorHandler in conjunction with startingDirectoryMustExist I created the following test class:
package test; import org.apache.camel.LoggingLevel; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.main.Main; import org.junit.After; import org.junit.Before; import org.junit.Test; public class CamelBridgeErrorHandlerTest { private Main main; @Before public void before() { main = new Main(); } @Test public void bridgeErrorHandler() { main.addRouteBuilder(new RouteBuilder() { @Override public void configure() throws Exception { route(this, "file:not.existing.dir?autoCreate=false&startingDirectoryMustExist=true&bridgeErrorHandler=true"); } }); } @Test public void consumerBridgeErrorHandler() { main.addRouteBuilder(new RouteBuilder() { @Override public void configure() throws Exception { route(this, "file:not.existing.dir?autoCreate=false&startingDirectoryMustExist=true&consumer.bridgeErrorHandler=true"); } }); } private void route(final RouteBuilder builder, final String consumerURI) { builder .from(consumerURI) // this is never reached .onException(Exception.class) .handled(true) .log(LoggingLevel.ERROR, "${exception}") .end() .log(" ... processing ..."); } @After public void after() throws Exception { main.start(); } }
Both test methods throw:
org.apache.camel.FailedToCreateRouteException: Failed to create route routeN: Route(routeN)[[From[file:not.existing.dir?autoCreate=false&s... because of Starting directory does not exist: not.existing.dir
rather than the exception(s) being handled by the route(s)' onException().
P.S.: When TRACEing through the log output both test methods show:
2019-02-08 11:29:36.209 TRACE camel.model.ProcessorDefinitionHelper – There are 6 properties on: From[file:not.existing.dir?autoCreate=false&startingDirectoryMustExist=true&{consumer.}bridgeErrorHandler=true]
while there are just 3 of them (autoCreate, startingDirectoryMustExist, [consumer.]bridgeErrorHandler), aren't there? Is this worth another issue?