camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Terral Guillaume (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAMEL-8798) weaveAddLast throwing UnsupportedOperation when route have a ChoiceDefinition
Date Tue, 26 May 2015 13:15:17 GMT
Terral Guillaume created CAMEL-8798:
---------------------------------------

             Summary: weaveAddLast throwing UnsupportedOperation when route have a ChoiceDefinition
                 Key: CAMEL-8798
                 URL: https://issues.apache.org/jira/browse/CAMEL-8798
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.15.2, 2.15.1, 2.15.0, 2.14.2
         Environment: JDK 7.0 64bits
            Reporter: Terral Guillaume


I'm currently upgrading from Camel 2.14.1 to 2.15.2, after the upgrade some of my test are
failing. 

My route is: 
        {code}from("file:input?idempotent=true&moveFailed=.error").routeId("MyRoute")
        .choice()
             .when(body().isEqualTo("body1"))
                 .log("body1")
             .otherwise()
                .log("notBody1")
       .end()
 {code}
My test contains : 
 
        {code}camelContext.getRouteDefinition("MyRoute").adviceWith(camelContext, new AdviceWithRouteBuilder()
{
            @Override
            public void configure() {
                weaveAddLast().to(mockOutput);
            }
        });
{code}
The weaveAddLast is failing with the following stackTrace: 
{code}
java.lang.UnsupportedOperationException 
        at java.util.AbstractList.add(AbstractList.java:148) 
        at org.apache.camel.builder.AdviceWithTasks$4.task(AdviceWithTasks.java:298) 
        at org.apache.camel.model.RouteDefinition.adviceWith(RouteDefinition.java:270) 
{code}
After some debug I found that when my route and with a Choice I cannot weaveAddLast the route.

When the AdviceWithTasks task method try to add the outputs (here) the implementation of the
list return by the ChoiceDefinition class does not implements the method add(int,Object) then
we have the UnsupportedOperation 

The difference between 2.14.1 and 2.15.2 is that in the AdviceWithTasks the outputs list where
the weaveAddLast try to find the last Processor to add the outputs is not a list returned
by ChoiceDefinition but it's a list with the Logs processor. 

This difference is there because now in 2.15.2 the method that is going through the route
to retrieve the outputs nodes have a maximum depth which is computed here  

When my route have finish with a ChoiceDefinition the maximum depth computed is only 1 then
I cannot have my logs in outputs an the weaveAddLast have in his list only the ChoiceDefinition.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message