diff --git a/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java b/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java index be0204eeeeffccbe9b59d8f06ca79086dac0bc6e..9f1204ca7fec0867b69212a1013693a0024b3349 100644 --- a/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java +++ b/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java @@ -618,6 +618,11 @@ public final class TzdbZoneRulesCompiler { // 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"); } /** diff --git a/src/share/classes/sun/util/calendar/ZoneInfoFile.java b/src/share/classes/sun/util/calendar/ZoneInfoFile.java index 2434bbcbd3936613cbf22893335c6523b0610a84..d3ca7e94ee9cb7f2295128223a4bc127ea7cb9d1 100644 --- a/src/share/classes/sun/util/calendar/ZoneInfoFile.java +++ b/src/share/classes/sun/util/calendar/ZoneInfoFile.java @@ -66,8 +66,17 @@ public final class ZoneInfoFile { * @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 @@ public final class ZoneInfoFile { 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)); } } diff --git a/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java b/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java index 6e37235619b8141b7310259980ed835c8b95657f..e16cf7a624d92eb41b647d94672304e645d8e490 100644 --- a/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java +++ b/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java @@ -112,13 +112,13 @@ public class TestZoneTextPrinterParser extends AbstractTestPrinterParser { } private static Set 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 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 @@ public class TestZoneTextPrinterParser extends AbstractTestPrinterParser { 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},