JDK-8025971 : Remove java.time.ZoneId.OLD_SHORT_IDS
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.time
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-10-05
  • Updated: 2017-05-17
  • Resolved: 2013-10-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8 b115Fixed
Related Reports
Relates :  
Description
JSR-310 has two special maps to support backwards compatible handling of the old/broken IDs HST/EST/MST. However, they are still available via the normal ZoneId.of(String) method which is a mistake.

History. These three IDs were added in JDK 1.1 and were defined as DST bearing IDs equal to Pacific/Honolulu, America/New_York and America/Denver. In TZDB release 2005r the meanings were changed to be fixed offsets of -10:00, -05:00 and -07:00.

Thee IDs were intended to be filtered from the TZDB data in JSR-310. They are not currently filtered and need to be to avoid ongoing confusion. The filtering must occur in TzdbZoneRulesProvider or the underlying TZDB compiler.

Conversion from TimeZone to ZoneId is not affected as it uses the backwards compatibility map.
http://download.java.net/jdk8/docs/api/java/time/ZoneId.html#OLD_SHORT_IDS
Comments
This issue is being used to trace the issue of "to remove ZoneId.OLD_SHORT_IDS" during the discussion of the original issue. The "original issue" of "remove the EST, HST and MST" has been moved to https://bugs.openjdk.java.net/browse/JDK-8026842
18-10-2013

This patch would be a simple solution: diff -r c3e5fbaea75d src/share/classes/java/time/zone/TzdbZoneRulesProvider.java --- a/src/share/classes/java/time/zone/TzdbZoneRulesProvider.java Thu Sep 26 23:05:29 2013 -0700 +++ b/src/share/classes/java/time/zone/TzdbZoneRulesProvider.java Fri Oct 04 18:33:32 2013 -0700 @@ -117,7 +117,11 @@ @Override protected Set<String> provideZoneIds() { - return new HashSet<>(regionIds); + HashSet<String> set = new HashSet<>(regionIds); + set.remove("EST"); + set.remove("MST"); + set.remove("HST"); + return set; } @Override diff -r c3e5fbaea75d test/java/time/tck/java/time/TCKZoneId.java --- a/test/java/time/tck/java/time/TCKZoneId.java Thu Sep 26 23:05:29 2013 -0700 +++ b/test/java/time/tck/java/time/TCKZoneId.java Fri Oct 04 18:33:32 2013 -0700 @@ -282,7 +282,7 @@ // getAvailableZoneIds() //----------------------------------------------------------------------- @Test - public void test_getAvailableGroupIds() { + public void test_getAvailableZoneIds() { Set<String> zoneIds = ZoneId.getAvailableZoneIds(); assertEquals(zoneIds.contains("Europe/London"), true); zoneIds.clear(); @@ -291,6 +291,14 @@ assertEquals(zoneIds2.contains("Europe/London"), true); } + @Test + public void test_getAvailableZoneIds_ESTMSTHST() { + Set<String> zoneIds = ZoneId.getAvailableZoneIds(); + assertEquals(zoneIds.contains("EST"), false); + assertEquals(zoneIds.contains("MST"), false); + assertEquals(zoneIds.contains("HST"), false); + } + //----------------------------------------------------------------------- // mapped factory //-----------------------------------------------------------------------
05-10-2013