You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2015/06/26 13:25:13 UTC

svn commit: r1687760 - in /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser: ASTNumberLiteral.java NumberParser.java

Author: henrib
Date: Fri Jun 26 11:25:12 2015
New Revision: 1687760

URL: http://svn.apache.org/r1687760
Log:
JEXL:
Fixing JEXL-158, using EN locale based format when stringifying a big decimal

Modified:
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/ASTNumberLiteral.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/NumberParser.java

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/ASTNumberLiteral.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/ASTNumberLiteral.java?rev=1687760&r1=1687759&r2=1687760&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/ASTNumberLiteral.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/ASTNumberLiteral.java Fri Jun 26 11:25:12 2015
@@ -16,10 +16,9 @@
  */
 package org.apache.commons.jexl3.parser;
 
-import java.text.DecimalFormat;
-
 public final class ASTNumberLiteral extends JexlNode implements JexlNode.Constant<Number> {
-   private final NumberParser nlp;
+    private final NumberParser nlp;
+
     ASTNumberLiteral(int id) {
         super(id);
         nlp = new NumberParser();
@@ -30,8 +29,6 @@ public final class ASTNumberLiteral exte
         nlp = new NumberParser();
     }
 
-    static final DecimalFormat BIGDF = new DecimalFormat("0.0b");
-
     @Override
     public String toString() {
         return nlp.toString();

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/NumberParser.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/NumberParser.java?rev=1687760&r1=1687759&r2=1687760&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/NumberParser.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/NumberParser.java Fri Jun 26 11:25:12 2015
@@ -19,15 +19,16 @@ package org.apache.commons.jexl3.parser;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
 
 public final class NumberParser {
     /** The type literal value. */
     private Number literal = null;
     /** The expected class. */
     private Class<?> clazz = null;
-
-    static final DecimalFormat BIGDF = new DecimalFormat("0.0b");
-
+    /** JEXL locale-neutral big decimal format. */
+    static final DecimalFormat BIGDF = new DecimalFormat("0.0b", new DecimalFormatSymbols(Locale.ENGLISH));
 
     @Override
     public String toString() {