changeset 40455:db40a6f6f274

7094818: closed/java/text/Format/DateFormat tests failed on Hindi 8132861: java/text/Format/DateFormat/Bug4845901.java failed in Thai locale 8134733: java/util/Calendar/CalendarRegression.java failed in ar locale. Reviewed-by: okutsu
author peytoia
date Mon, 22 Aug 2016 14:24:46 +0900
parents 84a6dc93eef8
children 4b41c04ad79f
files jdk/test/java/text/Format/DateFormat/Bug4322313.java jdk/test/java/text/Format/DateFormat/Bug4407042.java jdk/test/java/text/Format/DateFormat/Bug4845901.java jdk/test/java/text/Format/DateFormat/Bug6530336.java jdk/test/java/text/Format/DateFormat/DateFormatRegression.java jdk/test/java/text/Format/DateFormat/bug4358730.java jdk/test/java/text/Format/MessageFormat/MessageRegression.java jdk/test/java/text/Format/NumberFormat/NumberRegression.java jdk/test/java/text/testlib/TestUtils.java jdk/test/java/util/Calendar/CalendarLimitTest.java jdk/test/java/util/Calendar/CalendarRegression.java jdk/test/java/util/Calendar/CalendarTest.java jdk/test/java/util/Calendar/bug4409072.java jdk/test/java/util/Locale/LocaleCategory.java jdk/test/java/util/Locale/LocaleCategory.sh jdk/test/java/util/TimeZone/Bug4322313.java jdk/test/java/util/TimeZone/TimeZoneRegression.java
diffstat 17 files changed, 224 insertions(+), 107 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/java/text/Format/DateFormat/Bug4322313.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/text/Format/DateFormat/Bug4322313.java	Mon Aug 22 14:24:46 2016 +0900
@@ -158,7 +158,8 @@
 
         try {
             for (int i=0; i < locs.length; i++) {
-                Locale.setDefault(locs[i]);
+                Locale locale = locs[i];
+                Locale.setDefault(locale);
 
                 for (int j=0; j < formats.length; j++) {
                     TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
@@ -174,7 +175,7 @@
                         catch (Exception e) {
                             err = true;
                             System.err.println("\tParse  Error [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale + ", " + formats[j] +
                                 "/\"" + valids[k][0] +
                                 "\"] Unexpected Exception occurred: " + e);
                             continue;
@@ -184,7 +185,7 @@
                         if (offset != ((Integer)valids[k][4]).intValue()) {
                             err = true;
                             System.err.println("\tParse  Error [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale + ", " + formats[j] +
                                 "/\"" + valids[k][0] +
                                 "\"] invalid index: expected:" + valids[k][4] +
                                 ", got:" + offset);
@@ -193,14 +194,14 @@
                         if (date.getTime() != ((Long)valids[k][1]).longValue()) {
                             err = true;
                             System.err.println("\tParse  Error [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale + ", " + formats[j] +
                                 "/\"" + valids[k][0] +
                                 "\"] expected:" + valids[k][1] +
                                 ", got:" + date.getTime() + ", " + date);
                         } else {
 /*
                             logln("\tParse  Okay  [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale) + ", " + formats[j] +
                                 "/\"" + valids[k][0] +
                                 "\"] expected:" + valids[k][1] +
                                 ", got:" + date.getTime() + ", " + date);
@@ -212,7 +213,7 @@
                             catch (Exception e) {
                                 err = true;
                                 System.err.println("\tParse  Error [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + valids[k][0] +
                                     "\"] Unexpected Exception occurred: " + e);
                                 continue;
@@ -245,14 +246,14 @@
                                   expected.equals("GMT+00:00"))) {
                                 err = true;
                                 System.err.println("\tFormat Error [Locale=" +
-                                    Locale.getDefault() + ", " +
+                                    locale + ", " +
                                     formats[j] + "/\"" + valids[k][0] +
                                     "\"] expected:" + valids[k][2+j] +
                                     ", got:" + s + ", " + date);
                             } else {
 /*
                                 logln("\tFormat Okay  [Locale=" +
-                                    Locale.getDefault() + ", " +
+                                    locale + ", " +
                                     formats[j] + "/\"" + valids[k][0] +
                                     "\"] expected:" + valids[k][2+j] +
                                     ", got:" + s + ", " + date);
@@ -271,7 +272,7 @@
                             if (date != null) {
                                 err = true;
                                 System.err.println("\tParse  Error [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] expected:null , got:" + date);
                             }
@@ -279,14 +280,14 @@
                             if (offset != ((Integer)invalids[k][1]).intValue()) {
                                 err = true;
                                 System.err.println("\tParse  Error [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] incorrect offset. expected:" +
                                     invalids[k][1] + ", got: " + offset);
                             } else {
 /*
                                 logln("\tParse  Okay  [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] correct offset: " + offset);
 */
@@ -295,7 +296,7 @@
                         catch (Exception e) {
                             err = true;
                             System.err.println("\tParse  Error [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale + ", " + formats[j] +
                                 "/\"" + invalids[k][0] +
                                 "\"] Unexpected Exception occurred: " + e);
                         }
@@ -315,14 +316,14 @@
                             if (offset != ((Integer)invalids[k][1]).intValue()) {
                                 err = true;
                                 System.err.println("\tParse  Error [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] Expected exception occurred with an incorrect offset. expected:" +
                                     invalids[k][1] + ", got: " + offset);
                             } else {
 /*
                                 logln("\tParse  Okay  [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] Expected exception occurred with an correct offset: "
                                     + offset);
@@ -332,7 +333,7 @@
                         catch (Exception e) {
                             err = true;
                             System.err.println("\tParse  Error [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale + ", " + formats[j] +
                                 "/\"" + invalids[k][0] +
                                 "\"] Invalid exception occurred: " + e);
                         }
@@ -340,7 +341,7 @@
                             if (!correctParseException) {
                                 err = true;
                                 System.err.println("\tParse  Error: [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] Expected exception didn't occur.");
                             }
--- a/jdk/test/java/text/Format/DateFormat/Bug4407042.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/text/Format/DateFormat/Bug4407042.java	Mon Aug 22 14:24:46 2016 +0900
@@ -26,6 +26,7 @@
  * @bug 4407042
  * @summary Make sure that cloned SimpleDateFormat objects work
  * independently in multiple threads.
+ * @library /java/text/testlib
  * @run main Bug4407042 10
  */
 
@@ -44,8 +45,9 @@
 
     void test() {
         Locale locale = Locale.getDefault();
-        if (locale.equals(new Locale("th", "TH")) ||
-            locale.equals(new Locale("hi", "IN"))) {
+        if (!TestUtils.usesAsciiDigits(locale)
+                || !TestUtils.usesGregorianCalendar(locale)) {
+            System.out.println("Skipping this test because locale is " + locale);
             return;
         }
 
--- a/jdk/test/java/text/Format/DateFormat/Bug4845901.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/text/Format/DateFormat/Bug4845901.java	Mon Aug 22 14:24:46 2016 +0900
@@ -27,6 +27,8 @@
  * @summary Make sure that SimpleDateFormat.parse() can distinguish
  * the same time zone abbreviation for standard and daylight saving
  * time.
+ * @library /java/text/testlib
+ * @run main Bug4845901
  */
 
 import java.util.*;
@@ -34,6 +36,12 @@
 
 public class Bug4845901 {
     public static void main (String args[]) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            System.out.println("Skipping this test because locale is " + locale);
+            return;
+        }
+
         TimeZone savedTZ = TimeZone.getDefault();
         TimeZone.setDefault(TimeZone.getTimeZone("Australia/Sydney"));
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss.SSS z");
--- a/jdk/test/java/text/Format/DateFormat/Bug6530336.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/text/Format/DateFormat/Bug6530336.java	Mon Aug 22 14:24:46 2016 +0900
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 6530336 6537997 8008577
+ * @library /java/text/testlib
  * @run main/othervm -Djava.locale.providers=COMPAT,SPI Bug6530336
  */
 
@@ -43,7 +44,6 @@
 
         try {
             Locale locales[] = Locale.getAvailableLocales();
-            Locale locale_Japan = new Locale("ja", "JP", "JP");
             TimeZone timezone_LA = TimeZone.getTimeZone("America/Los_Angeles");
             TimeZone.setDefault(timezone_LA);
 
@@ -60,12 +60,12 @@
             Date[] dates = new Date[2];
 
             for (int i = 0; i < locales.length; i++) {
-                if (locales[i].getLanguage().equals("th") ||
-                    locales[i].equals(locale_Japan)) {
+                Locale locale = locales[i];
+                if (!TestUtils.usesGregorianCalendar(locale)) {
                     continue;
                 }
 
-                Locale.setDefault(locales[i]);
+                Locale.setDefault(locale);
 
                 for (int j = 0; j < timezones.length; j++) {
                     Calendar cal = Calendar.getInstance(timezones[j]);
@@ -83,7 +83,7 @@
 
                     if (!expected[j].equals(date_LA)) {
                         System.err.println("Got wrong Pacific time (" +
-                            date_LA + ") for (" + date + ") in " + locales[i] +
+                            date_LA + ") for (" + date + ") in " + locale +
                             " in " + timezones[j] +
                             ".\nExpected=" + expected[j]);
                         err = true;
--- a/jdk/test/java/text/Format/DateFormat/DateFormatRegression.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/text/Format/DateFormat/DateFormatRegression.java	Mon Aug 22 14:24:46 2016 +0900
@@ -72,7 +72,6 @@
     }
 
     public void Test4052408() {
-
         DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.SHORT,
                                                         DateFormat.SHORT, Locale.US);
         Date date = new Date(97, Calendar.MAY, 3, 8, 55);
@@ -164,7 +163,9 @@
     }
 
     public void Test4059917() {
-        if (Locale.getDefault().equals(new Locale("hi", "IN"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesAsciiDigits(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -621,25 +622,6 @@
         }
     }
 
-    /*
-      Synopsis: Chinese time zone CTT is not recogonized correctly.
-      Description: Platform Chinese Windows 95 - ** Time zone set to CST **
-      */
-    public void Test4108407() {
-
-        long l = System.currentTimeMillis();
-        logln("user.timezone = " + System.getProperty("user.timezone", "?"));
-        logln("Time Zone :" +
-                           DateFormat.getDateInstance().getTimeZone().getID());
-        logln("Default format :" +
-                           DateFormat.getDateInstance().format(new Date(l)));
-        logln("Full format :" +
-                           DateFormat.getDateInstance(DateFormat.FULL).format(new
-                                                                              Date(l)));
-        logln("*** Set host TZ to CST ***");
-        logln("*** THE RESULTS OF THIS TEST MUST BE VERIFIED MANUALLY ***");
-    }
-
     /**
      * SimpleDateFormat won't parse "GMT"
      */
--- a/jdk/test/java/text/Format/DateFormat/bug4358730.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/text/Format/DateFormat/bug4358730.java	Mon Aug 22 14:24:46 2016 +0900
@@ -47,23 +47,17 @@
     };
     int[] year = {2, 20, 200, 2000};
 
-    SimpleDateFormat sdf = new SimpleDateFormat();
     int datasize = data.length;
     int nPatterns = data[0].length;
 
     public void Test4358730() {
-        Locale locale = Locale.getDefault();
-        if (locale.equals(new Locale("th", "TH")) ||
-            locale.equals(new Locale("hi", "IN"))) {
-            return;
-        }
-
         TimeZone saveZone = TimeZone.getDefault();
         Locale saveLocale = Locale.getDefault();
 
         try {
             TimeZone.setDefault(TimeZone.getTimeZone("PST"));
             Locale.setDefault(new Locale("en", "US"));
+            SimpleDateFormat sdf = new SimpleDateFormat();
 
             for (int i = 0; i < datasize; i++) {
                 Date d = new Date(year[i]-1900, 10, 15);
--- a/jdk/test/java/text/Format/MessageFormat/MessageRegression.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/text/Format/MessageFormat/MessageRegression.java	Mon Aug 22 14:24:46 2016 +0900
@@ -28,6 +28,7 @@
  * 4142938 4169959 4232154 4293229
  * @summary Regression tests for MessageFormat and associated classes
  * @library /java/text/testlib
+ * @run main MessageRegression
  */
 /*
 (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
@@ -121,14 +122,15 @@
      * More robust message formats.
      */
     public void Test4031438() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesAsciiDigits(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         String pattern1 = "Impossible {1} has occurred -- status code is {0} and message is {2}.";
         String pattern2 = "Double '' Quotes {0} test and quoted '{1}' test plus 'other {2} stuff'.";
 
-        // If the current locale is hi_IN, skip this test case.
-        if (Locale.getDefault().equals(new Locale("hi", "IN"))) {
-            return;
-        }
-
         MessageFormat messageFormatter = new MessageFormat("");
 
         try {
--- a/jdk/test/java/text/Format/NumberFormat/NumberRegression.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/text/Format/NumberFormat/NumberRegression.java	Mon Aug 22 14:24:46 2016 +0900
@@ -32,7 +32,7 @@
  * 4217661 4243011 4243108 4330377 4233840 4241880 4833877 8008577
  * @summary Regression tests for NumberFormat and associated classes
  * @library /java/text/testlib
- * @build IntlTest HexDumpReader
+ * @build IntlTest HexDumpReader TestUtils
  * @modules java.base/sun.util.resources
  * @compile -XDignore.symbol.file NumberRegression.java
  * @run main/othervm -Djava.locale.providers=COMPAT,SPI NumberRegression
@@ -100,6 +100,12 @@
      */
 
     public void Test4088161 (){
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesAsciiDigits(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         DecimalFormat df = new DecimalFormat();
         double d = 100;
         df.setMinimumFractionDigits(0);
@@ -114,8 +120,7 @@
         FieldPosition fp2 = new FieldPosition(0);
         logln("maxFractionDigits = " + df.getMaximumFractionDigits());
         df.format(d, sBuf2, fp2);
-        String expected = Locale.getDefault().equals(new Locale("hi", "IN")) ?
-                              "\u0967\u0966\u0966" : "100";
+        String expected = "100";
         if (!sBuf2.toString().equals(expected))
             errln(" format(d) = '" + sBuf2 + "'");
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/testlib/TestUtils.java	Mon Aug 22 14:24:46 2016 +0900
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * 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.
+ */
+
+import java.text.DecimalFormatSymbols;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+
+import java.util.Locale.Builder;
+
+/**
+ * TestUtils provides utility methods to get a locale-dependent attribute.
+ * For example,
+ *   - whether or not a non-Gregorian calendar is used
+ *   - whether or not non-ASCII digits are used
+ *
+ * This class was developed to help testing for internationalization &
+ * localization and is not versatile.
+ */
+public class TestUtils {
+
+    /**
+     * Returns true if the give locale uses Gregorian calendar.
+     */
+    public static boolean usesGregorianCalendar(Locale locale) {
+        return Calendar.getInstance(locale).getClass() == GregorianCalendar.class;
+    }
+
+    /**
+     * Returns true if the given locale uses ASCII digits.
+     */
+    public static boolean usesAsciiDigits(Locale locale) {
+        return DecimalFormatSymbols.getInstance(locale).getZeroDigit() == '0';
+    }
+
+    /**
+     * Returns true if the given locale has a special variant which is treated
+     * as ill-formed in BCP 47.
+     *
+     * BCP 47 requires a variant subtag to be 5 to 8 alphanumerics or a
+     * single numeric followed by 3 alphanumerics.
+     * However, note that this methods doesn't check a variant so rigorously
+     * because this is a utility method for testing. Intended special variants
+     * are: JP, NY, and TH, which can be commonly provided by
+     * Locale.getAvailableLocales().
+     *
+     */
+    public static boolean hasSpecialVariant(Locale locale) {
+        String variant = locale.getVariant();
+        return !variant.isEmpty()
+                   && "JP".equals(variant) || "NY".equals(variant) || "TH".equals(variant);
+    }
+
+}
--- a/jdk/test/java/util/Calendar/CalendarLimitTest.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/util/Calendar/CalendarLimitTest.java	Mon Aug 22 14:24:46 2016 +0900
@@ -24,8 +24,8 @@
 /**
  * @test
  * @bug 4033662
+ * @summary test for limit on Calendar
  * @library /java/text/testlib
- * @summary test for limit on Calendar
  * @run main CalendarLimitTest -verbose
  */
 
@@ -62,6 +62,12 @@
     static long ORIGIN; // This is the *approximate* point at which BC switches to AD
 
     public static void main(String argv[]) throws Exception {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            System.out.println("Skipping this test because locale is " + locale);
+            return;
+        }
+
         new CalendarLimitTest().run(argv);
     }
 
--- a/jdk/test/java/util/Calendar/CalendarRegression.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/util/Calendar/CalendarRegression.java	Mon Aug 22 14:24:46 2016 +0900
@@ -32,6 +32,7 @@
  * 4652815 4652830 4740554 4936355 4738710 4633646 4846659 4822110 4960642
  * 4973919 4980088 4965624 5013094 5006864 8152077
  * @library /java/text/testlib
+ * @run main CalendarRegression
  */
 
 import java.lang.reflect.*;
@@ -531,6 +532,12 @@
     }
 
     public void Test4100311() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         GregorianCalendar cal = (GregorianCalendar)Calendar.getInstance();
         cal.set(Calendar.YEAR, 1997);
         cal.set(Calendar.DAY_OF_YEAR, 1);
@@ -541,7 +548,9 @@
     }
 
     public void Test4103271() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -768,6 +777,12 @@
     }
 
     public void Test4114578() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         int ONE_HOUR = 60*60*1000;
         TimeZone saveZone = TimeZone.getDefault();
         boolean fail = false;
@@ -847,6 +862,12 @@
      * Check isLeapYear for BC years.
      */
     public void Test4125881() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         GregorianCalendar cal = (GregorianCalendar) Calendar.getInstance();
         DateFormat fmt = new SimpleDateFormat("MMMM d, yyyy G");
         cal.clear();
@@ -865,7 +886,9 @@
      * at 45 BC, and not have leap years before then).
      */
     public void Test4125892() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -1276,7 +1299,9 @@
      * This bug relies on the TimeZone bug 4173604 to also be fixed.
      */
     public void Test4173516() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -1755,7 +1780,10 @@
      * get(int) changes internal states of a Calendar.
      */
     public void Test4685354() {
-        if (Locale.getDefault().equals(new Locale("hi", "IN"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesAsciiDigits(locale)
+                || !TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -1860,8 +1888,9 @@
      * get(int) changes internal states of a Calendar.
      */
     public void Test4655637() {
-        // Skip this test case if it's Thai locale
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
--- a/jdk/test/java/util/Calendar/CalendarTest.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/util/Calendar/CalendarTest.java	Mon Aug 22 14:24:46 2016 +0900
@@ -24,8 +24,9 @@
 /**
  * @test
  * @bug 4064654 4374886 4984320 4984574 4944795
+ * @summary test for Calendar
  * @library /java/text/testlib
- * @summary test for Calendar
+ * @run main CalendarTest
  * @key randomness
  */
 
@@ -203,7 +204,9 @@
     }
 
     public void TestGenericAPI() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -559,7 +562,9 @@
 
     // Test the behavior of GMT vs. local time
     public void TestGMTvsLocal4064654() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -875,10 +880,6 @@
     // Verify that the fields are as expected (mostly zero) at the epoch start.
     // Note that we adjust for the default timezone to get most things to zero.
     public void TestEpochStartFields() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
-            return;
-        }
-
         String[][] lt = {
           {"en", "US", "US/Pacific"},        /* First day = 1, Minimum day = 1 */
           {"en", "US", "America/Anchorage"}, /* First day = 1, Minimum day = 1 */
--- a/jdk/test/java/util/Calendar/bug4409072.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/util/Calendar/bug4409072.java	Mon Aug 22 14:24:46 2016 +0900
@@ -26,6 +26,7 @@
  * @bug 4409072
  * @summary tests for set(), add(), and roll() with various week parameters.
  * @library /java/text/testlib
+ * @run main bug4409072
  */
 
 import  java.util.*;
@@ -41,7 +42,9 @@
      * (e.g. add(), roll(), set())
      */
     public void Test4409072() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
--- a/jdk/test/java/util/Locale/LocaleCategory.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/util/Locale/LocaleCategory.java	Mon Aug 22 14:24:46 2016 +0900
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,11 @@
 
     public static void main(String[] args) {
         Locale reservedLocale = Locale.getDefault();
+        if (TestUtils.hasSpecialVariant(reservedLocale)) {
+            System.out.println("Skipping this test because locale is " + reservedLocale);
+            return;
+        }
+
         try {
             Locale.Builder builder = new Locale.Builder();
 
--- a/jdk/test/java/util/Locale/LocaleCategory.sh	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/util/Locale/LocaleCategory.sh	Mon Aug 22 14:24:46 2016 +0900
@@ -26,7 +26,8 @@
 # @bug 4700857 6997928 7079486
 # @summary tests for Locale.getDefault(Locale.Category) and
 #    Locale.setDefault(Locale.Category, Locale)
-# @build LocaleCategory
+# @library /java/text/testlib
+# @build LocaleCategory TestUtils
 # @run shell/timeout=600 LocaleCategory.sh
 
 if [ "${TESTSRC}" = "" ]
@@ -46,7 +47,9 @@
   echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   exit 1
 fi
+
 echo "TESTCLASSES=${TESTCLASSES}"
+echo "TESTCLASSPATH=${TESTCLASSPATH}"
 echo "CLASSPATH=${CLASSPATH}"
 
 # set platform-dependent variables
@@ -69,7 +72,7 @@
 # test user.xxx.display user.xxx.format properties
 
 # run
-RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Duser.language.display=ja -Duser.language.format=zh LocaleCategory"
+RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSPATH} -Duser.language.display=ja -Duser.language.format=zh LocaleCategory"
 
 echo ${RUNCMD}
 ${RUNCMD}
@@ -85,7 +88,7 @@
 # test user.xxx properties overriding user.xxx.display/format
 
 # run
-RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Duser.language=en -Duser.language.display=ja -Duser.language.format=zh LocaleCategory"
+RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSPATH} -Duser.language=en -Duser.language.display=ja -Duser.language.format=zh LocaleCategory"
 
 echo ${RUNCMD}
 ${RUNCMD}
--- a/jdk/test/java/util/TimeZone/Bug4322313.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/util/TimeZone/Bug4322313.java	Mon Aug 22 14:24:46 2016 +0900
@@ -90,7 +90,9 @@
             TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
 
             for (int i = 0; i < locs.length; i++) {
-                Locale.setDefault(locs[i]);
+                Locale locale = locs[i];
+                Locale.setDefault(locale);
+
 
                 /* Okay case */
                 for (int k = 0; k < VALIDS.length; k++) {
@@ -100,12 +102,12 @@
                     if (!tz.getID().equals(VALIDS[k][2])) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                                           locale + ", \"" + VALIDS[k][0] +
                                            "\"] Invalid TimeZone ID, expected:" +
                                            VALIDS[k][2] + ", got:" + tz.getID() + ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                              locale + ", \"" + VALIDS[k][0] +
                               "\"] Valid TimeZone ID, got:" + VALIDS[k][2]);
                     }
 
@@ -113,12 +115,12 @@
                     if (offset != (int)VALIDS[k][1]) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                                           locale + ", \"" + VALIDS[k][0] +
                                            "\"] Invalid RawOffset, expected:" + VALIDS[k][1] +
                                            ", got:" + offset + ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                              locale + ", \"" + VALIDS[k][0] +
                               "\"] Vaild RawOffset, got:" + offset);
                     }
 
@@ -126,12 +128,12 @@
                     if (offset != 0) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                                           locale + ", \"" + VALIDS[k][0] +
                                            "\"] DSTSavings should be zero, got:" + offset +
                                            ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                              locale + ", \"" + VALIDS[k][0] +
                               "\"] DSTSavings is zero.");
                     }
                 }
@@ -144,12 +146,12 @@
                     if (!tz.getID().equals("GMT")) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + INVALIDS[k] +
+                                           locale + ", \"" + INVALIDS[k] +
                                            "\"] Invalid TimeZone ID, expected:GMT, got:" +
                                            tz.getID() + ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + INVALIDS[k] +
+                              locale + ", \"" + INVALIDS[k] +
                               "\"] Valid TimeZone ID, got:" + tz.getID());
                     }
 
@@ -157,12 +159,12 @@
                     if (offset != 0) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + INVALIDS[k] +
+                                           locale + ", \"" + INVALIDS[k] +
                                            "\"] RawOffset should be zero, got:" + offset +
                                            ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + INVALIDS[k] +
+                              locale + ", \"" + INVALIDS[k] +
                               "\"] RawOffset is zero.");
                     }
 
@@ -170,12 +172,12 @@
                     if (offset != 0) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + INVALIDS[k] +
+                                           locale + ", \"" + INVALIDS[k] +
                                            "\"] DSTSavings should be zero, got:" + offset +
                                            ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + INVALIDS[k] +
+                              locale + ", \"" + INVALIDS[k] +
                               "\"] DSTSavings is zero.");
                     }
                 }
@@ -189,25 +191,25 @@
                     if (!normalizedID.equals(s)) {
                         err = true;
                         System.err.println("getDisplayName returned unexpected name: " + s +
-                                           " in " + Locale.getDefault());
+                                           " in " + locale);
                     }
                     s = tz.getDisplayName(true, tz.SHORT);
                     if (!normalizedID.equals(s)) {
                         err = true;
                         System.err.println("getDisplayName returned unexpected name: " + s +
-                                           " in " + Locale.getDefault());
+                                           " in " + locale);
                     }
                     s = tz.getDisplayName(false, tz.LONG);
                     if (!normalizedID.equals(s)) {
                         err = true;
                         System.err.println("getDisplayName returned unexpected name: " + s +
-                                           " in " + Locale.getDefault());
+                                           " in " + locale);
                     }
                     s = tz.getDisplayName(false, tz.SHORT);
                     if (!normalizedID.equals(s)) {
                         err = true;
                         System.err.println("getDisplayName returned unexpected name: " + s +
-                                           " in " + Locale.getDefault());
+                                           " in " + locale);
                     }
                 }
             }
--- a/jdk/test/java/util/TimeZone/TimeZoneRegression.java	Sat Aug 20 17:10:17 2016 +0800
+++ b/jdk/test/java/util/TimeZone/TimeZoneRegression.java	Mon Aug 22 14:24:46 2016 +0900
@@ -40,15 +40,6 @@
         new TimeZoneRegression().run(args);
     }
 
-    public void Test4052967() {
-        logln("*** CHECK TIMEZONE AGAINST HOST OS SETTING ***");
-        String id = TimeZone.getDefault().getID();
-        logln("user.timezone: " + System.getProperty("user.timezone", "<not set>"));
-        logln("TimeZone.getDefault().getID(): " + id);
-        logln(new Date().toString());
-        logln("*** THE RESULTS OF THIS TEST MUST BE VERIFIED MANUALLY ***");
-    }
-
     public void Test4073209() {
         TimeZone z1 = TimeZone.getTimeZone("PST");
         TimeZone z2 = TimeZone.getTimeZone("PST");
@@ -167,11 +158,14 @@
     }
 
     public void Test4109314() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         // test both SimpleTimeZone and ZoneInfo objects.
         // @since 1.4
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
-            return;
-        }
         sub4109314(getPST());
         sub4109314(TimeZone.getTimeZone("PST"));
     }
@@ -291,6 +285,12 @@
      * When you fix these two problems, the test passes, as expected.
      */
     public void Test4126678() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         // Note: this test depends on the PST time zone.
         TimeZone initialZone = TimeZone.getDefault();