Richard Tomlinson created JEXL-183:
--------------------------------------

             Summary: Array parsing gives inconsistent results when no data 
present
                 Key: JEXL-183
                 URL: https://issues.apache.org/jira/browse/JEXL-183
             Project: Commons JEXL
          Issue Type: Bug
    Affects Versions: 2.1.1
            Reporter: Richard Tomlinson


Create expression and execute with a result of false:   foo.0 == "Napa"
Same expression with [] tries to evaluate "Napa" as numeric so a 
NumberFormatException is thrown for:  foo[0] == "Napa"

java.lang.NumberFormatException: For input string: "Napa"
        at 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Long.parseLong(Long.java:441)
        at java.lang.Long.parseLong(Long.java:483)
        at 
org.apache.commons.jexl2.JexlArithmetic.toLong(JexlArithmetic.java:906)
        at 
org.apache.commons.jexl2.JexlArithmetic.compare(JexlArithmetic.java:719)
        at 
org.apache.commons.jexl2.JexlArithmetic.equals(JexlArithmetic.java:759)
        at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1198)
        at 
org.apache.commons.jexl2.parser.ASTNENode.jjtAccept(ASTNENode.java:18)
        at org.apache.commons.jexl2.Interpreter.interpret(Interpreter.java:232)
        at 
org.apache.commons.jexl2.ExpressionImpl.evaluate(ExpressionImpl.java:65)






--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to