]> granicus.if.org Git - icu/commitdiff
ICU-10918 Moved the code reading an ICU configuration property out of DecimalFormat...
authorYoshito Umaoka <y.umaoka@gmail.com>
Fri, 30 May 2014 14:27:29 +0000 (14:27 +0000)
committerYoshito Umaoka <y.umaoka@gmail.com>
Fri, 30 May 2014 14:27:29 +0000 (14:27 +0000)
X-SVN-Rev: 35773

icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormat.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTest.java

index c81cce54f04794547676b04b3da4e2228ad777d6..fc1ff98cc1370ccab2c6ef08c69a56149c55cab6 100644 (file)
@@ -2298,7 +2298,12 @@ public class DecimalFormat extends NumberFormat {
                 0xFB29, 0xFB29,
                 0xFE62, 0xFE62,
                 0xFF0B, 0xFF0B).freeze();
-    
+
+    // equivalent grouping and decimal support
+    static final boolean skipExtendedSeparatorParsing = ICUConfig.get(
+        "com.ibm.icu.text.DecimalFormat.SkipExtendedSeparatorParsing", "false")
+        .equals("true");
+
 
     // When parsing a number with big exponential value, it requires to transform the
     // value into a string representation to construct BigInteger instance.  We want to
@@ -2399,11 +2404,6 @@ public class DecimalFormat extends NumberFormat {
             int digitStart = position; // where did the digit start?
             int gs2 = groupingSize2 == 0 ? groupingSize : groupingSize2;
 
-            // equivalent grouping and decimal support
-            boolean skipExtendedSeparatorParsing = ICUConfig.get(
-                "com.ibm.icu.text.DecimalFormat.SkipExtendedSeparatorParsing", "false")
-                .equals("true");
-
             UnicodeSet decimalEquiv = skipExtendedSeparatorParsing ? UnicodeSet.EMPTY :
                 getEquivalentDecimals(decimal, strictParse);
             UnicodeSet groupEquiv = skipExtendedSeparatorParsing ? UnicodeSet.EMPTY :
index 5973afd1b9e0be12f22616d0c83fc9971b5315be..4f9bccc2cac00126880d2efa506f2c470a4dcd84 100644 (file)
@@ -23,6 +23,7 @@ import java.util.Locale;
 import java.util.Set;
 
 import com.ibm.icu.dev.test.TestUtil;
+import com.ibm.icu.impl.ICUConfig;
 import com.ibm.icu.impl.LocaleUtility;
 import com.ibm.icu.impl.data.ResourceReader;
 import com.ibm.icu.impl.data.TokenIterator;
@@ -3024,26 +3025,24 @@ public class NumberFormatTest extends com.ibm.icu.dev.test.TestFmwk {
 
         expect(fmt, "2\uFF61345.67", 2345.67);
 
-        // Ticket#7218
+        // Ticket#7128
         //
-        // Lenient separator parsing is enabled by default.
-        // A space character below is interpreted as a
-        // group separator, even ',' is used as grouping
-        // separator in the symbols.
         sym.setGroupingSeparator(',');
         fmt.setDecimalFormatSymbols(sym);
 
-        expect(fmt, "12 345", 12345);
-
-        // When the property SkipExtendedSeparatorParsing is true,
-        // DecimalFormat does not use the extended equivalent separator
-        // data and only uses the one in DecimalFormatSymbols.
-        System.setProperty("com.ibm.icu.text.DecimalFormat.SkipExtendedSeparatorParsing", "true");
-
-        expect(fmt, "23 456", 23);
-
-        // Set the configuration back to the default
-        System.setProperty("com.ibm.icu.text.DecimalFormat.SkipExtendedSeparatorParsing", "false");
+        String skipExtSepParse = ICUConfig.get("com.ibm.icu.text.DecimalFormat.SkipExtendedSeparatorParsing", "false");
+        if (skipExtSepParse.equals("true")) {
+            // When the property SkipExtendedSeparatorParsing is true,
+            // DecimalFormat does not use the extended equivalent separator
+            // data and only uses the one in DecimalFormatSymbols.
+            expect(fmt, "23 456", 23);
+        } else {
+            // Lenient separator parsing is enabled by default.
+            // A space character below is interpreted as a
+            // group separator, even ',' is used as grouping
+            // separator in the symbols.
+            expect(fmt, "12 345", 12345);
+        }
     }
 
     /*