]> granicus.if.org Git - icu/commitdiff
ICU-8734 ULocale.getDefault to return ULocale.ROOT when it is called when default...
authorYoshito Umaoka <y.umaoka@gmail.com>
Thu, 28 Jul 2011 17:55:33 +0000 (17:55 +0000)
committerYoshito Umaoka <y.umaoka@gmail.com>
Thu, 28 Jul 2011 17:55:33 +0000 (17:55 +0000)
X-SVN-Rev: 30440

icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java

index ba731ea80531efb31a98acabcbd0a8d07d5aedf7..a70c980ec639e8577a12817357fb9b2c823b59d0 100644 (file)
@@ -526,6 +526,17 @@ public final class ULocale implements Serializable {
                 defaultLocale = currentDefault;
                 defaultULocale = new ULocale(defaultLocale);
             }
+            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;
+            }
             return defaultULocale;
         }
     }