You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dmitri Blinov (JIRA)" <ji...@apache.org> on 2016/02/26 13:21:18 UTC
[jira] [Comment Edited] (JEXL-190) function name within script is
not resolved
[ 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)