'Value inside simple expression is not taken from exchange

Because of the log4j issue, we had to upgrade it in our applications to the most recent version. Doing that, somehow, it breaks how the evaluations are done inside our camel xml.
Here is a little part of the xml:

<split parallelProcessing="false">
                <simple>${body}</simple>
                <choice>
                    <when>
                        <simple>${properties:condition}</simple>
                        <choice>
                            <when>
                                <simple>${body[value_to_take]} == true</simple>

This part worked ok until the changes. Because of the changes, ${body[value_to_take]} evaluates to nothing, the result being nothing == true:

Caused by: org.apache.camel.language.simple.types.SimpleIllegalSyntaxException: Binary operator == has no left hand side token at location 0
== true
*

    at org.apache.camel.language.simple.SimplePredicateParser.parsePredicate(SimplePredicateParser.java:69)
    at org.apache.camel.language.simple.SimpleLanguage.createPredicate(SimpleLanguage.java:115)
    at org.apache.camel.builder.SimpleBuilder.createPredicate(SimpleBuilder.java:94)
    ... 81 more
Caused by: org.apache.camel.language.simple.types.SimpleParserException: Binary operator == has no left hand side token
    at org.apache.camel.language.simple.SimplePredicateParser.prepareBinaryExpressions(SimplePredicateParser.java:341)
    at org...
    BodyType            java.util.HashMap
    Body                {product_id=1, value_to_take=false, body=<?xml...> 

The body is set before going into the choice. The first simple passes ok but when trying to access a part from the body, it somehow fails.
The interesting part is that the body has that value_to_take which in our case is a Boolean.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source