commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Blinov (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (JEXL-190) function name within script is not resolved
Date Fri, 26 Feb 2016 12:21:18 GMT

    [ https://issues.apache.org/jira/browse/JEXL-190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15168884#comment-15168884
] 

Dmitri Blinov edited comment on JEXL-190 at 2/26/16 12:20 PM:
--------------------------------------------------------------

It has turned out that the problem is reproduced if I try to initialize JEXLEngine with functions
without a namespace in a way like this

{code}

    functions = new HashMap<String, Object>();
    // Register default function namespaces
    functions.put(null, new DefaultFunctions(this));
...

    // Jexl Setup

    boolean verboseScripting = true;
    boolean strict = false;

    JexlBuilder jb = new JexlBuilder();
    jb.silent(!verboseScripting);
    jb.strict(strict);
    jb.namespaces(functions);
...
{code}

To be sure, the class DefaultFunctions does not contain method z. If I comment out the line
 {code} // functions.put(null, new DefaultFunctions(this)); {code} everything works as expected.
Now I wonder if it's correct to register functions with null namespace ?


was (Author: dmitri_blinov):
It has turned out that the problem is reproduced if I try to initialize JEXLEngine with functions
without a namespace in a way like this

{code}

    functions = new HashMap<String, Object>();
    // Register default function namespaces
    functions.put(null, new DefaultFunctions(this));
...

    // Jexl Setup

    boolean verboseScripting = true;
    boolean strict = false;

    JexlBuilder jb = new JexlBuilder();
    jb.silent(!verboseScripting);
    jb.strict(strict);
    jb.namespaces(functions);
...
{code}

If I comment out the line  {code} // functions.put(null, new DefaultFunctions(this)); {code}
everything works as expected. Now I wonder if it's correct to register functions with null
namespace ?

> function name within script is not resolved 
> --------------------------------------------
>
>                 Key: JEXL-190
>                 URL: https://issues.apache.org/jira/browse/JEXL-190
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>
> {code}
> z = function(x) { return x + 1}; return z(1)
> {code} returns error unsolvable function/method 'z' while 
> {code}
> var z = function(x) { return x + 1}; return z(1)
> {code} returns 2



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message