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/24 06:23:00 UTC
[jira] [Created] (CAMEL-24983) camel-core: simple - say what to write when ! is used to negate a function
Claus Ibsen created CAMEL-24983:
-----------------------------------
Summary: camel-core: simple - say what to write when ! is used to negate a function
Key: CAMEL-24983
URL: https://issues.apache.org/jira/browse/CAMEL-24983
Project: Camel
Issue Type: Improvement
Components: camel-core
Reporter: Claus Ibsen
Simple has no boolean {{!}} prefix, so a negated function fails with a message that points at the operator rather than at the {{!}}:
{noformat}
${body != null && !${body.isEmpty()}}
-> Logical operator && needs a predicate on the right hand side, e.g. ${header.foo} == 'bar'; was: !${body.isEmpty()}
{noformat}
The same is true without the inner {{${ }}}: {{${body != null && !body.isEmpty()}}} fails the same way. The nesting is not the problem - {{${body != null && ${body.isEmpty()}}}} evaluates fine - the {{!}} is.
The message now says the comparison to write instead:
{noformat}
! does not negate a function: compare it instead, so !${body.isEmpty()} is written as ${body.isEmpty()} == false, or negate the operator (!=, !contains)
{noformat}
Both {{${body.isEmpty()} == false}} and {{body.isEmpty() == false}} were verified to evaluate correctly.
h3. Where it comes from
The local-model benchmark: over 1586 route files a model wrote, the {{!}}-negated form appears in three separate series, alongside two other shapes of the same instinct ({{${body != null && ${body.size()} > 0}}}, which works, and {{${simple:${exchangeProperty.orderId}}}}, which reports an unknown function). A person writing Java or JavaScript makes the same mistake.
Note this message should be revisited if simple gains support for {{!}} as a negation prefix.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)