You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Cary Thompson (JIRA)" <ji...@apache.org> on 2010/12/21 03:38:01 UTC
[jira] Created: (JEXL-105) Array creation 2nd time requires
duplication of JexlEngine
Array creation 2nd time requires duplication of JexlEngine
-----------------------------------------------------------
Key: JEXL-105
URL: https://issues.apache.org/jira/browse/JEXL-105
Project: Commons JEXL
Issue Type: Bug
Affects Versions: 2.0.1
Environment: JDK 1.6 SE on Windows XP
Reporter: Cary Thompson
Fix For: 2.0.2
JexlContext context = new MapContext();
Expression selectExp = new JexlEngine().createExpression("[a.propA]");
context.set("a", new A("a1", "p1"));
System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));
-->[p1]
//selectExp = new JexlEngine().createExpression("[a.propA]");
context.set("a", new A("a2", "p2"));
System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));
--> [p1] correct answer should be [p2]
// A's class definition
public class A {
String nameA;
String propA;
public A(String nameA, String propA) {
this.nameA = nameA;
this.propA = propA;
}
@Override
public String toString() {
return "A [nameA=" + nameA + ", propA=" + propA + "]";
}
public String getNameA() {
return nameA;
}
public String getPropA() {
return propA;
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JEXL-105) Array creation 2nd time requires
duplication of JexlEngine
Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12973731#action_12973731 ]
Henri Biestro commented on JEXL-105:
------------------------------------
Thanks for the test case, bug is confirmed.
Culprit is Interpreter#visit(ASTArrayLiteral node, Object data) which wrongfully considers an array literal as a constant evaluation.
> Array creation 2nd time requires duplication of JexlEngine
> -----------------------------------------------------------
>
> Key: JEXL-105
> URL: https://issues.apache.org/jira/browse/JEXL-105
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.0.1
> Environment: JDK 1.6 SE on Windows XP
> Reporter: Cary Thompson
> Assignee: Henri Biestro
> Fix For: 2.0.2
>
>
> JexlContext context = new MapContext();
> Expression selectExp = new JexlEngine().createExpression("[a.propA]");
> context.set("a", new A("a1", "p1"));
> System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));
> -->[p1]
> //selectExp = new JexlEngine().createExpression("[a.propA]");
> context.set("a", new A("a2", "p2"));
> System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));
> --> [p1] correct answer should be [p2]
> // A's class definition
> public class A {
> String nameA;
>
> String propA;
> public A(String nameA, String propA) {
> this.nameA = nameA;
> this.propA = propA;
> }
> @Override
> public String toString() {
> return "A [nameA=" + nameA + ", propA=" + propA + "]";
> }
> public String getNameA() {
> return nameA;
> }
> public String getPropA() {
> return propA;
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (JEXL-105) Array literals are considered constant
even when they are not
Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro resolved JEXL-105.
--------------------------------
Resolution: Fixed
Fixed at revision 1051571.
Added JexlNode.isConstant() to allow detection of constant expressions;
Fixed ASTArrayLiteral to detect at parsing time whether the array is constant or not;
Added specific test105 in IssuesTest
> Array literals are considered constant even when they are not
> -------------------------------------------------------------
>
> Key: JEXL-105
> URL: https://issues.apache.org/jira/browse/JEXL-105
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.0.1
> Environment: JDK 1.6 SE on Windows XP
> Reporter: Cary Thompson
> Assignee: Henri Biestro
> Fix For: 2.0.2
>
>
> JexlContext context = new MapContext();
> Expression selectExp = new JexlEngine().createExpression("[a.propA]");
> context.set("a", new A("a1", "p1"));
> System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));
> -->[p1]
> //selectExp = new JexlEngine().createExpression("[a.propA]");
> context.set("a", new A("a2", "p2"));
> System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));
> --> [p1] correct answer should be [p2]
> // A's class definition
> public class A {
> String nameA;
>
> String propA;
> public A(String nameA, String propA) {
> this.nameA = nameA;
> this.propA = propA;
> }
> @Override
> public String toString() {
> return "A [nameA=" + nameA + ", propA=" + propA + "]";
> }
> public String getNameA() {
> return nameA;
> }
> public String getPropA() {
> return propA;
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JEXL-105) Array literals are considered constant
even when they are not
Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro updated JEXL-105:
-------------------------------
Summary: Array literals are considered constant even when they are not (was: Array creation 2nd time requires duplication of JexlEngine )
> Array literals are considered constant even when they are not
> -------------------------------------------------------------
>
> Key: JEXL-105
> URL: https://issues.apache.org/jira/browse/JEXL-105
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.0.1
> Environment: JDK 1.6 SE on Windows XP
> Reporter: Cary Thompson
> Assignee: Henri Biestro
> Fix For: 2.0.2
>
>
> JexlContext context = new MapContext();
> Expression selectExp = new JexlEngine().createExpression("[a.propA]");
> context.set("a", new A("a1", "p1"));
> System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));
> -->[p1]
> //selectExp = new JexlEngine().createExpression("[a.propA]");
> context.set("a", new A("a2", "p2"));
> System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));
> --> [p1] correct answer should be [p2]
> // A's class definition
> public class A {
> String nameA;
>
> String propA;
> public A(String nameA, String propA) {
> this.nameA = nameA;
> this.propA = propA;
> }
> @Override
> public String toString() {
> return "A [nameA=" + nameA + ", propA=" + propA + "]";
> }
> public String getNameA() {
> return nameA;
> }
> public String getPropA() {
> return propA;
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] [Closed] (JEXL-105) Array literals are considered constant
even when they are not
Posted by "Sebb (Closed) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb closed JEXL-105.
---------------------
> Array literals are considered constant even when they are not
> -------------------------------------------------------------
>
> Key: JEXL-105
> URL: https://issues.apache.org/jira/browse/JEXL-105
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.0.1
> Environment: JDK 1.6 SE on Windows XP
> Reporter: Cary Thompson
> Assignee: Henri Biestro
> Fix For: 2.1
>
>
> JexlContext context = new MapContext();
> Expression selectExp = new JexlEngine().createExpression("[a.propA]");
> context.set("a", new A("a1", "p1"));
> System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));
> -->[p1]
> //selectExp = new JexlEngine().createExpression("[a.propA]");
> context.set("a", new A("a2", "p2"));
> System.out.println(Arrays.toString((Object[])selectExp.evaluate(context)));
> --> [p1] correct answer should be [p2]
> // A's class definition
> public class A {
> String nameA;
>
> String propA;
> public A(String nameA, String propA) {
> this.nameA = nameA;
> this.propA = propA;
> }
> @Override
> public String toString() {
> return "A [nameA=" + nameA + ", propA=" + propA + "]";
> }
> public String getNameA() {
> return nameA;
> }
> public String getPropA() {
> return propA;
> }
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira