changeset 51735:9f310b672b8c

8206980: ZonedDateTime could not parse timezone name with zh_CN locale correctly. Reviewed-by: rriggs
author naoto
date Wed, 11 Jul 2018 14:47:43 -0700
parents 175187a33b83
children 53b0d5ad71db
files src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java test/jdk/java/time/test/java/time/format/TestZoneTextPrinterParser.java
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java	Tue Jul 10 15:29:25 2018 -0700
+++ b/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java	Wed Jul 11 14:47:43 2018 -0700
@@ -130,7 +130,8 @@
 
         // Fill in for the empty names.
         // English names are prefilled for performance.
-        if (locale.getLanguage() != "en") {
+        if (!locale.equals(Locale.ENGLISH) &&
+            !locale.equals(Locale.US)) {
             for (int zoneIndex = 0; zoneIndex < ret.length; zoneIndex++) {
                 deriveFallbackNames(ret[zoneIndex], locale);
             }
--- a/test/jdk/java/time/test/java/time/format/TestZoneTextPrinterParser.java	Tue Jul 10 15:29:25 2018 -0700
+++ b/test/jdk/java/time/test/java/time/format/TestZoneTextPrinterParser.java	Wed Jul 11 14:47:43 2018 -0700
@@ -49,7 +49,7 @@
 
 /*
  * @test
- * @bug 8081022 8151876 8166875 8189784
+ * @bug 8081022 8151876 8166875 8189784 8206980
  * @key randomness
  */
 
@@ -156,12 +156,15 @@
             {"America/Chicago",  "CST",                   none,      Locale.ENGLISH, TextStyle.SHORT},
             {"Asia/Taipei",      "CST",                   preferred, Locale.ENGLISH, TextStyle.SHORT},
             {"Australia/South",  "ACST",                  preferred_s, Locale.ENGLISH, TextStyle.SHORT},
-            {"America/Chicago",  "CDT",                   none,        Locale.ENGLISH, TextStyle.SHORT},
+            {"America/Chicago",  "CDT",                   none,      Locale.ENGLISH, TextStyle.SHORT},
             {"Asia/Shanghai",    "CDT",                   preferred_s, Locale.ENGLISH, TextStyle.SHORT},
-            {"America/Juneau",   "AKST",                  none,        Locale.ENGLISH, TextStyle.SHORT},
-            {"America/Juneau",   "AKDT",                  none,        Locale.ENGLISH, TextStyle.SHORT},
-            {"Pacific/Honolulu", "HST",                   none,        Locale.ENGLISH, TextStyle.SHORT},
-            {"America/Halifax",  "AST",                   none,        Locale.ENGLISH, TextStyle.SHORT},
+            {"America/Juneau",   "AKST",                  none,      Locale.ENGLISH, TextStyle.SHORT},
+            {"America/Juneau",   "AKDT",                  none,      Locale.ENGLISH, TextStyle.SHORT},
+            {"Pacific/Honolulu", "HST",                   none,      Locale.ENGLISH, TextStyle.SHORT},
+            {"America/Halifax",  "AST",                   none,      Locale.ENGLISH, TextStyle.SHORT},
+            {"Z",                "Z",                     none,      Locale.ENGLISH, TextStyle.SHORT},
+            {"Z",                "Z",                     none,      Locale.US,      TextStyle.SHORT},
+            {"Z",                "Z",                     none,      Locale.CANADA,  TextStyle.SHORT},
        };
     }