8027289: [Windows zh_CN] NumberFormat: Incorrect sequence of loading currency symbol
Reviewed-by: erikj
--- a/jdk/make/gensrc/GensrcLocaleDataMetaInfo.gmk Tue Jan 28 20:10:11 2014 +0000
+++ b/jdk/make/gensrc/GensrcLocaleDataMetaInfo.gmk Wed Feb 19 09:17:28 2014 -0800
@@ -65,6 +65,13 @@
$1_EN_LOCALES := $$(filter $(EN_LOCALES), $$($1_LOCALES))
$1_NON_EN_LOCALES := $$(filter-out $(EN_LOCALES), $$($1_LOCALES))
+ # Special handling for Chinese locales to include implicit scripts
+ $1_NON_EN_LOCALES := $$(subst zh-CN,zh-CN$$(SPACE)zh-Hans-CN, $$($1_NON_EN_LOCALES))
+ $1_NON_EN_LOCALES := $$(subst zh-SG,zh-SG$$(SPACE)zh-Hans-SG, $$($1_NON_EN_LOCALES))
+ $1_NON_EN_LOCALES := $$(subst zh-HK,zh-HK$$(SPACE)zh-Hant-HK, $$($1_NON_EN_LOCALES))
+ $1_NON_EN_LOCALES := $$(subst zh-MO,zh-MO$$(SPACE)zh-Hant-MO, $$($1_NON_EN_LOCALES))
+ $1_NON_EN_LOCALES := $$(subst zh-TW,zh-TW$$(SPACE)zh-Hant-TW, $$($1_NON_EN_LOCALES))
+
ALL_EN_LOCALES += $$($1_EN_LOCALES)
ALL_NON_EN_LOCALES += $$($1_NON_EN_LOCALES)
--- a/jdk/test/java/util/Locale/LocaleProviders.java Tue Jan 28 20:10:11 2014 +0000
+++ b/jdk/test/java/util/Locale/LocaleProviders.java Wed Feb 19 09:17:28 2014 -0800
@@ -68,6 +68,10 @@
bug8013903Test();
break;
+ case "bug8027289Test":
+ bug8027289Test(args[1]);
+ break;
+
default:
throw new RuntimeException("Test method '"+methodName+"' not found.");
}
@@ -232,4 +236,14 @@
}
}
}
+
+ 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]);
+ }
+ }
}
--- a/jdk/test/java/util/Locale/LocaleProviders.sh Tue Jan 28 20:10:11 2014 +0000
+++ b/jdk/test/java/util/Locale/LocaleProviders.sh Wed Feb 19 09:17:28 2014 -0800
@@ -314,4 +314,22 @@
PARAM3=
runTest
+# 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 [ "${DEFFMTLANG}" = "zh" ] && [ "${DEFFMTCTRY}" = "CN" ]; then
+ METHODNAME=bug8027289Test
+ PREFLIST=JRE,HOST
+ PARAM1=FFE5
+ PARAM2=
+ PARAM3=
+ runTest
+ METHODNAME=bug8027289Test
+ PREFLIST=HOST
+ PARAM1=00A5
+ PARAM2=
+ PARAM3=
+ runTest
+fi
+
exit $result