Claus Ibsen created CAMEL-24920:
-----------------------------------
Summary: camel-core: the ternary operator cannot take a compound
condition (&& or || inside ${ })
Key: CAMEL-24920
URL: https://issues.apache.org/jira/browse/CAMEL-24920
Project: Camel
Issue Type: Improvement
Components: camel-core
Reporter: Claus Ibsen
{{$\{a > 0 && b < 10 ? 'x' : 'y'\}}} is refused:
{noformat}
Logical operator && needs a predicate on the right hand side, e.g.
${header.foo} == 'bar'
{noformat}
Parentheses do not help either - {{$\{(a > 0 && b < 10) ? 'x' : 'y'\}}} is
refused the same way. A single comparison is fine, so {{$\{header.n > 0 ?
'positive' : 'negative'\}}} works.
So the ternary accepts a condition, but only a comparison: any real condition
has to be lifted out of the braces, and outside the braces a {{?}} and a {{:}}
are literal text, so the ternary cannot be written at all. The only way out is
a choice EIP or a bean.
That is hard to defend on its own terms, and it is a small gap next to the
larger question of operators inside {{$\{ \}}} in general (a separate issue,
with the analysis behind it).
Tested on 4.23.0-SNAPSHOT.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)