ICU-8383 Fixed the locale field truncation problem in ULocale.forLocale(Locale).

X-SVN-Rev: 29495
This commit is contained in:
Yoshito Umaoka 2011-03-01 07:07:20 +00:00
parent 6b7bfaa8cc
commit 82e0351c46
2 changed files with 3 additions and 2 deletions

View File

@ -3704,7 +3704,7 @@ public final class ULocale implements Serializable {
}
}
return new ULocale(buf.toString());
return new ULocale(getName(buf.toString()), loc);
}
private ULocale toULocale6(Locale loc) {
@ -3721,7 +3721,7 @@ public final class ULocale implements Serializable {
break;
}
}
uloc = new ULocale(locStr, loc);
uloc = new ULocale(getName(locStr), loc);
}
return uloc;
}

View File

@ -4041,6 +4041,7 @@ public class ULocaleTest extends TestFmwk {
{new Locale("", "US"), "_US"},
{new Locale("en", "", "POSIX"), "en__POSIX"},
{new Locale("no", "NO", "NY"), "nn_NO"},
{new Locale("en", "BOGUS"), "en__BOGUS"}, // ill-formed country is mapped to variant - see #8383 and #8384
};
for (int i = 0; i < DATA.length; i++) {