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

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Gary D. Gregory (Jira)
Kennard Consulting created JEXL-138:
---------------------------------------

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

       
Reply | Threaded
Open this post in threaded view
|

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

Gary D. Gregory (Jira)

     [ 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

       
Reply | Threaded
Open this post in threaded view
|

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

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

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

Kennard Consulting updated JEXL-138:
------------------------------------

    Description:
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.

  was:
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";
                }
        }
---

   

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

       
Reply | Threaded
Open this post in threaded view
|

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

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

     [ 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

       
Reply | Threaded
Open this post in threaded view
|

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

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/JEXL-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13414217#comment-13414217 ]

Kennard Consulting commented on JEXL-138:
-----------------------------------------

Terrific! Thanks Henri. I look forward to the next release.
               

> 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