camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hude <>
Subject Re: Problem with adviceWith on 2.13.x
Date Wed, 07 Jan 2015 16:19:51 GMT

we’ve got a problem with the changes for CAMEL-7560. Since an upgrade from
2.12.2 to 2.12.5 all tests where we use the weaveAddFirst method to advice
routes with an onException-clause failed with the following

"java.lang.IllegalArgumentException: There are no outputs which matches:

The reason is that the call "outputs.get(0).getOutputs();" in
AdviceWithTasks for an OnExceptionDefinition only returns the onException
part of the route. I've added a test in AdviceWithTasksTest to demonstrate

public void testBeforeWithOnException() throws Exception {
        context.addRoutes(new RouteBuilder() {
            public void configure() throws Exception {
        // START SNIPPET: e3
        context.getRouteDefinitions().get(1).adviceWith(context, new
AdviceWithRouteBuilder() {
            public void configure() throws Exception {
                // weave the node in the route which has id = bar
                // and insert the following route path before the adviced
weaveById("bar2").before().to("mock:a").transform(constant("Bye World"));
        // END SNIPPET: e3

        getMockEndpoint("mock:foo").expectedBodiesReceived("Hello World");
        getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
        getMockEndpoint("mock:bar").expectedBodiesReceived("Bye World");
        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");

        template.sendBody("direct:start2", "Hello World");


Is there any need why it’s for any abstract definition? If I change the
premise in AdviceWithTasks.getParentOutputs from
"outputs.get(0).isAbstract()" to "outputs.get(0) instanceof
TransactedDefinition" all tests passed. Enclosed you will find my svn patch.




View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message