camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Babak Vahdat (JIRA)" <>
Subject [jira] [Commented] (CAMEL-5953) Java DSL: unmarshal() inside choice() blocks adding more conditions
Date Fri, 11 Jan 2013 20:18:13 GMT


Babak Vahdat commented on CAMEL-5953:

I just quickly looked at this and IMHO it's a regression caused by CAMEL-4044. For example
if you would revert one of the changes made there for {{ProcessorDefinition}} (line 1215 on
trunk) where:

if (defn instanceof TryDefinition) {

has been changed to:

if (defn instanceof TryDefinition || defn instanceof ChoiceDefinition) {

Then your route would be fine without any nasty {{ClassCastException}}. However it's not that
easy as this change would cause some existing {{camel-core}} tests to fail, *mainly* at the
places where the code has been changed through CAMEL-4044 itself. As Claus has already mentioned
there that fix has a poor code coverage.
> Java DSL: unmarshal() inside choice() blocks adding more conditions
> -------------------------------------------------------------------
>                 Key: CAMEL-5953
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.10.3
>            Reporter: Raul Kripalani
> This routing code leads to the exception below:
> {code}
> from("direct:abc")
>     .choice()
>         .when(simple("${body} == 'Please do not fail'"))
>             .to("log:test")
>             .unmarshal().xstream().endChoice()
>         .otherwise()
>             .to("log:test")
>         .end();
> {code}
> Exception:
> {code}
> Caused by: java.lang.ClassCastException: org.apache.camel.model.RouteDefinition cannot
be cast to org.apache.camel.model.ChoiceDefinition
> 	at org.apache.camel.model.ProcessorDefinition.endChoice(
> 	at com.mycompany.MyRoute.configure(
> 	at org.apache.camel.builder.RouteBuilder.checkInitialized(
> 	at org.apache.camel.builder.RouteBuilder.configureRoutes(
> 	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(
> 	[...]
> {code}
> Also happens if we try to add another when instead of an otherwise.
> Tried using end(), endParent(), but they all lead to the same exception. 

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message