camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Keller (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CAMEL-7428) Simple Language - Operators are not evaluated for setting body or headers
Date Sun, 11 May 2014 09:07:14 GMT

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

Peter Keller edited comment on CAMEL-7428 at 5/11/14 9:05 AM:
--------------------------------------------------------------

Using 
{code}
${true}
{code} 
fails with {{Unknown function: true}}? 

I tested with {{'hello' == 'hello'}} and {{'hello' contains 'hello'}} and both return {{false}}
instead of {{true}}. The following more complete and realistic scenario fails too:

{code}
 from("direct:simple")
    .setHeader("param1", constant("hello"))
    .log("param1 = ${header.param1}")
    .setHeader("param2").simple("${header.param1} == 'hello'", Boolean.class)
    .log("param2 = ${header.param2}");
{code}

This logs:
{noformat}
INFO  param1 = hello
INFO  param2 = false
{noformat}




was (Author: peter keller):
Using 
{code}
${true}
{code} 
fails with {{Unknown function: true}}? 

I tested with {{'hello' == 'hello'}} and {{'hello' contains 'hello'}} and both return {{false}}
instead of {{true}}. The following more complete and realistic scenario fails too:

{code}
 from("direct:simple")
    .setHeader("param1", constant("hello"))
    .log("param1 = ${header.param1}")
    .setHeader("param2").simple("${header.param1} == 'hello", Boolean.class)
    .log("param2 = ${header.param2}");
{code}

This logs:
{noformat}
INFO  param1 = hello
INFO  param2 = false
{noformat}



> Simple Language - Operators are not evaluated for setting body or headers
> -------------------------------------------------------------------------
>
>                 Key: CAMEL-7428
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7428
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.12.3, 2.13.0
>            Reporter: Peter Keller
>
> Operators are not evaluated if using {{simple}} for setting bodies or headers:
> {code}
> from("direct:simple")
>     .setHeader("myHeader").simple("true == true", Boolean.class)
>     .log("header = [${header.myHeader}]")
>     .setBody(simple("true == true", Boolean.class))
>     .log("body = [${body}]");
> {code}
> Output is as follows:
> {code}
> INFO  header = [false]
> INFO  body = [false]
> {code}
> The outcome should be {{true}} in both cases.
> Also, see http://stackoverflow.com/questions/23523409/camel-how-to-set-boolean-header-parameter-using-simple-comparison/23560989#23560989



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

Mime
View raw message