ICU-4102 synch tests with ICU4C

X-SVN-Rev: 16873
This commit is contained in:
Ram Viswanadha 2004-11-16 19:24:45 +00:00
parent f3229bc8ac
commit 3c5cd056bd
3 changed files with 34 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import com.ibm.icu.text.UTF16;
import com.ibm.icu.util.Holiday;
import com.ibm.icu.util.ULocale;
import com.ibm.icu.util.UResourceBundle;
import com.ibm.icu.util.UResourceTypeMismatchException;
public final class ICUResourceBundleTest extends TestFmwk {
@ -761,5 +762,25 @@ public final class ICUResourceBundleTest extends TestFmwk {
errln("Caught an unexpected expected");
}
}
public void TestJB4102(){
try {
ICUResourceBundle root =(ICUResourceBundle) ICUResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "root");
ICUResourceBundle t = null;
try{
t = root.getWithFallback("calendar/islamic-civil/DateTimePatterns");
errln("Second resource does not exist. How did it get here?\n");
}catch(MissingResourceException ex){
logln("Got the expected exception");
}
try{
t = root.getWithFallback("calendar/islamic-civil/eras/abbreviated/0/mikimaus/pera");
errln("Second resource does not exist. How did it get here?\n");
}catch(UResourceTypeMismatchException ex){
logln("Got the expected exception");
}
} catch (MissingResourceException e) {
warnln("Could not load the locale data");
}
}
}

View File

@ -1007,5 +1007,14 @@ public abstract class ICUResourceBundle extends UResourceBundle{
}
return sub;
}
public boolean equals(Object other){
if(other instanceof ICUResourceBundle){
ICUResourceBundle o = (ICUResourceBundle)other;
if(getBaseName().equals(o.getBaseName())&&
getULocale().equals(o.getULocale())){
return true;
}
}
return false;
}
}

View File

@ -464,7 +464,9 @@ public abstract class UResourceBundle extends ResourceBundle{
}else{
parent = ICUResourceBundle.createBundle(baseName, rootLocale, root);
}
b.setParent(parent);
if(!b.equals(parent)){
b.setParent(parent);
}
}
}
return b;