--- old/src/share/classes/java/util/TimeZone.java 2012-12-08 00:28:59.000000000 +0900
+++ new/src/share/classes/java/util/TimeZone.java 2012-12-08 00:28:58.000000000 +0900
@@ -43,12 +43,12 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.concurrent.ConcurrentHashMap;
-import sun.misc.SharedSecrets;
import sun.misc.JavaAWTAccess;
+import sun.misc.SharedSecrets;
import sun.security.action.GetPropertyAction;
-import sun.util.locale.provider.TimeZoneNameUtility;
import sun.util.calendar.ZoneInfo;
import sun.util.calendar.ZoneInfoFile;
+import sun.util.locale.provider.TimeZoneNameUtility;
/**
* TimeZone
represents a time zone offset, and also figures out daylight
@@ -399,28 +399,23 @@
if (style != SHORT && style != LONG) {
throw new IllegalArgumentException("Illegal style: " + style);
}
-
String id = getID();
- String[] names = getDisplayNames(id, locale);
- if (names == null) {
- if (id.startsWith("GMT") && id.length() > 3) {
- char sign = id.charAt(3);
- if (sign == '+' || sign == '-') {
- return id;
- }
- }
- int offset = getRawOffset();
- if (daylight) {
- offset += getDSTSavings();
- }
- return ZoneInfoFile.toCustomID(offset);
+ String name = TimeZoneNameUtility.retrieveDisplayName(id, daylight, style, locale);
+ if (name != null) {
+ return name;
}
- int index = daylight ? 3 : 1;
- if (style == SHORT) {
- index++;
+ if (id.startsWith("GMT") && id.length() > 3) {
+ char sign = id.charAt(3);
+ if (sign == '+' || sign == '-') {
+ return id;
+ }
}
- return names[index];
+ int offset = getRawOffset();
+ if (daylight) {
+ offset += getDSTSavings();
+ }
+ return ZoneInfoFile.toCustomID(offset);
}
private static class DisplayNames {
@@ -429,9 +424,12 @@
// Map(key=id, value=SoftReference(Map(key=locale, value=displaynames)))
private static final Map>> CACHE =
new ConcurrentHashMap<>();
+
+ private DisplayNames() {
+ }
}
- private static final String[] getDisplayNames(String id, Locale locale) {
+ private static String[] getDisplayNames(String id, Locale locale) {
Map>> displayNames = DisplayNames.CACHE;
SoftReference