mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-17 18:56:53 +00:00
ICU-10918 Moved the code reading an ICU configuration property out of DecimalFormat#subparse to static initializer. The configuration is no longer dynamic, so the corresponding test case was also updated.
X-SVN-Rev: 35773
This commit is contained in:
parent
56d72817df
commit
b5aa742648
2 changed files with 21 additions and 22 deletions
|
@ -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 :
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue