[
https://issues.apache.org/jira/browse/JEXL-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kennard Consulting updated JEXL-138:
------------------------------------
Attachment: JexlTest.java
Unit test
> Erroneous "inaccessible or unknown property" warning
> ----------------------------------------------------
>
> Key: JEXL-138
> URL: https://issues.apache.org/jira/browse/JEXL-138
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1.1
> Reporter: Kennard Consulting
> Attachments: JexlTest.java
>
>
> JEXL displays an erroneous "inaccessible or unknown property" warning when
> you try to access a property is both accessible, and known, but that happens
> to return null.
> Consider the following code:
> ---
> public void testInaccessibleProperty()
> throws Exception {
> JexlEngine engine = new JexlEngine();
> JexlContext context = new MapContext();
> context.set( "foo", new Foo() );
> // These lines okay
> System.out.println( engine.createExpression( "foo" ).evaluate(
> context ));
> System.out.println( engine.createExpression( "foo.baz"
> ).evaluate( context ));
> // This line says:
> // org.apache.commons.jexl2.Interpreter unknownVariable
> // WARNING:
> org.metawidget.example.swing.appframework.JexlTest.testInaccessibleProperty@44![0,7]:
> 'foo.bar;' inaccessible or unknown property foo
> System.out.println( engine.createExpression( "foo.bar"
> ).evaluate( context ));
> }
> public class Foo {
> public String getBar() {
> return null;
> }
> public String getBaz() {
> return "baz";
> }
> }
> ---
--
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