Details
-
Bug
-
Resolution: Fixed
-
P3
-
8
-
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
=======================================================
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
- duplicates
-
JDK-8024143 TimeZone.getDisplayName() doesn't return a localized name after TimeZone.toZoneId().getDisplayName() is called for the same zone.
- Closed