提交 8e2a14fd 编写于 作者: S sherman

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
上级 9e69c8e3
...@@ -618,6 +618,11 @@ public final class TzdbZoneRulesCompiler { ...@@ -618,6 +618,11 @@ public final class TzdbZoneRulesCompiler {
// remove ROC, which is not supported in j.u.tz // remove ROC, which is not supported in j.u.tz
builtZones.remove("ROC"); builtZones.remove("ROC");
links.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");
} }
/** /**
......
...@@ -66,8 +66,17 @@ public final class ZoneInfoFile { ...@@ -66,8 +66,17 @@ public final class ZoneInfoFile {
* @return a set of time zone IDs. * @return a set of time zone IDs.
*/ */
public static String[] getZoneIds() { 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; int i = regions.length;
if (!USE_OLDMAPPING) {
ids[i++] = "EST";
ids[i++] = "HST";
ids[i++] = "MST";
}
for (int j = 0; j < oldMappings.length; j++) { for (int j = 0; j < oldMappings.length; j++) {
ids[i++] = oldMappings[j][0]; ids[i++] = oldMappings[j][0];
} }
...@@ -264,6 +273,10 @@ public final class ZoneInfoFile { ...@@ -264,6 +273,10 @@ public final class ZoneInfoFile {
aliases.put("EST", "America/New_York"); aliases.put("EST", "America/New_York");
aliases.put("MST", "America/Denver"); aliases.put("MST", "America/Denver");
aliases.put("HST", "Pacific/Honolulu"); 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));
} }
} }
......
...@@ -112,13 +112,13 @@ public class TestZoneTextPrinterParser extends AbstractTestPrinterParser { ...@@ -112,13 +112,13 @@ public class TestZoneTextPrinterParser extends AbstractTestPrinterParser {
} }
private static Set<ZoneId> preferred = new HashSet<>(Arrays.asList(new ZoneId[] { 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("Asia/Taipei"),
ZoneId.of("CET"), ZoneId.of("CET"),
})); }));
private static Set<ZoneId> preferred_s = new HashSet<>(Arrays.asList(new ZoneId[] { 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("CET"),
ZoneId.of("Australia/South"), ZoneId.of("Australia/South"),
ZoneId.of("Australia/West"), ZoneId.of("Australia/West"),
...@@ -131,7 +131,7 @@ public class TestZoneTextPrinterParser extends AbstractTestPrinterParser { ...@@ -131,7 +131,7 @@ public class TestZoneTextPrinterParser extends AbstractTestPrinterParser {
Object[][] data_preferredZones() { Object[][] data_preferredZones() {
return new Object[][] { return new Object[][] {
{"America/New_York", "Eastern Standard Time", none, Locale.ENGLISH, TextStyle.FULL}, {"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}, {"Europe/Paris", "Central European Time", none, Locale.ENGLISH, TextStyle.FULL},
{"CET", "Central European Time", preferred, Locale.ENGLISH, TextStyle.FULL}, {"CET", "Central European Time", preferred, Locale.ENGLISH, TextStyle.FULL},
{"Asia/Shanghai", "China Standard Time", none, Locale.ENGLISH, TextStyle.FULL}, {"Asia/Shanghai", "China Standard Time", none, Locale.ENGLISH, TextStyle.FULL},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册