test/java/util/PluggableLocale/TimeZoneNameProviderTest.java
Print this page
rev 5957 : imported patch 8000245.8000273.8000615
*** 43,67 ****
aliasTest();
}
void test1() {
Locale[] available = Locale.getAvailableLocales();
List<Locale> providerLocales = Arrays.asList(tznp.getAvailableLocales());
String[] ids = TimeZone.getAvailableIDs();
for (Locale target: available) {
// pure JRE implementation
OpenListResourceBundle rb = LocaleProviderAdapter.forJRE().getLocaleData().getTimeZoneNames(target);
! boolean jreHasBundle = rb.getLocale().equals(target);
for (String id: ids) {
// the time zone
TimeZone tz = TimeZone.getTimeZone(id);
// JRE string array for the id
String[] jrearray = null;
! if (jreHasBundle) {
try {
jrearray = rb.getStringArray(id);
} catch (MissingResourceException mre) {}
}
--- 43,68 ----
aliasTest();
}
void test1() {
Locale[] available = Locale.getAvailableLocales();
+ List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getTimeZoneNameProvider().getAvailableLocales());
List<Locale> providerLocales = Arrays.asList(tznp.getAvailableLocales());
String[] ids = TimeZone.getAvailableIDs();
for (Locale target: available) {
// pure JRE implementation
OpenListResourceBundle rb = LocaleProviderAdapter.forJRE().getLocaleData().getTimeZoneNames(target);
! boolean jreSupportsTarget = jreimplloc.contains(target);
for (String id: ids) {
// the time zone
TimeZone tz = TimeZone.getTimeZone(id);
// JRE string array for the id
String[] jrearray = null;
! if (jreSupportsTarget) {
try {
jrearray = rb.getStringArray(id);
} catch (MissingResourceException mre) {}
}
*** 73,90 ****
String providersname = null;
if (providerLocales.contains(target)) {
providersname = tznp.getDisplayName(id, i>=3, i%2, target);
}
! // JRE's name (if any)
String jresname = null;
if (jrearray != null) {
jresname = jrearray[i];
}
checkValidity(target, jresname, providersname, name,
! jreHasBundle && rb.handleGetKeys().contains(id));
}
}
}
}
--- 74,91 ----
String providersname = null;
if (providerLocales.contains(target)) {
providersname = tznp.getDisplayName(id, i>=3, i%2, target);
}
! // JRE's name
String jresname = null;
if (jrearray != null) {
jresname = jrearray[i];
}
checkValidity(target, jresname, providersname, name,
! jreSupportsTarget && jresname != null);
}
}
}
}