From c64fb93a292d6744c917d0f5369afc2ae77fd43e Mon Sep 17 00:00:00 2001 From: Yoshito Umaoka Date: Wed, 15 Jan 2014 22:35:58 +0000 Subject: [PATCH] ICU-10434 Oracle JDK still preserves solar times (Asia/Riyadh8x). The ICU4J time zone format test cases must exclude these zone when JDK tz implementation is used. X-SVN-Rev: 34905 --- .../dev/test/format/TimeZoneFormatTest.java | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/TimeZoneFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/TimeZoneFormatTest.java index 5fcd796e18a..cfbb81a2d55 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/TimeZoneFormatTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/TimeZoneFormatTest.java @@ -1,6 +1,6 @@ /* ******************************************************************************** - * Copyright (C) 2007-2013, Google, International Business Machines Corporation * + * Copyright (C) 2007-2014, Google, International Business Machines Corporation * * and others. All Rights Reserved. * ******************************************************************************** */ @@ -35,9 +35,10 @@ import com.ibm.icu.util.ULocale; public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk { - private static boolean JDKTZ = (TimeZone.getDefaultTimeZoneType() == TimeZone.TIMEZONE_JDK); + private static boolean JDKTZ = (TimeZone.getDefaultTimeZoneType() == TimeZone.TIMEZONE_JDK); + private static final Pattern EXCL_TZ_PATTERN = Pattern.compile(".*/Riyadh8[7-9]"); - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws Exception { new TimeZoneFormatTest().run(args); } @@ -133,6 +134,9 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk { SimpleDateFormat sdf = new SimpleDateFormat(PATTERNS[patidx], LOCALES[locidx]); for (int tzidx = 0; tzidx < tzids.length; tzidx++) { + if (EXCL_TZ_PATTERN.matcher(tzids[tzidx]).matches()) { + continue; + } TimeZone tz = TimeZone.getTimeZone(tzids[tzidx]); for (int datidx = 0; datidx < DATES.length; datidx++) { @@ -359,16 +363,19 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk { Set ids = null; if (JDKTZ) { - ids = new TreeSet(); - String[] jdkIDs = java.util.TimeZone.getAvailableIDs(); - for (String jdkID : jdkIDs) { - String tmpID = TimeZone.getCanonicalID(jdkID); - if (tmpID != null) { - ids.add(tmpID); - } - } + ids = new TreeSet(); + String[] jdkIDs = java.util.TimeZone.getAvailableIDs(); + for (String jdkID : jdkIDs) { + if (EXCL_TZ_PATTERN.matcher(jdkID).matches()) { + continue; + } + String tmpID = TimeZone.getCanonicalID(jdkID); + if (tmpID != null) { + ids.add(tmpID); + } + } } else { - ids = TimeZone.getAvailableIDs(SystemTimeZoneType.CANONICAL, null, null); + ids = TimeZone.getAvailableIDs(SystemTimeZoneType.CANONICAL, null, null); } for (String id : ids) { -- 2.40.0