]> granicus.if.org Git - icu/commitdiff
ICU-9668 Updated the spec of ULocale#equals. The modified implementation never return...
authorYoshito Umaoka <y.umaoka@gmail.com>
Fri, 16 Nov 2012 23:16:12 +0000 (23:16 +0000)
committerYoshito Umaoka <y.umaoka@gmail.com>
Fri, 16 Nov 2012 23:16:12 +0000 (23:16 +0000)
X-SVN-Rev: 32859

icu4j/main/classes/core/src/com/ibm/icu/impl/ICUResourceBundle.java
icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java
icu4j/main/tests/collate/src/com/ibm/icu/dev/test/util/ICUResourceBundleCollationTest.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ULocaleTest.java

index 748ec3966ba26d00bc05523a5706e2fc0b82c38b..8a681404f7c8fc5152f872a3b79fc179ccb528af 100644 (file)
@@ -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{
index f9346fcc9045987c7e9830e82601331cb6fb303c..505ae400011418d3dc9f09774764a86271762f73 100644 (file)
@@ -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);
         }
index 1d1d319a74bd3ace9249e2e6a7b51c43c27d90b4..fee425993e3d88e326b815e7b3521a29fb596d8e 100644 (file)
@@ -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");
index 530fc04182b4cbc7d8c3fffc301d32f654ad5e4b..3c1f843ee3922bd77f9df1abe9f7d9ce46dd577f 100644 (file)
@@ -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.");
index 01e8633cc4ecaa87f80b9f5890008a5cc04a8516..93fb166da7381305669147347f2bb7197b749a15 100644 (file)
@@ -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");
         }
     }