You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/09/23 08:25:00 UTC
[jira] [Commented] (CAMEL-24920) camel-core: the ternary operator cannot take a compound condition (&& or || inside ${ })
[ https://issues.apache.org/jira/browse/CAMEL-24920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18118282#comment-18118282 ]
Claus Ibsen commented on CAMEL-24920:
-------------------------------------
Analysed together with CAMEL-24921, which has the full write-up attached: this gap is the small, self-contained half of it.
The ternary already parses operators inside {{$\{ \}}}, so the restriction is not the braces but the condition - a single comparison is accepted and a compound one is not, with or without parentheses. Fixing it needs no change to how Simple reads {{$\{ \}}} anywhere else.
If CAMEL-24921 is ever done, this disappears with it, because a predicate inside the braces is then the general case and the ternary condition is just one use of it.
> 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
> Priority: Major
>
> {{$\{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)