* @stable ICU 3.0
*/
public static synchronized void setDefault(ULocale newLocale){
- Locale.setDefault(newLocale.toLocale());
+ defaultLocale = newLocale.toLocale();
+ Locale.setDefault(defaultLocale);
defaultULocale = newLocale;
// This method also updates all category default locales
for (Category cat : Category.values()) {
*/
public void TestJavaLocaleCompatibility() {
Locale backupDefault = Locale.getDefault();
+ ULocale orgUlocDefault = ULocale.getDefault();
// Java Locale for ja_JP with Japanese calendar
Locale jaJPJP = new Locale("ja", "JP", "JP");
errln("FAIL: ULocale#setDefault failed to set Java Locale no_NO_NY /actual: " + Locale.getDefault());
}
Locale.setDefault(backupDefault);
+
+ // Make sure default ULocale is restored
+ if (!ULocale.getDefault().equals(orgUlocDefault)) {
+ errln("FAIL: Original default ULocale is not restored - " + ULocale.getDefault() + ", expected(orginal) - " + orgUlocDefault);
+ }
}
// ================= Infrastructure =================