Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-183

Array parsing gives inconsistent results when no data present

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 3.0
    • Labels:
      None

      Description

      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)

        Attachments

          Activity

            People

            • Assignee:
              henrib Henri Biestro
              Reporter:
              richard@sysgen.co.uk Richard Tomlinson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: