camel-issues mailing list archives

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

    [ https://issues.apache.org/jira/browse/CAMEL-5953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13551488#comment-13551488
] 

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:

{code}
if (defn instanceof TryDefinition) {
{code}

has been changed to:

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

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: 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

Mime
View raw message