Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 96475 invoked from network); 28 Oct 2007 10:13:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Oct 2007 10:13:15 -0000 Received: (qmail 78898 invoked by uid 500); 28 Oct 2007 10:13:01 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 78826 invoked by uid 500); 28 Oct 2007 10:13:01 -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 78817 invoked by uid 99); 28 Oct 2007 10:13:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Oct 2007 03:13:01 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Oct 2007 10:13:18 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9C60571422E for ; Sun, 28 Oct 2007 03:12:50 -0700 (PDT) Message-ID: <80698.1193566370630.JavaMail.jira@brutus> Date: Sun, 28 Oct 2007 03:12:50 -0700 (PDT) From: "dion gillard (JIRA)" To: issues@commons.apache.org Subject: [jira] Resolved: (JEXL-30) ASTAddNode does not add BigDecimal objects correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/JEXL-30?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] dion gillard resolved JEXL-30. ------------------------------ Resolution: Fixed committed to rev 589320 as part of 2.0 branch > ASTAddNode does not add BigDecimal objects correctly > ---------------------------------------------------- > > Key: JEXL-30 > URL: https://issues.apache.org/jira/browse/JEXL-30 > Project: Commons JEXL > Issue Type: Bug > Affects Versions: 1.1 > Environment: All > Reporter: Curtis Stanford > Fix For: 2.0 > > > The ASTAddNode only checks for Float or Double objects when adding floating point numbers. If the objects are not Float or Double, they are added as Long's. As a result, adding BigDecimal objects loses any existing decimal points. > Untested patch: > Index: ASTAddNode.java > =================================================================== > --- ASTAddNode.java (revision 476204) > +++ ASTAddNode.java (working copy) > @@ -16,6 +16,8 @@ > > package org.apache.commons.jexl.parser; > > +import java.math.BigDecimal; > + > import org.apache.commons.jexl.JexlContext; > import org.apache.commons.jexl.util.Coercion; > > @@ -71,8 +73,8 @@ > * if anything is float, double or string with ( "." | "E" | "e") > * coerce all to doubles and do it > */ > - if (left instanceof Float || left instanceof Double > - || right instanceof Float || right instanceof Double > + if (left instanceof Float || left instanceof Double || left instanceof BigDecimal > + || right instanceof Float || right instanceof Double || right instanceof BigDecimal > || (left instanceof String > && (((String) left).indexOf(".") != -1 > || ((String) left).indexOf("e") != -1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.