commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Haufler (JIRA)" <j...@apache.org>
Subject [jira] Updated: (JEXL-104) NPE in JexlArithmetic when an Array-Expression containing a null is used.
Date Wed, 11 Aug 2010 10:09:17 GMT

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

Andreas Haufler updated JEXL-104:
---------------------------------

    Attachment: JexlArithmeticBug.java
                FixedJexlArithmetic.java

First file shows the bug. The second file is a suggested fix, BUT it is just a give re-write
of the original code. I'm not too deep into reflection with arrays and all that so the original
author might want to take a look at it and might apply a better fix.

> NPE in JexlArithmetic when an Array-Expression containing a null is used.
> -------------------------------------------------------------------------
>
>                 Key: JEXL-104
>                 URL: https://issues.apache.org/jira/browse/JEXL-104
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 2.0.1
>            Reporter: Andreas Haufler
>         Attachments: FixedJexlArithmetic.java, JexlArithmeticBug.java
>
>
> 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.

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


Mime
View raw message