mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-06 22:15:31 +00:00
ICU-8630 Follow up fix - ULocale#setDefault(ULocale) to synchronize default Locale properly.
X-SVN-Rev: 30549
This commit is contained in:
parent
3ca1e00e84
commit
02375bb109
2 changed files with 8 additions and 1 deletions
|
@ -597,7 +597,8 @@ public final class ULocale implements Serializable {
|
|||
* @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()) {
|
||||
|
|
|
@ -194,6 +194,7 @@ public class ULocaleTest extends TestFmwk {
|
|||
*/
|
||||
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");
|
||||
|
@ -289,6 +290,11 @@ public class ULocaleTest extends TestFmwk {
|
|||
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 =================
|
||||
|
|
Loading…
Add table
Reference in a new issue