According to the commons-jexl change logs, a breaking change was released
in 3.0:

"Syntactically enforce that expressions do not contain statements:
POTENTIAL EXPRESSION BREAK! (ie an expression is not a script and can NOT
use 'if','for'... and blocks)"

I was able to fix this by switching from JexlExpression to JexlScript. I
have a small patch that I'm happy to contribute!



On Sun, Oct 10, 2021 at 3:30 PM Max Ockner <maxock...@gmail.com> wrote:

> Hello,
>
> I'm trying to use JEXL expressions similar to the ones described here
> https://issues.apache.org/jira/browse/NUTCH-2368.
>
> I consistently get an error parsing my "if" statement.
>
> I can reproduce with a simpler expression:
> -Dgenerate.max.count.expr='if (true) {return 2} else {return 1}'
>
> I'm running 1.19 on java 11 (also tried with java 8).
>
> Has anyone else seen this problem?
>
> Thanks,
> Ma
>

Reply via email to