< prev index next >

test/java/util/TimeZone/CheckDisplayNames.java

Print this page

        

*** 21,31 **** * questions. */ /* * @test ! * @bug 6405639 8008577 * @summary Validate timezone display names in * src/java.base/share/classes/sun/util/resources/TimeZoneNames.java. * @modules java.base/sun.util.resources * @compile -XDignore.symbol.file CheckDisplayNames.java * @run main/othervm -Djava.locale.providers=COMPAT,SPI CheckDisplayNames --- 21,31 ---- * questions. */ /* * @test ! * @bug 6405639 8008577 8151876 * @summary Validate timezone display names in * src/java.base/share/classes/sun/util/resources/TimeZoneNames.java. * @modules java.base/sun.util.resources * @compile -XDignore.symbol.file CheckDisplayNames.java * @run main/othervm -Djava.locale.providers=COMPAT,SPI CheckDisplayNames
*** 51,60 **** --- 51,71 ---- private static boolean err = false; private static boolean src = false; private static Locale[] locales = Locale.getAvailableLocales(); private static String[] zones = TimeZone.getAvailableIDs(); + private static List<String> newGMTzones = new ArrayList<>(); + + public static void setNewGMTzones() { + for (String zone : zones) { + String shortName = TimeZone.getTimeZone(zone).getDisplayName(false, TimeZone.SHORT); + String longName = TimeZone.getTimeZone(zone).getDisplayName(false, TimeZone.LONG); + if (!(zone.contains("GMT+") || zone.contains("GMT-")) && shortName.equals(longName)) { + newGMTzones.add(TimeZone.getTimeZone(zone).getDisplayName()); + } + } + } private static String[] zones_118 = { "ACT", "Australia/Darwin", "AET", "Australia/Sydney", "AGT", "America/Buenos_Aires",
*** 94,103 **** --- 105,115 ---- try { if (argv.length == 1 && "-source".equals(argv[0])) { src = true; } + setNewGMTzones(); testDisplayNames(); testRAWoffsetAndDisplayNames(); test118DisplayNames(); if (err) {
*** 152,162 **** } TimeZone tz = TimeZone.getTimeZone(id); String name = tz.getDisplayName(); ! if (name == null || name.startsWith("GMT+") || name.startsWith("GMT-")) { if (src) { System.out.println("\t {\"" + tz.getID() + "\", " + "new String[] {\"Standard Time Name\", \"ST\",\n" + "\t\t\t\t\t\t\"Daylight Time Name\", \"DT\"}},"); } else { --- 164,174 ---- } TimeZone tz = TimeZone.getTimeZone(id); String name = tz.getDisplayName(); ! if ((name == null || name.startsWith("GMT+") || name.startsWith("GMT-")) && !newGMTzones.contains(name)) { if (src) { System.out.println("\t {\"" + tz.getID() + "\", " + "new String[] {\"Standard Time Name\", \"ST\",\n" + "\t\t\t\t\t\t\"Daylight Time Name\", \"DT\"}},"); } else {
< prev index next >