Claus Ibsen created CAMEL-24771:
-----------------------------------
Summary: camel-core - simple predicate fails to parse a } inside a
quoted literal
Key: CAMEL-24771
URL: https://issues.apache.org/jira/browse/CAMEL-24771
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: Claus Ibsen
A simple *predicate* with a closing brace inside a quoted literal does not
parse:
{code}
${body} contains '}'
${body} contains '{name:XOrder}'
${body} == "[]}"
{code}
fails with {{singleQuote has no matching start token}} (or {{doubleQuote
...}}), while the same text as an expression parses fine. The validator page of
the user manual uses {{${body} contains '{name:XOrder}'}} as its example, so a
user copying it hits this.
Cause: {{SimplePredicateParser.createNode}} turns every {{}}} token into a
{{SimpleFunctionEnd}}, whether or not a function is open, so the {{}}} inside
the quotes closes nothing and unbalances the quote pairing.
{{SimpleExpressionParser}} only accepts a function end while a function is open
({{functions.get() > 0}}). The predicate parser also tracked the open function
as a boolean, which is why the fix needs a depth counter: nested functions such
as {{${body[x].get(${exchangeProperty[i]})[y]} == 1}} must keep balancing.
Found while validating the documentation examples (CAMEL-24770).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)