You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2015/05/29 09:44:17 UTC
[jira] [Resolved] (CAMEL-8798) weaveAddLast throwing
UnsupportedOperation when route have a ChoiceDefinition
[ https://issues.apache.org/jira/browse/CAMEL-8798?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-8798.
--------------------------------
Resolution: Fixed
Thanks for reporting.
> 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.14.2, 2.15.0, 2.15.1, 2.15.2
> Environment: JDK 7.0 64bits
> Reporter: Terral Guillaume
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 2.16.0, 2.15.3, 2.14.4
>
>
> 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|https://github.com/apache/camel/blob/camel-2.15.2/camel-core/src/main/java/org/apache/camel/builder/AdviceWithTasks.java#L298]) 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|https://github.com/apache/camel/blob/camel-2.15.2/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java#L221]
> 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)