Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8250815

Incorrect summer TimeZone for Europe/Jersey

XMLWordPrintable

    • b01
    • 11

      A DESCRIPTION OF THE PROBLEM :
      The short name for summer time zone for Jersey, Guernsey, Isle of Man (Europe) and Troll (Antarctica) are incorrect for English based locales.

      Requesting the description (short and long) for daylight savings the following time zone IDs:
      Europe/Guernsey
      Europe/Isle_of_Man
      Europe/Jersey
      Antarctica/Troll
      reports incorrect zone descriptions for en based locales. They all report GMT when the first 3 should be BST and the last CEST.

      This works correctly for locales such as German, Italian, Swedish, but breaks for English, UK, US, Canada.
      It also works for Locale.ROOT.

      This worked in the latest JDK 1.8 and is broken in 11, 12, 14 (that I tested)

      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Get the time zone for Europe/Jersey, and det the short and long description with daylight savings

      TimeZone timeZone = TimeZone.getTimeZone("Europe/Jersey");
      String shortName = timeZone.getDisplayName(true, TimeZone.SHORT, locale);
      String longName = timeZone.getDisplayName(true, TimeZone.LONG, locale);
      System.out.println(shortName + " - " + longName);


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      BST - British Summer Time
      ACTUAL -
      GMT - Greenwich Mean Time

      ---------- BEGIN SOURCE ----------
      import static java.util.Locale.ENGLISH;
      import static java.util.Locale.GERMAN;

      import java.util.Locale;
      import java.util.TimeZone;

      public class WeirdTimeZones {

      public static void main(String[] args) {
      report("Europe/Guernsey", "BST", ENGLISH);
      report("Europe/Guernsey", "BST", GERMAN);
      report("Europe/Isle_of_Man", "BST", ENGLISH);
      report("Europe/Isle_of_Man", "BST", GERMAN);
      report("Europe/Jersey", "BST", ENGLISH);
      report("Europe/Jersey", "BST", GERMAN);
      report("Antarctica/Troll", "CEST", ENGLISH);
      report("Antarctica/Troll", "CEST", GERMAN);
      }

      private static void report(String timeZoneID, String expected, Locale locale) {
      TimeZone timeZone = TimeZone.getTimeZone(timeZoneID);
      String shortName = timeZone.getDisplayName(true, TimeZone.SHORT, locale);

      System.out.format("%s dst %s got %s expected %s for %s%n", timeZoneID,
      expected.equals(shortName) ? "OK" : "FAIL",
      shortName,
      expected,
      locale);
      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Using workarounds for these specific time zone IDs and English locales or avoiding the descriptions from TimeZone.

      FREQUENCY : always


            jlu Justin Lu
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: