Vincent Bussol created JEXL-436:
-----------------------------------
Summary: 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
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)