ICU-8787 Mering the fix for #8734, which was missed in ICU4J 4.8.1.1 release. See ticket#8925.

X-SVN-Rev: 30932
This commit is contained in:
Yoshito Umaoka 2011-11-04 20:02:08 +00:00
parent 54d529cd2d
commit 5a0cab78aa

View file

@ -548,6 +548,17 @@ public final class ULocale implements Serializable {
*/
public static ULocale getDefault() {
synchronized (ULocale.class) {
if (defaultULocale == null) {
// When Java's default locale has extensions (such as ja-JP-u-ca-japanese),
// Locale -> ULocale mapping requires BCP47 keyword mapping data that is currently
// stored in a resource bundle. However, UResourceBundle currently requires
// non-null default ULocale. For now, this implementation returns ULocale.ROOT
// to avoid the problem.
// TODO: Consider moving BCP47 mapping data out of resource bundle later.
return ULocale.ROOT;
}
Locale currentDefault = Locale.getDefault();
if (!defaultLocale.equals(currentDefault)) {
defaultLocale = currentDefault;