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

Alexey Kuznetsov updated JEXL-48:
---------------------------------

    Attachment: Main.java

To reproduce, just try this

> NPE during expression evaluation
> --------------------------------
>
>                 Key: JEXL-48
>                 URL: https://issues.apache.org/jira/browse/JEXL-48
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 1.1
>         Environment: Java 1.6.0 update 07
>            Reporter: Alexey Kuznetsov
>         Attachments: Main.java
>
>
> When we use '=' instead of '==' we'll get NullPointerException
> public class Main {
>     public static class Another {
>         private Boolean foo = true;
>         
>         
>         public Boolean foo()
>         {
>             return foo;
>         }
>         
>         public int goo()
>         {
>             return 100;
>         }
>         
>     }
>     
>     public static class Foo {
>         private Another inner;
>         
>         public Foo() {
>             inner = new Another();
>         }
>         public Another getInner()
>         {
>             return inner;
>         }
>         
>     }
>     
>     /**
>      * @param args the command line arguments
>      */
>     public static void main(String[] args) throws Exception {
>         String jexlExp = "(foo.getInner().foo() eq true) and 
> (foo.getInner().goo() = (foo.getInner().goo()+1-1))";
>         Expression e = ExpressionFactory.createExpression( jexlExp );
>         // Create a context and add data
>         JexlContext jc = JexlHelper.createContext();
>         jc.getVars().put("foo", new Foo() );
>         // Now evaluate the expression, getting the result
>         Object o = e.evaluate(jc);
>         
>         System.out.println("Result: "+o);
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to