-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
8
-
x86_64
-
windows_7
FULL PRODUCT VERSION :
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [çæ¬ 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Exception is thrown when "-Djava.locale.providers=CLDR" is specified for certain DecimalFormat and NumberFormat operations.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Download icu4j-51_1.jar and icu4j-localespi-51_1.jar via following URL
http://download.icu-project.org/files/icu4j/51.1/
2. Create ext directory and put downloaded files into ext directory
3. Compile and run testcase (the test case is in "Source code section" with following options
$ java -Djava.ext.dirs=$PWD/ext -Djava.locale.providers=CLDR NumberFormatTest
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No exception is thrown.
ACTUAL -
Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name sun.util.cldr.CLDRLocaleDataMetaInfo, locale
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:845)
at sun.util.cldr.CLDRLocaleProviderAdapter.createLanguageTagSet(CLDRLocaleProviderAdapter.java:104)
at sun.util.locale.provider.JRELocaleProviderAdapter.getLanguageTagSet(JRELocaleProviderAdapter.java:348)
at sun.util.locale.provider.JRELocaleProviderAdapter.getNumberFormatProvider(JRELocaleProviderAdapter.java:206)
at sun.util.locale.provider.JRELocaleProviderAdapter.getLocaleServiceProvider(JRELocaleProviderAdapter.java:97)
at sun.util.locale.provider.LocaleProviderAdapter.findAdapter(LocaleProviderAdapter.java:284)
at sun.util.locale.provider.LocaleProviderAdapter.getAdapter(LocaleProviderAdapter.java:254)
at java.text.NumberFormat.getInstance(NumberFormat.java:859)
at java.text.NumberFormat.getInstance(NumberFormat.java:429)
at NumberFormatTest.main(NumberFormatTest.java:22)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.text.*;
import java.util.*;
public class NumberFormatTest {
static void println(String s) {
StringBuffer sb = new StringBuffer();
for (char c : s.toCharArray()) {
if ('\\' == c) {
sb.append("\\\\");
} else if (c >= 0x20 && c <= 0x7E) {
sb.append(c);
} else {
sb.append(String.format("\\u%04X", (int) c));
}
}
System.out.println(sb.toString());
}
public static void main(String[] args) {
DecimalFormat df = (DecimalFormat) NumberFormat.getInstance();
println("General: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
df = (DecimalFormat) NumberFormat.getNumberInstance();
println("Number: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
df = (DecimalFormat) NumberFormat.getIntegerInstance();
println("Integer: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
df = (DecimalFormat) NumberFormat.getCurrencyInstance();
println("Currency: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
df = (DecimalFormat) NumberFormat.getPercentInstance();
println("Percent: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
}
}
---------- END SOURCE ----------
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [çæ¬ 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Exception is thrown when "-Djava.locale.providers=CLDR" is specified for certain DecimalFormat and NumberFormat operations.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Download icu4j-51_1.jar and icu4j-localespi-51_1.jar via following URL
http://download.icu-project.org/files/icu4j/51.1/
2. Create ext directory and put downloaded files into ext directory
3. Compile and run testcase (the test case is in "Source code section" with following options
$ java -Djava.ext.dirs=$PWD/ext -Djava.locale.providers=CLDR NumberFormatTest
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No exception is thrown.
ACTUAL -
Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name sun.util.cldr.CLDRLocaleDataMetaInfo, locale
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:845)
at sun.util.cldr.CLDRLocaleProviderAdapter.createLanguageTagSet(CLDRLocaleProviderAdapter.java:104)
at sun.util.locale.provider.JRELocaleProviderAdapter.getLanguageTagSet(JRELocaleProviderAdapter.java:348)
at sun.util.locale.provider.JRELocaleProviderAdapter.getNumberFormatProvider(JRELocaleProviderAdapter.java:206)
at sun.util.locale.provider.JRELocaleProviderAdapter.getLocaleServiceProvider(JRELocaleProviderAdapter.java:97)
at sun.util.locale.provider.LocaleProviderAdapter.findAdapter(LocaleProviderAdapter.java:284)
at sun.util.locale.provider.LocaleProviderAdapter.getAdapter(LocaleProviderAdapter.java:254)
at java.text.NumberFormat.getInstance(NumberFormat.java:859)
at java.text.NumberFormat.getInstance(NumberFormat.java:429)
at NumberFormatTest.main(NumberFormatTest.java:22)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.text.*;
import java.util.*;
public class NumberFormatTest {
static void println(String s) {
StringBuffer sb = new StringBuffer();
for (char c : s.toCharArray()) {
if ('\\' == c) {
sb.append("\\\\");
} else if (c >= 0x20 && c <= 0x7E) {
sb.append(c);
} else {
sb.append(String.format("\\u%04X", (int) c));
}
}
System.out.println(sb.toString());
}
public static void main(String[] args) {
DecimalFormat df = (DecimalFormat) NumberFormat.getInstance();
println("General: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
df = (DecimalFormat) NumberFormat.getNumberInstance();
println("Number: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
df = (DecimalFormat) NumberFormat.getIntegerInstance();
println("Integer: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
df = (DecimalFormat) NumberFormat.getCurrencyInstance();
println("Currency: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
df = (DecimalFormat) NumberFormat.getPercentInstance();
println("Percent: toLocalizedPattern=" + df.toLocalizedPattern() + ", toPattern=" + df.toPattern());
}
}
---------- END SOURCE ----------