--- old/test/sun/text/resources/LocaleDataTest.java 2015-06-23 13:29:12.625696614 -0700
+++ new/test/sun/text/resources/LocaleDataTest.java 2015-06-23 13:29:12.352692195 -0700
@@ -35,9 +35,11 @@
* 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787
* 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
* 7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
- * 7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 8017142
- * 8037343 8055222 8042126 8074791 8075173 8080774
+ * 7114053 7074882 7040556 8008577 8013836 8021121 6192407 6931564 8027695
+ * 8017142 8037343 8055222 8042126 8074791 8075173 8080774
* @summary Verify locale data
+ * @run main LocaleDataTest
+ * @run main LocaleDataTest -cldr
*
*/
@@ -99,7 +101,7 @@
* FormatData/sr-Latn-BA/DayNames/2=utorak
*
* The command-line syntax of this test is
- * java LocaleDataTest [-w] [{ -s | }]
+ * java LocaleDataTest [-w] [{ -s | }] [-cldr]
*
* This program always sends its results to standard output. If -w is not specified,
* this program prints out only the differences between the data file and the actual
@@ -117,6 +119,9 @@
* The -nothrow option prevents the program from throwing an exception when it
* gets an error. -w implies -nothrow.
*
+ * -cldr option specifies to test CLDR locale data. The default data file name for this
+ * option is "LocaleData.cldr".
+ *
* Other command-line options can be specified, but are ignored.
*
* It's important to note what this test will NOT test. Certain changes to the locale
@@ -149,6 +154,8 @@
{
static final String TEXT_RESOURCES_PACKAGE ="sun.text.resources";
static final String UTIL_RESOURCES_PACKAGE ="sun.util.resources";
+ static final String DEFAULT_DATAFILE ="LocaleData";
+ static String cldrSuffix = "";
public static void main(String[] args) throws Exception {
@@ -169,6 +176,10 @@
else if (args[i].equals("-nothrow"))
doThrow = false;
+ else if (args[i].equals("-cldr")) {
+ cldrSuffix = ".cldr";
+ }
+
else if (args[i].equals("-s") && in == null)
in = new BufferedReader(new EscapeReader(new InputStreamReader(System.in,
"ISO8859_1")));
@@ -177,7 +188,7 @@
FileInputStream(args[i]), "ISO8859_1")));
}
if (in == null) {
- File localeData = new File(System.getProperty("test.src", "."), "LocaleData");
+ File localeData = new File(System.getProperty("test.src", "."), DEFAULT_DATAFILE + cldrSuffix);
in = new BufferedReader(new EscapeReader(new InputStreamReader(new
FileInputStream(localeData), "ISO8859_1")));
}
@@ -291,9 +302,9 @@
|| rbName.equals("CurrencyNames")
|| rbName.equals("LocaleNames")
|| rbName.equals("TimeZoneNames")) {
- fullName = UTIL_RESOURCES_PACKAGE + "." + rbName;
+ fullName = UTIL_RESOURCES_PACKAGE + cldrSuffix + "." + rbName;
} else {
- fullName = TEXT_RESOURCES_PACKAGE + "." + rbName;
+ fullName = TEXT_RESOURCES_PACKAGE + cldrSuffix + "." + rbName;
}
Locale locale;
if (use_tag) {
@@ -372,33 +383,30 @@
return null;
}
- private static final String CLDR = ".cldr";
-
/**
- * Changes baseName to its per-language package name and
+ * Changes baseName to its per-language/country package name and
* calls the super class implementation. For example,
* if the baseName is "sun.text.resources.FormatData" and locale is ja_JP,
- * the baseName is changed to "sun.text.resources.ja.FormatData". If
+ * the baseName is changed to "sun.text.resources.ja.JP.FormatData". If
* baseName contains "cldr", such as "sun.text.resources.cldr.FormatData",
- * the name is changed to "sun.text.resources.cldr.jp.FormatData".
+ * the name is changed to "sun.text.resources.cldr.ja.JP.FormatData".
*/
@Override
public String toBundleName(String baseName, Locale locale) {
String newBaseName = baseName;
String lang = locale.getLanguage();
+ String ctry = locale.getCountry();
if (lang.length() > 0) {
- if (baseName.startsWith(UTIL_RESOURCES_PACKAGE)
- || baseName.startsWith(TEXT_RESOURCES_PACKAGE)) {
+ if (baseName.startsWith(UTIL_RESOURCES_PACKAGE + cldrSuffix)
+ || baseName.startsWith(TEXT_RESOURCES_PACKAGE + cldrSuffix)) {
// Assume the lengths are the same.
if (UTIL_RESOURCES_PACKAGE.length()
!= TEXT_RESOURCES_PACKAGE.length()) {
throw new InternalError("The resources package names have different lengths.");
}
- int index = TEXT_RESOURCES_PACKAGE.length();
- if (baseName.indexOf(CLDR, index) > 0) {
- index += CLDR.length();
- }
- newBaseName = baseName.substring(0, index + 1) + lang
+ int index = (TEXT_RESOURCES_PACKAGE + cldrSuffix).length();
+ ctry = (ctry.length() == 2) ? ("." + ctry) : "";
+ newBaseName = baseName.substring(0, index + 1) + lang + ctry
+ baseName.substring(index);
}
}