ICU-8010 Make Collator.getAvailableLocales work when the class is loaded by the system classloader.

X-SVN-Rev: 28754
This commit is contained in:
Yoshito Umaoka 2010-10-04 20:50:06 +00:00
parent 63e1b55fea
commit f9339035e4
2 changed files with 7 additions and 10 deletions

View file

@ -567,9 +567,8 @@ public abstract class Collator implements Comparator<Object>, Cloneable
public static Locale[] getAvailableLocales() {
// TODO make this wrap getAvailableULocales later
if (shim == null) {
ClassLoader cl = Collator.class.getClassLoader();
return ICUResourceBundle.getAvailableLocales(
ICUResourceBundle.ICU_COLLATION_BASE_NAME, cl);
ICUResourceBundle.ICU_COLLATION_BASE_NAME, ICUResourceBundle.ICU_DATA_CLASS_LOADER);
}
return shim.getAvailableLocales();
}
@ -584,9 +583,8 @@ public abstract class Collator implements Comparator<Object>, Cloneable
*/
public static final ULocale[] getAvailableULocales() {
if (shim == null) {
ClassLoader cl = Collator.class.getClassLoader();
return ICUResourceBundle.getAvailableULocales(
ICUResourceBundle.ICU_COLLATION_BASE_NAME, cl);
ICUResourceBundle.ICU_COLLATION_BASE_NAME, ICUResourceBundle.ICU_DATA_CLASS_LOADER);
}
return shim.getAvailableULocales();
}
@ -724,8 +722,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
public static final ULocale getFunctionalEquivalent(String keyword,
ULocale locID,
boolean isAvailable[]) {
ClassLoader cl = Collator.class.getClassLoader();
return ICUResourceBundle.getFunctionalEquivalent(BASE, cl, RESOURCE,
return ICUResourceBundle.getFunctionalEquivalent(BASE, ICUResourceBundle.ICU_DATA_CLASS_LOADER, RESOURCE,
keyword, locID, isAvailable, true);
}

View file

@ -85,8 +85,8 @@ final class CollatorServiceShim extends Collator.ServiceShim {
// TODO rewrite this to just wrap getAvailableULocales later
Locale[] result;
if (service.isDefault()) {
ClassLoader cl = getClass().getClassLoader();
result = ICUResourceBundle.getAvailableLocales(ICUResourceBundle.ICU_COLLATION_BASE_NAME, cl);
result = ICUResourceBundle.getAvailableLocales(ICUResourceBundle.ICU_COLLATION_BASE_NAME,
ICUResourceBundle.ICU_DATA_CLASS_LOADER);
} else {
result = service.getAvailableLocales();
}
@ -96,8 +96,8 @@ final class CollatorServiceShim extends Collator.ServiceShim {
ULocale[] getAvailableULocales() {
ULocale[] result;
if (service.isDefault()) {
ClassLoader cl = getClass().getClassLoader();
result = ICUResourceBundle.getAvailableULocales(ICUResourceBundle.ICU_COLLATION_BASE_NAME, cl);
result = ICUResourceBundle.getAvailableULocales(ICUResourceBundle.ICU_COLLATION_BASE_NAME,
ICUResourceBundle.ICU_DATA_CLASS_LOADER);
} else {
result = service.getAvailableULocales();
}