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 2012/07/12 15:44:34 UTC

[jira] [Resolved] (JEXL-138) Erroneous "inaccessible or unknown property" warning

     [ https://issues.apache.org/jira/browse/JEXL-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Biestro resolved JEXL-138.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 3.0
                   2.1.2
         Assignee: Henri Biestro

Hello Richard;
I've difficulties reproducing your exact test case but the bug does exist in 2.1.1 with the engine in strict mode.
It can not be reproduced in 2.1.2 (since Interpreter.java version 1332806) and 3.0 source code.
{code}
    @Test
    public void testInaccessibleProperty() throws Exception {
        JexlEngine engine = new JexlEngine(); // 1332806
        engine.setStrict(true);
        JexlContext context = new MapContext();
        context.set("foo", new Foo138());
        Assert.assertEquals("baz", engine.createExpression("foo.baz").evaluate(context));
        Assert.assertEquals(null, engine.createExpression("foo.bar").evaluate(context));
    }

    //
    // Inner class
    //
    public static class Foo138 {
        public String getBar() {
            return null;
        }

        public String getBaz() {
            return "baz";
        }
    }
{code}
                
> 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
>            Assignee: Henri Biestro
>             Fix For: 2.1.2, 3.0
>
>         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.
> Please see the attached test case. JEXL reports:
> {{'foo.bar;' inaccessible or unknown property foo}}
> But foo is clearly an accessible and known property because it is accessed directly 2 lines above, and 1 line above we access 'foo.baz' which works without error.
> The difference seems to be that getBaz() returns "baz" whereas getBar() returns null.

--
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