changeset 21306:e56a970409e5

8026842: Remove Time-Zone IDs HST/EST/MST Summary: removed these ids from ZoneId's zid list, supported via short_ids list Reviewed-by: okutsu
author sherman
date Mon, 21 Oct 2013 11:16:02 -0700
parents 81e2a41dfed2
children d9d1ad598db1
files jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java
diffstat 3 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java	Mon Oct 21 13:57:11 2013 +0200
+++ b/jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java	Mon Oct 21 11:16:02 2013 -0700
@@ -618,6 +618,11 @@
         // remove ROC, which is not supported in j.u.tz
         builtZones.remove("ROC");
         links.remove("ROC");
+        // remove EST, HST and MST. They are supported via
+        // the short-id mapping
+        builtZones.remove("EST");
+        builtZones.remove("HST");
+        builtZones.remove("MST");
     }
 
     /**
--- a/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Mon Oct 21 13:57:11 2013 +0200
+++ b/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Mon Oct 21 11:16:02 2013 -0700
@@ -66,8 +66,17 @@
      * @return a set of time zone IDs.
      */
     public static String[] getZoneIds() {
-        String[] ids = Arrays.copyOf(regions, regions.length + oldMappings.length);
+        int len = regions.length + oldMappings.length;
+        if (!USE_OLDMAPPING) {
+            len += 3;    // EST/HST/MST not in tzdb.dat
+        }
+        String[] ids = Arrays.copyOf(regions, len);
         int i = regions.length;
+        if (!USE_OLDMAPPING) {
+            ids[i++] = "EST";
+            ids[i++] = "HST";
+            ids[i++] = "MST";
+        }
         for (int j = 0; j < oldMappings.length; j++) {
             ids[i++] = oldMappings[j][0];
         }
@@ -264,6 +273,10 @@
             aliases.put("EST", "America/New_York");
             aliases.put("MST", "America/Denver");
             aliases.put("HST", "Pacific/Honolulu");
+        } else {
+            zones.put("EST", new ZoneInfo("EST", -18000000));
+            zones.put("MST", new ZoneInfo("MST", -25200000));
+            zones.put("HST", new ZoneInfo("HST", -36000000));
         }
     }
 
--- a/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java	Mon Oct 21 13:57:11 2013 +0200
+++ b/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java	Mon Oct 21 11:16:02 2013 -0700
@@ -112,13 +112,13 @@
     }
 
     private static Set<ZoneId> preferred = new HashSet<>(Arrays.asList(new ZoneId[] {
-        ZoneId.of("EST"),
+        ZoneId.of("EST", ZoneId.SHORT_IDS),
         ZoneId.of("Asia/Taipei"),
         ZoneId.of("CET"),
     }));
 
     private static Set<ZoneId> preferred_s = new HashSet<>(Arrays.asList(new ZoneId[] {
-         ZoneId.of("EST"),
+         ZoneId.of("EST", ZoneId.SHORT_IDS),
          ZoneId.of("CET"),
          ZoneId.of("Australia/South"),
          ZoneId.of("Australia/West"),
@@ -131,7 +131,7 @@
     Object[][] data_preferredZones() {
         return new Object[][] {
             {"America/New_York", "Eastern Standard Time", none,      Locale.ENGLISH, TextStyle.FULL},
-            {"EST",              "Eastern Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
+//          {"EST",              "Eastern Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
             {"Europe/Paris",     "Central European Time", none,      Locale.ENGLISH, TextStyle.FULL},
             {"CET",              "Central European Time", preferred, Locale.ENGLISH, TextStyle.FULL},
             {"Asia/Shanghai",    "China Standard Time",   none,      Locale.ENGLISH, TextStyle.FULL},