[
https://issues.apache.org/jira/browse/JEXL-383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17629075#comment-17629075
]
Henri Biestro edited comment on JEXL-383 at 11/4/22 4:20 PM:
-------------------------------------------------------------
Thank you for your issue.
This has been fixed and implemented through JEXL-359 and is actually being
refined in JEXL-384.
Added your test case in the [JEXL-384
branch|https://github.com/apache/commons-jexl/tree/JEXL-384]. Your
JexlArithmetic need to state that the 'not' operator is not strict.
was (Author: henrib):
Thank you for your issue.
This has been implement through JEXL-359 and is actually being refined in
JEXL-384.
Added your test case in the [JEXL-384
branch|https://github.com/apache/commons-jexl/tree/JEXL-384].
> Inconsistent behavior after overriding toBoolean method in JexlArithmetic
> -------------------------------------------------------------------------
>
> Key: JEXL-383
> URL: https://issues.apache.org/jira/browse/JEXL-383
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 3.2.1
> Reporter: Xu Pengcheng
> Assignee: Henri Biestro
> Priority: Major
> Fix For: 3.3
>
>
> I tried to overriding "toBoolean" method of JexlArithmetic for 'strict' mode.
> {code:java}
> @Override
> public boolean toBoolean(final Object val) {
> if (val == null) {
> return false;
> } else {
> return super.toBoolean(val);
> }
> } {code}
> while executing code:
> parameters:
> {code:java}
> a: null
> {code}
> but while executing scripts, the behavior is inconsistent
> {code:java}
> if (a) return 1 else return 2; // returns 2
> if (!a) return 1 else return 2; // expects return 1 but throws exception:
> variable 'a' is null{code}
>
> what should I do to fix it? thanks!
> -Pengcheng
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)