// because generic location format is generated from tzid for the case.
// The rest of code should work even zoneStrings is null.
}
String[] zoneIDs = TimeZone.getAvailableIDs();
MessageFormat fallbackFmt = getFallbackFormat(locale);
MessageFormat regionFmt = getRegionFormat(locale);
String[] zstrarray = new String[ZSIDX_MAX];
String[] mzstrarray = new String[ZSIDX_MAX];
String[][] mzPartialLoc = new String[10][4]; // maximum 10 metazones per zone
for (int i = 0; i < zoneIDs.length; i++) {
// Skip aliases
String tzid = ZoneMeta.getCanonicalSystemID(zoneIDs[i]);
if (tzid == null || !zoneIDs[i].equals(tzid)) {
continue;
}
String zoneKey = tzid.replace('/', ':');
zstrarray[ZSIDX_LONG_STANDARD] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_LONG_STANDARD);
zstrarray[ZSIDX_SHORT_STANDARD] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_SHORT_STANDARD);
zstrarray[ZSIDX_LONG_DAYLIGHT] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_LONG_DAYLIGHT);
zstrarray[ZSIDX_SHORT_DAYLIGHT] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_SHORT_DAYLIGHT);
zstrarray[ZSIDX_LONG_GENERIC] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_LONG_GENERIC);
zstrarray[ZSIDX_SHORT_GENERIC] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_SHORT_GENERIC);
// Compose location format string
String countryCode = ZoneMeta.getCanonicalCountry(tzid);
String country = null;
String city = null;
if (countryCode != null) {
city = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_EXEMPLAR_CITY);
if (city == null) {
city = tzid.substring(tzid.lastIndexOf('/') + 1).replace('_', ' ');
}
country = getLocalizedCountry(countryCode, locale);
if (ZoneMeta.getSingleCountry(tzid) != null) {
// If the zone is only one zone in the country, do not add city
zstrarray[ZSIDX_LOCATION] = regionFmt.format(new Object[] {country});
} else {
zstrarray[ZSIDX_LOCATION] = fallbackFmt.format(new Object[] {city, country});
}
} else {
zstrarray[ZSIDX_LOCATION] = null;