You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Antonio Agudo (Created) (JIRA)" <ji...@apache.org> on 2012/02/08 15:31:59 UTC
[jira] [Created] (JEXL-129) Inner type attributes cannot be
resolved in expressions
Inner type attributes cannot be resolved in expressions
-------------------------------------------------------
Key: JEXL-129
URL: https://issues.apache.org/jira/browse/JEXL-129
Project: Commons JEXL
Issue Type: Bug
Affects Versions: 2.1.1
Environment: JDK 6
Reporter: Antonio Agudo
When using inner types e.g. for unit tests, it is impossible to resolve bean attributes from beans that are otherwise available in the JexlContext. I don't know about the implications for real world systems, but in testing this can be a pain.
Junit Example:
package test;
import org.apache.commons.jexl2.Expression;
import org.apache.commons.jexl2.JexlContext;
import org.apache.commons.jexl2.JexlEngine;
import org.apache.commons.jexl2.MapContext;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
public class TestJEXL {
@Test
public void test() {
JexlEngine jexl = new JexlEngine();
Expression exp = jexl.createExpression("b.i + b.i");
FakeBean b = new FakeBean();
JexlContext jc = new MapContext();
jc.set("b", b);
Object results = exp.evaluate(jc);
System.out.println(results);
assertEquals("10",results);
}
private static class FakeBean {
private int i = 10;
private String key = "myval";
public int getI() {
return i;
}
public void setI(int i) {
this.i = i;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
}
--
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
[jira] [Updated] (JEXL-129) Inner type attributes cannot be
resolved in expressions
Posted by "Antonio Agudo (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Antonio Agudo updated JEXL-129:
-------------------------------
Description:
When using inner types e.g. for unit tests, it is impossible to resolve bean attributes from beans that are otherwise available in the JexlContext. I don't know about the implications for real world systems, but in testing this can be a pain.
Junit Example:
package test;
import org.apache.commons.jexl2.Expression;
import org.apache.commons.jexl2.JexlContext;
import org.apache.commons.jexl2.JexlEngine;
import org.apache.commons.jexl2.MapContext;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
public class TestJEXL {
@Test
public void test() {
JexlEngine jexl = new JexlEngine();
Expression exp = jexl.createExpression("b.i + b.i");
FakeBean b = new FakeBean();
JexlContext jc = new MapContext();
jc.set("b", b);
Object results = exp.evaluate(jc);
System.out.println(results);
assertEquals(20,results);
}
private static class FakeBean {
private int i = 10;
private String key = "myval";
public int getI() {
return i;
}
public void setI(int i) {
this.i = i;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
}
was:
When using inner types e.g. for unit tests, it is impossible to resolve bean attributes from beans that are otherwise available in the JexlContext. I don't know about the implications for real world systems, but in testing this can be a pain.
Junit Example:
package test;
import org.apache.commons.jexl2.Expression;
import org.apache.commons.jexl2.JexlContext;
import org.apache.commons.jexl2.JexlEngine;
import org.apache.commons.jexl2.MapContext;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
public class TestJEXL {
@Test
public void test() {
JexlEngine jexl = new JexlEngine();
Expression exp = jexl.createExpression("b.i + b.i");
FakeBean b = new FakeBean();
JexlContext jc = new MapContext();
jc.set("b", b);
Object results = exp.evaluate(jc);
System.out.println(results);
assertEquals("20",results);
}
private static class FakeBean {
private int i = 10;
private String key = "myval";
public int getI() {
return i;
}
public void setI(int i) {
this.i = i;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
}
> Inner type attributes cannot be resolved in expressions
> -------------------------------------------------------
>
> Key: JEXL-129
> URL: https://issues.apache.org/jira/browse/JEXL-129
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1.1
> Environment: JDK 6
> Reporter: Antonio Agudo
>
> When using inner types e.g. for unit tests, it is impossible to resolve bean attributes from beans that are otherwise available in the JexlContext. I don't know about the implications for real world systems, but in testing this can be a pain.
> Junit Example:
> package test;
> import org.apache.commons.jexl2.Expression;
> import org.apache.commons.jexl2.JexlContext;
> import org.apache.commons.jexl2.JexlEngine;
> import org.apache.commons.jexl2.MapContext;
> import org.junit.Test;
> import static junit.framework.Assert.assertEquals;
> public class TestJEXL {
> @Test
> public void test() {
> JexlEngine jexl = new JexlEngine();
> Expression exp = jexl.createExpression("b.i + b.i");
> FakeBean b = new FakeBean();
> JexlContext jc = new MapContext();
> jc.set("b", b);
> Object results = exp.evaluate(jc);
> System.out.println(results);
> assertEquals(20,results);
> }
> private static class FakeBean {
> private int i = 10;
> private String key = "myval";
> public int getI() {
> return i;
> }
> public void setI(int i) {
> this.i = i;
> }
> public String getKey() {
> return key;
> }
> public void setKey(String key) {
> this.key = key;
> }
> }
> }
--
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
[jira] [Commented] (JEXL-129) Inner type attributes cannot be
resolved in expressions
Posted by "Joerg Schaible (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13203661#comment-13203661 ]
Joerg Schaible commented on JEXL-129:
-------------------------------------
The class is private, therefore reflection fails. It does not matter that the methods itself are public.
> Inner type attributes cannot be resolved in expressions
> -------------------------------------------------------
>
> Key: JEXL-129
> URL: https://issues.apache.org/jira/browse/JEXL-129
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1.1
> Environment: JDK 6
> Reporter: Antonio Agudo
>
> When using inner types e.g. for unit tests, it is impossible to resolve bean attributes from beans that are otherwise available in the JexlContext. I don't know about the implications for real world systems, but in testing this can be a pain.
> Junit Example:
> package test;
> import org.apache.commons.jexl2.Expression;
> import org.apache.commons.jexl2.JexlContext;
> import org.apache.commons.jexl2.JexlEngine;
> import org.apache.commons.jexl2.MapContext;
> import org.junit.Test;
> import static junit.framework.Assert.assertEquals;
> public class TestJEXL {
> @Test
> public void test() {
> JexlEngine jexl = new JexlEngine();
> Expression exp = jexl.createExpression("b.i + b.i");
> FakeBean b = new FakeBean();
> JexlContext jc = new MapContext();
> jc.set("b", b);
> Object results = exp.evaluate(jc);
> System.out.println(results);
> assertEquals(20,results);
> }
> private static class FakeBean {
> private int i = 10;
> private String key = "myval";
> public int getI() {
> return i;
> }
> public void setI(int i) {
> this.i = i;
> }
> public String getKey() {
> return key;
> }
> public void setKey(String key) {
> this.key = key;
> }
> }
> }
--
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
[jira] [Resolved] (JEXL-129) Inner type attributes cannot be
resolved in expressions
Posted by "Henri Biestro (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro resolved JEXL-129.
--------------------------------
Resolution: Won't Fix
Fix Version/s: 2.1.1
Assignee: Henri Biestro
As Joerg described, private classes/fields are not accessible to reflection thus can not be called through JEXL.
It would be too dangerous/insecure to call setAccessible and/or use a very liberal security policy (ReflectPermission. suppressAccessChecks).
> Inner type attributes cannot be resolved in expressions
> -------------------------------------------------------
>
> Key: JEXL-129
> URL: https://issues.apache.org/jira/browse/JEXL-129
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1.1
> Environment: JDK 6
> Reporter: Antonio Agudo
> Assignee: Henri Biestro
> Fix For: 2.1.1
>
>
> When using inner types e.g. for unit tests, it is impossible to resolve bean attributes from beans that are otherwise available in the JexlContext. I don't know about the implications for real world systems, but in testing this can be a pain.
> Junit Example:
> package test;
> import org.apache.commons.jexl2.Expression;
> import org.apache.commons.jexl2.JexlContext;
> import org.apache.commons.jexl2.JexlEngine;
> import org.apache.commons.jexl2.MapContext;
> import org.junit.Test;
> import static junit.framework.Assert.assertEquals;
> public class TestJEXL {
> @Test
> public void test() {
> JexlEngine jexl = new JexlEngine();
> Expression exp = jexl.createExpression("b.i + b.i");
> FakeBean b = new FakeBean();
> JexlContext jc = new MapContext();
> jc.set("b", b);
> Object results = exp.evaluate(jc);
> System.out.println(results);
> assertEquals(20,results);
> }
> private static class FakeBean {
> private int i = 10;
> private String key = "myval";
> public int getI() {
> return i;
> }
> public void setI(int i) {
> this.i = i;
> }
> public String getKey() {
> return key;
> }
> public void setKey(String key) {
> this.key = key;
> }
> }
> }
--
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
[jira] [Updated] (JEXL-129) Inner type attributes cannot be
resolved in expressions
Posted by "Antonio Agudo (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Antonio Agudo updated JEXL-129:
-------------------------------
Description:
When using inner types e.g. for unit tests, it is impossible to resolve bean attributes from beans that are otherwise available in the JexlContext. I don't know about the implications for real world systems, but in testing this can be a pain.
Junit Example:
package test;
import org.apache.commons.jexl2.Expression;
import org.apache.commons.jexl2.JexlContext;
import org.apache.commons.jexl2.JexlEngine;
import org.apache.commons.jexl2.MapContext;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
public class TestJEXL {
@Test
public void test() {
JexlEngine jexl = new JexlEngine();
Expression exp = jexl.createExpression("b.i + b.i");
FakeBean b = new FakeBean();
JexlContext jc = new MapContext();
jc.set("b", b);
Object results = exp.evaluate(jc);
System.out.println(results);
assertEquals("20",results);
}
private static class FakeBean {
private int i = 10;
private String key = "myval";
public int getI() {
return i;
}
public void setI(int i) {
this.i = i;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
}
was:
When using inner types e.g. for unit tests, it is impossible to resolve bean attributes from beans that are otherwise available in the JexlContext. I don't know about the implications for real world systems, but in testing this can be a pain.
Junit Example:
package test;
import org.apache.commons.jexl2.Expression;
import org.apache.commons.jexl2.JexlContext;
import org.apache.commons.jexl2.JexlEngine;
import org.apache.commons.jexl2.MapContext;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
public class TestJEXL {
@Test
public void test() {
JexlEngine jexl = new JexlEngine();
Expression exp = jexl.createExpression("b.i + b.i");
FakeBean b = new FakeBean();
JexlContext jc = new MapContext();
jc.set("b", b);
Object results = exp.evaluate(jc);
System.out.println(results);
assertEquals("10",results);
}
private static class FakeBean {
private int i = 10;
private String key = "myval";
public int getI() {
return i;
}
public void setI(int i) {
this.i = i;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
}
> Inner type attributes cannot be resolved in expressions
> -------------------------------------------------------
>
> Key: JEXL-129
> URL: https://issues.apache.org/jira/browse/JEXL-129
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1.1
> Environment: JDK 6
> Reporter: Antonio Agudo
>
> When using inner types e.g. for unit tests, it is impossible to resolve bean attributes from beans that are otherwise available in the JexlContext. I don't know about the implications for real world systems, but in testing this can be a pain.
> Junit Example:
> package test;
> import org.apache.commons.jexl2.Expression;
> import org.apache.commons.jexl2.JexlContext;
> import org.apache.commons.jexl2.JexlEngine;
> import org.apache.commons.jexl2.MapContext;
> import org.junit.Test;
> import static junit.framework.Assert.assertEquals;
> public class TestJEXL {
> @Test
> public void test() {
> JexlEngine jexl = new JexlEngine();
> Expression exp = jexl.createExpression("b.i + b.i");
> FakeBean b = new FakeBean();
> JexlContext jc = new MapContext();
> jc.set("b", b);
> Object results = exp.evaluate(jc);
> System.out.println(results);
> assertEquals("20",results);
> }
> private static class FakeBean {
> private int i = 10;
> private String key = "myval";
> public int getI() {
> return i;
> }
> public void setI(int i) {
> this.i = i;
> }
> public String getKey() {
> return key;
> }
> public void setKey(String key) {
> this.key = key;
> }
> }
> }
--
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