mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-18 11:14:22 +00:00
ICU-9668 Updated the spec of ULocale#equals. The modified implementation never returns true when the argument is String.
X-SVN-Rev: 32859
This commit is contained in:
parent
3688cea886
commit
63b30dc4c1
5 changed files with 5 additions and 8 deletions
|
@ -882,7 +882,7 @@ public class ICUResourceBundle extends UResourceBundle {
|
|||
if (i != -1) {
|
||||
String temp = localeName.substring(0, i);
|
||||
b = (ICUResourceBundle)instantiateBundle(baseName, temp, root, disableFallback);
|
||||
if(b!=null && b.getULocale().equals(temp)){
|
||||
if(b!=null && b.getULocale().getName().equals(temp)){
|
||||
b.setLoadingStatus(ICUResourceBundle.FROM_FALLBACK);
|
||||
}
|
||||
}else{
|
||||
|
|
|
@ -758,7 +758,7 @@ public final class ULocale implements Serializable {
|
|||
|
||||
/**
|
||||
* Returns true if the other object is another ULocale with the
|
||||
* same full name, or is a String localeID that matches the full name.
|
||||
* same full name.
|
||||
* Note that since names are not canonicalized, two ULocales that
|
||||
* function identically might not compare equal.
|
||||
*
|
||||
|
@ -769,9 +769,6 @@ public final class ULocale implements Serializable {
|
|||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj instanceof String) {
|
||||
return localeID.equals((String)obj);
|
||||
}
|
||||
if (obj instanceof ULocale) {
|
||||
return localeID.equals(((ULocale)obj).localeID);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public final class ICUResourceBundleCollationTest extends TestFmwk {
|
|||
try{
|
||||
bundle = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_COLLATION_BASE_NAME,ULocale.canonicalize("de__PHONEBOOK"));
|
||||
|
||||
if(!bundle.getULocale().equals("de")){
|
||||
if(!bundle.getULocale().getName().equals("de")){
|
||||
errln("did not get the expected bundle");
|
||||
}
|
||||
key = bundle.getStringWithFallback("collations/collation/default");
|
||||
|
|
|
@ -92,7 +92,7 @@ public final class ICUResourceBundleTest extends TestFmwk {
|
|||
}
|
||||
|
||||
bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "bogus");
|
||||
if(bundle instanceof UResourceBundle && bundle.getULocale().equals("en_US")){
|
||||
if(bundle instanceof UResourceBundle && bundle.getULocale().getName().equals("en_US")){
|
||||
logln("wrapper mechanism works for bogus locale");
|
||||
}else{
|
||||
errln("wrapper mechanism failed for bogus locale.");
|
||||
|
|
|
@ -960,7 +960,7 @@ public class ULocaleTest extends TestFmwk {
|
|||
if(locales.length<10){
|
||||
errln("Did not get the correct result from getAvailableLocales");
|
||||
}
|
||||
if(!locales[locales.length-1].equals("zu_ZA")){
|
||||
if(!locales[locales.length-1].getName().equals("zu_ZA")){
|
||||
errln("Did not get the expected result");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue