ICU-5247 Compute fallback time zone name once, in initZoneStringHash().

X-SVN-Rev: 19823
This commit is contained in:
Eric Mader 2006-07-11 19:31:01 +00:00
parent 3b145459fa
commit 9f058b10a7
2 changed files with 10 additions and 17 deletions

View file

@ -1100,7 +1100,9 @@ public class DateFormatSymbols implements Serializable, Cloneable {
// throw away the exception
}
try{
strings[TIMEZONE_EXEMPLAR_CITY] = zoneTable.getStringWithFallback(EXEMPLAR_CITY);
String city = zoneTable.getStringWithFallback(EXEMPLAR_CITY);
strings[TIMEZONE_EXEMPLAR_CITY] = ZoneMeta.displayFallback(key, city, tempLocale);
}catch( MissingResourceException ex){
// throw away the exception
}
@ -1225,15 +1227,9 @@ public class DateFormatSymbols implements Serializable, Cloneable {
String[] strings = (String[])zoneStringsHash.get(zid);
if(strings != null){
for(int j=0; j<TIMEZONE_COUNT; j++){
String zoneName = strings[j];
if (j == TIMEZONE_EXEMPLAR_CITY) {
zoneName = ZoneMeta.displayFallback(zid, zoneName, requestedLocale);
}
if(zoneName != null && text.regionMatches(true, start, zoneName, 0, zoneName.length())){
if(strings[j] != null && text.regionMatches(true, start, strings[j], 0, strings[j].length())){
item.type = j;
item.value = zoneName;
item.value = strings[j];
item.zid = zid;
return item;
}
@ -1251,15 +1247,9 @@ public class DateFormatSymbols implements Serializable, Cloneable {
String[] strings = (String[])zoneStringsHash.get(key);
if(strings != null){
for(int j=0; j<TIMEZONE_COUNT; j++){
String zoneName = strings[j];
if (j == TIMEZONE_EXEMPLAR_CITY) {
zoneName = ZoneMeta.displayFallback(key, zoneName, requestedLocale);
}
if(zoneName != null && text.regionMatches(true, start, zoneName, 0, zoneName.length())){
if(strings[j] != null && text.regionMatches(true, start, strings[j], 0, strings[j].length())){
item.type = j;
item.value = zoneName;
item.value = strings[j];
item.zid = key;
return item;
}

View file

@ -855,8 +855,11 @@ public class SimpleDateFormat extends DateFormat {
cal.get(Calendar.DST_OFFSET);
res = ZoneMeta.displayGMT(offset, locale);
} else {
/*
String city = formatData.getZoneString(zid, DateFormatSymbols.TIMEZONE_EXEMPLAR_CITY);
res = ZoneMeta.displayFallback(zid, city, locale);
*/
res = formatData.getZoneString(zid, DateFormatSymbols.TIMEZONE_EXEMPLAR_CITY);
}
}
if(res.length()==0){