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

[jira] [Created] (CAMEL-8097) Error in AST/Graph translation

Paolo Antinori created CAMEL-8097:
-------------------------------------

             Summary: Error in AST/Graph translation
                 Key: CAMEL-8097
                 URL: https://issues.apache.org/jira/browse/CAMEL-8097
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.14.0
            Reporter: Paolo Antinori


See https://github.com/hawtio/hawtio/issues/1202

There could be a problem in {{camel-core}} with the graph model generation, in presence of multiple {{end()}} calls.

{code:java}
        from("direct:whatever")
                .split(body()).parallelProcessing().streaming()
                    .setHeader("", simple(""))
                    .process(new Processor() {
                        @Override
                        public void process(Exchange exchange) throws Exception {
                            
                        }
                    })
                    .choice()
                        .when(simple("something"))
                            .to("direct:a")
                        .when(simple("something2"))
                            .to("direct:b")
                        .when(simple("something3"))
                            .to("direct:c")
                        .otherwise()
                            .log("whatever")
                    .end()
                .end()
                .log("very last");
{code}

Produces the equivalent of this xml dump:

{code:xml}
<route xmlns="http://camel.apache.org/schema/spring" id="route2">
        <from uri="direct:whatever1"/>
        <split parallelProcessing="true" streaming="true">
            <expressionDefinition>body</expressionDefinition>
            <setHeader headerName="">
                <simple/>
            </setHeader>
            <process/>
            <choice>
                <when>
                    <simple>something</simple>
                    <to uri="direct:a"/>
                </when>
                <when>
                    <simple>something2</simple>
                    <to uri="direct:b"/>
                </when>
                <when>
                    <simple>something3</simple>
                    <to uri="direct:c"/>
                </when>
                <otherwise>
                    <log message="whatever"/>
                </otherwise>
            </choice>
        </split>
        <log message="very last"/>
    </route>
{code}

while using *{{endChoice()}}* in place of the inner *{{end()}}*

it produces:

{code:xml}
<route xmlns="http://camel.apache.org/schema/spring" id="route3">
        <from uri="direct:whatever2"/>
        <split parallelProcessing="true" streaming="true">
            <expressionDefinition>body</expressionDefinition>
            <setHeader headerName="">
                <simple/>
            </setHeader>
            <process/>
            <choice>
                <when>
                    <simple>something</simple>
                    <to uri="direct:a"/>
                </when>
                <when>
                    <simple>something2</simple>
                    <to uri="direct:b"/>
                </when>
                <when>
                    <simple>something3</simple>
                    <to uri="direct:c"/>
                </when>
                <otherwise>
                    <log message="whatever"/>
                </otherwise>
            </choice>
            <log message="very last"/>
        </split>
    </route>
{code}

Where the difference is in the location of the line *<log message="very last"/>*


Is this behavior correct? or should this work already without the need of *{{endChoice()}}* statement?




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