Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 46576 invoked from network); 11 Aug 2010 10:09:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 11 Aug 2010 10:09:41 -0000 Received: (qmail 42698 invoked by uid 500); 11 Aug 2010 10:09:41 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 42514 invoked by uid 500); 11 Aug 2010 10:09:38 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 42496 invoked by uid 99); 11 Aug 2010 10:09:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Aug 2010 10:09:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Aug 2010 10:09:37 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o7BA9Hnq008484 for ; Wed, 11 Aug 2010 10:09:17 GMT Message-ID: <32240491.272941281521357094.JavaMail.jira@thor> Date: Wed, 11 Aug 2010 06:09:17 -0400 (EDT) From: "Andreas Haufler (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (JEXL-104) NPE in JexlArithmetic when an Array-Expression containing a null is used. In-Reply-To: <27031247.272901281521117883.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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.