[
https://issues.apache.org/jira/browse/JEXL-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17922225#comment-17922225
]
Henri Biestro commented on JEXL-436:
------------------------------------
Thanks for the report; it seems other self-assignment operators perform that
check through the base operator (ie a+=b <=> a = a+b). Functionally, if a
set-assign operator is strict, the left-hand side being null should always
trigger an error.
> The increment (decrement) operator does not check for null operand
> ------------------------------------------------------------------
>
> Key: JEXL-436
> URL: https://issues.apache.org/jira/browse/JEXL-436
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 3.4.1
> Reporter: Vincent Bussol
> Assignee: Henri Biestro
> Priority: Major
> Fix For: 3.4.1
>
>
> Using the default arithmetic (strict):
>
> {code:java}
> var i = null;
> ++i;{code}
> The operation returns 1 when it should fail. Same behavior for all version of
> increment/decrement operators. The other operators (like add or self add)
> throw an error "variable 'i' is null" as expected.
>
>
> {code:java}
> @Test
> void testStrictIncrementOperatorOnNull() {
> final JexlEngine jexl = new JexlBuilder().create();
> JexlScript script = jexl.createScript("var i = null; ++i");
> assertThrows(JexlException.class, () -> script.execute(null));
> } {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)