You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2019/01/25 20:43:09 UTC

[freemarker] 01/02: Extended big decimal format parameter "multiplier" was incorrectly written as "multipier". Now both words are recognized.

This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch 2.3-gae
in repository https://gitbox.apache.org/repos/asf/freemarker.git

commit 3c8f10bee02011f6012650af9cc5e4bb6a845af8
Author: ddekany <dd...@apache.org>
AuthorDate: Fri Jan 25 21:40:44 2019 +0100

    Extended big decimal format parameter "multiplier" was incorrectly written as "multipier". Now both words are recognized.
---
 .../java/freemarker/core/ExtendedDecimalFormatParser.java | 15 +++++++++------
 src/manual/en_US/book.xml                                 |  6 ++++++
 .../java/freemarker/core/ExtendedDecimalFormatTest.java   |  4 +++-
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/main/java/freemarker/core/ExtendedDecimalFormatParser.java b/src/main/java/freemarker/core/ExtendedDecimalFormatParser.java
index 0c3286a..03d71eb 100644
--- a/src/main/java/freemarker/core/ExtendedDecimalFormatParser.java
+++ b/src/main/java/freemarker/core/ExtendedDecimalFormatParser.java
@@ -34,6 +34,7 @@ class ExtendedDecimalFormatParser {
     
     private static final String PARAM_ROUNDING_MODE = "roundingMode";
     private static final String PARAM_MULTIPIER = "multipier";
+    private static final String PARAM_MULTIPLIER = "multiplier";
     private static final String PARAM_DECIMAL_SEPARATOR = "decimalSeparator";
     private static final String PARAM_MONETARY_DECIMAL_SEPARATOR = "monetaryDecimalSeparator";
     private static final String PARAM_GROUP_SEPARATOR = "groupingSeparator";
@@ -93,16 +94,18 @@ class ExtendedDecimalFormatParser {
                 parser.roundingMode = parsedValue;
             }
         });
-        m.put(PARAM_MULTIPIER, new ParameterHandler() {
+        ParameterHandler multiplierParamHandler = new ParameterHandler() {
             public void handle(ExtendedDecimalFormatParser parser, String value)
                     throws InvalidParameterValueException {
                 try {
-                    parser.multipier = Integer.valueOf(value);
+                    parser.multiplier = Integer.valueOf(value);
                 } catch (NumberFormatException e) {
                     throw new InvalidParameterValueException("Malformed integer.");
                 }
             }
-        });
+        };
+        m.put(PARAM_MULTIPLIER, multiplierParamHandler);
+        m.put(PARAM_MULTIPIER, multiplierParamHandler);
         m.put(PARAM_DECIMAL_SEPARATOR, new ParameterHandler() {
             public void handle(ExtendedDecimalFormatParser parser, String value)
                     throws InvalidParameterValueException {
@@ -211,7 +214,7 @@ class ExtendedDecimalFormatParser {
 
     private final DecimalFormatSymbols symbols;
     private RoundingMode roundingMode;
-    private Integer multipier;
+    private Integer multiplier;
 
     static DecimalFormat parse(String formatString, Locale locale) throws ParseException {
         return new ExtendedDecimalFormatParser(formatString, locale).parse();
@@ -244,8 +247,8 @@ class ExtendedDecimalFormatParser {
             _JavaVersions.JAVA_6.setRoundingMode(decimalFormat, roundingMode);
         }
 
-        if (multipier != null) {
-            decimalFormat.setMultiplier(multipier.intValue());
+        if (multiplier != null) {
+            decimalFormat.setMultiplier(multiplier.intValue());
         }
 
         return decimalFormat;
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 38cd1f0..161b52c 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -27893,6 +27893,12 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
               configuration. See <link linkend="ref_builtin_truncate">the
               reference</link> for more details.</para>
             </listitem>
+
+            <listitem>
+              <para>Extended big decimal format parameter
+              <quote>multiplier</quote> was incorrectly written as
+              <quote>multipier</quote>. Now both words are recognized.</para>
+            </listitem>
           </itemizedlist>
         </section>
 
diff --git a/src/test/java/freemarker/core/ExtendedDecimalFormatTest.java b/src/test/java/freemarker/core/ExtendedDecimalFormatTest.java
index 17a699e..04b86d3 100644
--- a/src/test/java/freemarker/core/ExtendedDecimalFormatTest.java
+++ b/src/test/java/freemarker/core/ExtendedDecimalFormatTest.java
@@ -225,7 +225,9 @@ public class ExtendedDecimalFormatTest extends TemplateTest {
 
         assertFormatted("0.##;; multipier=100", 12.345, "1234.5");
         assertFormatted("0.##;; multipier=1000", 12.345, "12345");
-        
+        assertFormatted("0.##;; multiplier=100", 12.345, "1234.5");
+        assertFormatted("0.##;; multiplier=1000", 12.345, "12345");
+
         assertFormatted(",##0.##;; groupingSeparator=_ decimalSeparator=D", 12345.1, "12_345D1", 1, "1");
         
         assertFormatted("0.##E0;; exponentSeparator='*10^'", 12345.1, "1.23*10^4");