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

NPE in JexlArithmetic when an Array-Expression containing a null is used.

    Details

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

      Description

      When using the Array-Expression like [x, y, z] a NPE occurs when one of the array elements is null.

      Example:

      import org.apache.commons.jexl2.Expression;
      import org.apache.commons.jexl2.JexlEngine;
      import org.apache.commons.jexl2.MapContext;

      public class JexlArithmeticBug {
      public static void main(String[] args)

      { JexlEngine engine = new JexlEngine(); String jexlExp = "[null, null]"; Expression e = engine.createExpression(jexlExp); System.out.println(e.evaluate(new MapContext())); }

      }

      As one can see in the Stacktrace, JexlArithmetic.narrowArrayType doesn't expect null values at all.

        Attachments

        1. FixedJexlArithmetic.java
          2 kB
          Andreas Haufler
        2. JexlArithmeticBug.java
          0.4 kB
          Andreas Haufler

          Activity

            People

            • Assignee:
              henrib Henri Biestro
              Reporter:
              aha@scireum.de Andreas Haufler
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: