[ 
https://issues.apache.org/jira/browse/JEXL-434?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Henri Biestro resolved JEXL-434.
--------------------------------
    Resolution: Fixed

Commit 
[ae3b1cbe|https://github.com/apache/commons-jexl/commit/ae3b1cbe611229bb402f46b09a85858c3a8d2bb2]

> The safe-access array operator is not safe
> ------------------------------------------
>
>                 Key: JEXL-434
>                 URL: https://issues.apache.org/jira/browse/JEXL-434
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.4.0
>            Reporter: Vincent Bussol
>            Assignee: Henri Biestro
>            Priority: Major
>             Fix For: 3.4.1
>
>
> From the documentation:
> {code:java}
> The safe-access array operator (as in foo?[bar]) provides the same behavior 
> as the safe-access operator and shortcuts any null or non-existent references 
> along the navigation path, allowing a safe-navigation free of errors. In the 
> previous expression, if 'foo' is null, the whole expression will evaluate as 
> null. {code}
> Trying to use this syntax:
> {code:java}
> JexlEngine jexl = new JexlBuilder().safe(false).strict(true).create();
> final String src = "let foo = null; let value = foo?[bar]";
> final JexlScript script = jexl.createScript(src);
> assertNotNull(script);
> final Object result = script.execute(null);
> assertNull(result); {code}
> throws a Variable exception:
> {code:java}
> 1:29 variable 'foo' is null {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to