You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Raul Kripalani (JIRA)" <ji...@apache.org> on 2013/01/10 21:58:12 UTC

[jira] [Created] (CAMEL-5953) Java DSL: unmarshal() inside choice() blocks adding more conditions

Raul Kripalani created CAMEL-5953:
-------------------------------------

             Summary: Java DSL: unmarshal() inside choice() blocks adding more conditions
                 Key: CAMEL-5953
                 URL: https://issues.apache.org/jira/browse/CAMEL-5953
             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(ProcessorDefinition.java:1256)
	at com.mycompany.MyRoute.configure(MyRoute.java:40)
	at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322)
	at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:276)
	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:262)
	[...]
{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: http://www.atlassian.com/software/jira