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

freish commented on JEXL-132:
-----------------------------

Thank you for reply.This is a big help!
                
> divide zero error and others
> ----------------------------
>
>                 Key: JEXL-132
>                 URL: https://issues.apache.org/jira/browse/JEXL-132
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 2.1.1
>         Environment: JEXL2.1.1 jdk1.5.0_22
>            Reporter: freish
>              Labels: jexl
>
> code snippet:
>               String exp;
>               Expression expression;
>               JexlEngine engine = new JexlEngine();
>               
>               exp = "1/0";
>               expression = engine.createExpression(exp);
>               System.out.println(expression.evaluate(null));
> this will print 0.0,shoud it indicate an error by throwing exception or 
> return value?
> ----------------------------------------------
> code snippet:
>               exp = "1/0.0";
>               expression = engine.createExpression(exp);
>               System.out.println(expression.evaluate(null));
> this will print 0.0 too,but in fact it should return Infinity.
> ----------------------------------------------
> code snippet:
>               exp = "Math.abs(-1)";
>               expression = engine.createExpression(exp);
>               System.out.println(expression.evaluate(null));
> I don't know whether this is a bug.JEXL cannot invoke java static method 
> directly,it will throw an exception
> ----------------------------------------------
> code snippet:
>               exp = "a.abs(-1)";
>               class MyMath {
>                       public double abs(double d) {
>                               return Math.abs(d);
>                       } 
>               }
>               Object obj = new MyMath();
>               expression = engine.createExpression(exp);
>               MapContext c = new MapContext();
>               c.set("a", obj);
>               System.out.println(expression.evaluate(c));
> er,this is very strange,if MyMath is not public(whether in a independent file 
> or not),it will return null;but if MyMath is a public class,it will behave 
> correctly

--
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 via email to