< prev index next >

test/jdk/java/util/TimeZone/Bug8149452.java

Print this page

        

*** 18,74 **** * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! /* * @test ! * @bug 8149452 8151876 8181157 ! * @summary Check the missing time zone names. */ import java.text.DateFormatSymbols; import java.util.ArrayList; import java.util.TimeZone; import java.util.Arrays; import java.util.List; public class Bug8149452 { public static void main(String[] args) { - // These zone ids are new in tzdb and yet to be reflected in - // CLDR data. Needs to be excluded from the test. - // This list is as of CLDR version 29, and should be examined - // on the CLDR data upgrade. - List<String> NEW_ZONEIDS = List.of( - "America/Punta_Arenas", - "Asia/Atyrau", - "Asia/Barnaul", - "Asia/Famagusta", - "Asia/Tomsk", - "Europe/Astrakhan", - "Europe/Kirov", - "Europe/Saratov", - "Europe/Ulyanovsk"); - List<String> listNotFound = new ArrayList<>(); String[][] zoneStrings = DateFormatSymbols.getInstance() .getZoneStrings(); for (String tzID : TimeZone.getAvailableIDs()) { if (!Arrays.stream(zoneStrings) .anyMatch(zone -> tzID.equalsIgnoreCase(zone[0]))) { // to ignore names for Etc/GMT[+-][0-9]+ which are not supported if (!tzID.startsWith("Etc/GMT") ! && !tzID.startsWith("GMT") ! && !NEW_ZONEIDS.contains(tzID)) { listNotFound.add(tzID); } } } if (!listNotFound.isEmpty()) { throw new RuntimeException("Test Failed: Time Zone Strings for " + listNotFound + " not found"); } - } - } --- 18,60 ---- * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! /* * @test ! * @bug 8149452 8151876 8181157 8206965 ! * @modules java.base/sun.util.calendar ! * @run main/othervm -Duser.language=de -Duser.country=DE Bug8149452 ! * @run main/othervm -Duser.language=ja -Duser.country=JP Bug8149452 ! * @run main/othervm -Duser.language=en -Duser.country=US Bug8149452 ! * @summary Check the missing time zone names for English, German and Japanese locales. */ import java.text.DateFormatSymbols; import java.util.ArrayList; import java.util.TimeZone; import java.util.Arrays; import java.util.List; public class Bug8149452 { public static void main(String[] args) { List<String> listNotFound = new ArrayList<>(); String[][] zoneStrings = DateFormatSymbols.getInstance() .getZoneStrings(); for (String tzID : TimeZone.getAvailableIDs()) { if (!Arrays.stream(zoneStrings) .anyMatch(zone -> tzID.equalsIgnoreCase(zone[0]))) { // to ignore names for Etc/GMT[+-][0-9]+ which are not supported if (!tzID.startsWith("Etc/GMT") ! && !tzID.startsWith("GMT")) { listNotFound.add(tzID); } } } if (!listNotFound.isEmpty()) { throw new RuntimeException("Test Failed: Time Zone Strings for " + listNotFound + " not found"); } } }
< prev index next >