String canonical = null;
String tzidKey = tzid.replace('/', ':');
try {
// First, try check if the given ID is canonical
UResourceBundle keyTypeData = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "keyTypeData",
ICUResourceBundle.ICU_DATA_CLASS_LOADER);
UResourceBundle typeMap = keyTypeData.get("typeMap");
UResourceBundle typeKeys = typeMap.get("timezone");
try {
/* UResourceBundle canonicalEntry = */typeKeys.get(tzidKey);
// The given tzid is available in the canonical list
canonical = tzid;
} catch (MissingResourceException e) {
// fall through
}
if (canonical == null) {
// Try alias map
UResourceBundle typeAlias = keyTypeData.get("typeAlias");
UResourceBundle aliasesForKey = typeAlias.get("timezone");
canonical = aliasesForKey.getString(tzidKey);
}
} catch (MissingResourceException e) {
// fall through
}
return canonical;