You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Biestro (JIRA)" <ji...@apache.org> on 2015/03/10 10:39:38 UTC
[jira] [Comment Edited] (JEXL-148) Incorrect Map Property get
[ https://issues.apache.org/jira/browse/JEXL-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14354596#comment-14354596 ]
Henri Biestro edited comment on JEXL-148 at 3/10/15 9:39 AM:
-------------------------------------------------------------
Not reproduced on 3.0 trunk:
{code}
public void test148() throws Exception {
String[] scripts = {"var x = new ('java.util.HashMap'); x.one = 1; x.two = 2; x.one", // results to 1
"x = new ('java.util.HashMap'); x.one = 1; x.two = 2; x.one",// results to 1
"x = new ('java.util.HashMap'); x.one = 1; x.two = 2; x['one']",//results to 1
"var x = new ('java.util.HashMap'); x.one = 1; x.two = 2; x['one']"// result to null?
};
JexlEngine JEXL = new Engine();
JexlContext jc = new MapContext();
for (String s : scripts) {
Object o = JEXL.createScript(s).execute(jc);
Assert.assertEquals(1, o);
}
}
{code}
was (Author: henrib):
Not reproduced on 3.0 trunk:
{code}
public void test148() throws Exception {
String[] scripts = {"var x = new ('java.util.HashMap'); x.one = 1; x.two = 2; x.one", // results to 1
"x = new ('java.util.HashMap'); x.one = 1; x.two = 2; x.one",// results to 1
"x = new ('java.util.HashMap'); x.one = 1; x.two = 2; x['one']",//results to 1
"var x = new ('java.util.HashMap'); x.one = 1; x.two = 2; x['one']"// result to null?
};
JexlEngine JEXL = new Engine();
JexlContext jc = new MapContext();
for (String s : scripts) {
Object o = JEXL.createScript(s).execute(jc);
Assert.assertEquals(1, o);
}
}
{ocde}
> Incorrect Map Property get
> --------------------------
>
> Key: JEXL-148
> URL: https://issues.apache.org/jira/browse/JEXL-148
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1.1
> Reporter: Dmitri Blinov
>
> If I try to execute jelly statement that assigns values to map and gets values from that map after. In one particular case map value is not accessible, I assume there is an error.
> "var x = new ("java.util.HashMap"); x.one = 1; x.two = 2; x.one" results to 1
> "x = new ("java.util.HashMap"); x.one = 1; x.two = 2; x.one" results to 1
> "x = new ("java.util.HashMap"); x.one = 1; x.two = 2; x['one']" results to 1
> "var x = new ("java.util.HashMap"); x.one = 1; x.two = 2; x['one']" result to null
> The script is evaluated in the following usual manner:
> ...
> Script s = jexl.createScript(expr);
> try {
> Object result = s.execute(jc);
> ..
> I'm ready to provide more details if nessesary
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)