camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Foster (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-7305) Simple Language - ResultType Coercion is not consistent
Date Mon, 17 Mar 2014 22:18:43 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-7305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alan Foster updated CAMEL-7305:
-------------------------------

    Description: 
Both of the following code snippets lead to unexpected results when setting a resultType to
be a boolean/integer

{code:title=Scenario - Handling POJO}
    <camelContext trace="false" xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="direct:entry"/>

            <!-- Return any kind of POJO -->
            <bean ref="complexModelFactory" method="createComplexModel" />

            <setBody>
                <simple resultType="java.lang.Boolean">${body}</simple>
            </setBody>

            <log message="The body is currently :: '${body}'" />

        </route>
    </camelContext>
{code}

{code:title=Scenario - Handling missing header}
    <camelContext trace="false" xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="direct:entry"/>

            <setBody>
                <simple resultType="java.lang.Boolean">${headers.missing}</simple>
            </setBody>

            <log message="The body is currently :: '${body}'" />

        </route>
    </camelContext>
{code}

The log for both of these scenarios is -

{code}[                          main] route1                         INFO  The body is currently
:: ''{code}

It might be expected that the resulting body would either be true or false.

I am not sure if the below behaviour is as expected either - as they are similiar scenarios,
but with different outcomes.

{code}
            <!-- No error - but header is not an integer -->
            <setBody>
                <simple resultType="java.lang.Integer">${headers.missing}</simple>
            </setBody>

           <!-- Causes java.lang.NumberFormatException: For input string: "" -->
            <setBody>
                <simple resultType="java.lang.Integer"></simple>
            </setBody>
{code}

  was:
Both of the following code snippets lead to unexpected results when setting a resultType to
be a boolean/integer

{code:title=Scenario - Handling POJO}
    <camelContext trace="false" xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="direct:entry"/>

            <!-- Return any kind of POJO -->
            <bean ref="complexModelFactory" method="createComplexModel" />

            <setBody>
                <simple resultType="java.lang.Boolean">${body}</simple>
            </setBody>

            <log message="The body is currently :: '${body}'" />

        </route>
    </camelContext>
{code}

{code:title=Scenario - Handling missing header}
    <camelContext trace="false" xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="direct:entry"/>

            <setBody>
                <simple resultType="java.lang.Boolean">${headers.missing}</simple>
            </setBody>

            <log message="The body is currently :: '${body}'" />

        </route>
    </camelContext>
{code}

The log for both of these scenarios is -

{code}[                          main] route1                         INFO  The body is currently
:: ''{code}

It might be expected that the resulting body would either be true or false.

I am not sure if the below behaviour is as expected either - 

{code}
            <!-- No error - but header is not an integer -->
            <setBody>
                <simple resultType="java.lang.Integer">${headers.missing}</simple>
            </setBody>

           <!-- Causes java.lang.NumberFormatException: For input string: "" -->
            <setBody>
                <simple resultType="java.lang.Integer"></simple>
            </setBody>
{code}


> Simple Language - ResultType Coercion is not consistent
> -------------------------------------------------------
>
>                 Key: CAMEL-7305
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7305
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.12.3
>            Reporter: Alan Foster
>
> Both of the following code snippets lead to unexpected results when setting a resultType
to be a boolean/integer
> {code:title=Scenario - Handling POJO}
>     <camelContext trace="false" xmlns="http://camel.apache.org/schema/blueprint">
>         <route>
>             <from uri="direct:entry"/>
>             <!-- Return any kind of POJO -->
>             <bean ref="complexModelFactory" method="createComplexModel" />
>             <setBody>
>                 <simple resultType="java.lang.Boolean">${body}</simple>
>             </setBody>
>             <log message="The body is currently :: '${body}'" />
>         </route>
>     </camelContext>
> {code}
> {code:title=Scenario - Handling missing header}
>     <camelContext trace="false" xmlns="http://camel.apache.org/schema/blueprint">
>         <route>
>             <from uri="direct:entry"/>
>             <setBody>
>                 <simple resultType="java.lang.Boolean">${headers.missing}</simple>
>             </setBody>
>             <log message="The body is currently :: '${body}'" />
>         </route>
>     </camelContext>
> {code}
> The log for both of these scenarios is -
> {code}[                          main] route1                         INFO  The body
is currently :: ''{code}
> It might be expected that the resulting body would either be true or false.
> I am not sure if the below behaviour is as expected either - as they are similiar scenarios,
but with different outcomes.
> {code}
>             <!-- No error - but header is not an integer -->
>             <setBody>
>                 <simple resultType="java.lang.Integer">${headers.missing}</simple>
>             </setBody>
>            <!-- Causes java.lang.NumberFormatException: For input string: "" -->
>             <setBody>
>                 <simple resultType="java.lang.Integer"></simple>
>             </setBody>
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message