8215913: [Test_bug]java/util/Locale/LocaleProvidersRun.java failed on de_DE and ja_JP locale.
authordzhou
Mon, 07 Jan 2019 18:48:39 -0800
changeset 53163 76f7dbf458fe
parent 53162 a242fc65ef2e
child 53164 f2140eebd91b
8215913: [Test_bug]java/util/Locale/LocaleProvidersRun.java failed on de_DE and ja_JP locale. Reviewed-by: naoto, rgoel, rriggs
test/jdk/java/util/Locale/LocaleProviders.java
test/jdk/java/util/Locale/LocaleProvidersRun.java
--- a/test/jdk/java/util/Locale/LocaleProviders.java	Tue Jan 08 10:35:06 2019 +0900
+++ b/test/jdk/java/util/Locale/LocaleProviders.java	Mon Jan 07 18:48:39 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -237,12 +237,16 @@
     }
 
     static void bug8027289Test(String expectedCodePoint) {
-        char[] expectedSymbol = Character.toChars(Integer.valueOf(expectedCodePoint, 16));
-        NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.CHINA);
-        char formatted = nf.format(7000).charAt(0);
-        System.out.println("returned: " + formatted + ", expected: " + expectedSymbol[0]);
-        if (formatted != expectedSymbol[0]) {
-            throw new RuntimeException("Unexpected Chinese currency symbol. returned: " + formatted + ", expected: " + expectedSymbol[0]);
+        if (System.getProperty("os.name").startsWith("Windows")) {
+            char[] expectedSymbol = Character.toChars(Integer.valueOf(expectedCodePoint, 16));
+            NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.CHINA);
+            char formatted = nf.format(7000).charAt(0);
+            System.out.println("returned: " + formatted + ", expected: " + expectedSymbol[0]);
+            if (formatted != expectedSymbol[0]) {
+                throw new RuntimeException(
+                        "Unexpected Chinese currency symbol. returned: "
+                                + formatted + ", expected: " + expectedSymbol[0]);
+            }
         }
     }
 }
--- a/test/jdk/java/util/Locale/LocaleProvidersRun.java	Tue Jan 08 10:35:06 2019 +0900
+++ b/test/jdk/java/util/Locale/LocaleProvidersRun.java	Mon Jan 07 18:48:39 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8008577
  *      8010666 8013086 8013233 8013903 8015960 8028771 8054482 8062006
- *      8150432
+ *      8150432 8215913
  * @summary tests for "java.locale.providers" system property
  * @library /test/lib
  * @build LocaleProviders
@@ -143,7 +143,7 @@
         //testing 8027289 fix, if the platform format default is zh_CN
         // this assumes Windows' currency symbol for zh_CN is \u00A5, the yen
         // (yuan) sign.
-        if (!defLang.equals("en") && !defCtry.equals("CN")){
+        if (defFmtLang.equals("zh") && defFmtCtry.equals("CN")) {
             testRun("JRE,HOST", "bug8027289Test", "FFE5", "", "");
             testRun("COMPAT,HOST", "bug8027289Test", "FFE5", "", "");
             testRun("HOST", "bug8027289Test", "00A5", "", "");