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

Unexpected timezone display name

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 8
    • core-libs
    • None
    • b108
    • generic
    • generic

    Description

      Two timezones, "Africa/Abidjan" and "Africa/Bamako", use the same display name,but interestingly TimeZone.toZoneId().getDisplayName() returns unexpected names.

      =======================================================
      In display name datafile (TimeZoneNames.java),
              String GMT[] = new String[] {"Greenwich Mean Time", "GMT",
                                           "Greenwich Mean Time", "GMT",
                                           "Greenwich Mean Time", "GMT"};

                  {"Africa/Abidjan", GMT},
      ...
                  {"Africa/Bamako", GMT},
      =======================================================

      Test program:
      import static java.util.Locale.ENGLISH;
      import static java.time.format.TextStyle.FULL;
      import static java.time.format.TextStyle.SHORT;

          public static void main(String[] args) {
              TimeZone tz = TimeZone.getTimeZone("Africa/Abidjan");
              ZoneId id = tz.toZoneId();
              String name = id.getDisplayName(FULL, ENGLISH);
              System.out.println(name);
              name = id.getDisplayName(SHORT, ENGLISH);
              System.out.println(name);

              tz = TimeZone.getTimeZone("Africa/Bamako");
              id = tz.toZoneId();
              name = id.getDisplayName(FULL, ENGLISH);
              System.out.println(name);
              name = id.getDisplayName(SHORT, ENGLISH);
              System.out.println(name);

      Result:
      Africa/Abidjan <--- Strange
      Africa/Abidjan <--- Strange
      Greenwich Mean Time
      GMT

      Attachments

        Issue Links

          Activity

            People

              okutsu Masayoshi Okutsu
              peytoia Yuka Kamiya (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: