[jira] [Commented] (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=15168884#comment-15168884 ] Dmitri Blinov commented on JEXL-190: 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(); // 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)
[jira] [Commented] (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=15168769#comment-15168769 ] Henri Biestro commented on JEXL-190: Hi Dimitri; I'm not able to reproduce the issue. May be something in your context implementation ? My test code: {code} @Test public void test180() throws Exception { String sglobal = "z = (x)->{ return x + 1}; z(41)"; String slocal = "var t = (x)->{ return x + 41}; t(1)"; JexlContext jc = new MapContext(); JexlEngine jexl = new JexlBuilder().create(); JexlScript jglobal = jexl.createScript(sglobal); Object oglobal = jglobal.execute(jc); Assert.assertEquals(42, oglobal); JexlScript jlocal = jexl.createScript(slocal); Object olocal = jlocal.execute(jc); Assert.assertEquals(42, olocal); } {code} > 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)