[
https://issues.apache.org/jira/browse/CAMEL-6191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13609259#comment-13609259
]
Xavier Fournet commented on CAMEL-6191:
---------------------------------------
Humm... not convainced with the resolution "Not a problem".
I'm not very fan of the best practice you recommend since it is just redundant
with the [].
Anyway even with that, if it is not enforced it could be still a problem for an
user that is not aware of it. We spend a lot of time to track this problem so
it could be avoided for others user if this issue is fixed either by:
* parse the predicate in the same way than the expression. While debugging I
see that the problem is located in
org.apache.camel.language.simple.SimplePredicateParser#removeIgnorableWhiteSpaceTokens
that transforms the tokens field from $\{body[Header Key]\} == 'VALUE1' to
$\{body[HeaderKey]\}=='VALUE1'
* enforce the "must" in the documentation and reject the expression that use an
unquoted key with space in order to avoid strange behaviors
> Simple expression and predicate behaviors are different when accessing to map
> with a space in the key
> -----------------------------------------------------------------------------------------------------
>
> Key: CAMEL-6191
> URL: https://issues.apache.org/jira/browse/CAMEL-6191
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.10.3, 2.10.4
> Reporter: Xavier Fournet
> Assignee: Claus Ibsen
> Fix For: 2.11.0
>
> Attachments: CamelTest.java
>
>
> {noformat}
> The simple langage permit to access to a map element by specifying the key
> between [], ie ${body[key]}
> When the key contains a space the behavior is not the same for a simple
> expression or a simple predicate:
> * expression ${body[my key]} will access to the "my key" element -> correct
> * expression ${body['my key']} will access to the "my key" element -> correct
> * predicate ${body[my key]} == 'value' will access to the "mykey" element ->
> incorrect
> * predicate ${body['my key']} == 'value' will access to the "my key" element
> -> correct
> {noformat}
> See attached testcase, the current ouput is
> {noformat}
> 618 [main] INFO route1 - VALUE1
> 624 [main] INFO route1 - VALUE1
> 629 [main] INFO route1 - VALUE2
> 633 [main] INFO route1 - VALUE2
> 641 [main] INFO route1 - test1 is false
> 648 [main] INFO route1 - test2 is true
> 652 [main] INFO route1 - test3 is true
> 657 [main] INFO route1 - test4 is false
> {noformat}
> but it should be
> {noformat}
> 618 [main] INFO route1 - VALUE1
> 624 [main] INFO route1 - VALUE1
> 629 [main] INFO route1 - VALUE2
> 633 [main] INFO route1 - VALUE2
> 641 [main] INFO route1 - test1 is true
> 648 [main] INFO route1 - test2 is true
> 652 [main] INFO route1 - test3 is false
> 657 [main] INFO route1 - test4 is false
> {noformat}
--
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