8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
Reviewed-by: naoto
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/Bug6299235/Bug6299235Test.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2007, 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 6299235 8210408
+ * @summary test Bug 6299235 to make sure the third-party provided sun resources
+ * could be picked up.
+ * @modules java.desktop
+ * @library patches
+ * @build java.desktop/sun.awt.resources.awt_ru_RU
+ * @run main Bug6299235Test
+ */
+
+import java.awt.Toolkit;
+import java.util.Locale;
+
+/*
+ * After introducing CoreResourceBundleControl for Awt/Swing resources
+ * loading, non-existent resources won't be actually searched from
+ * bootclasspath and extension directory. But we should still fallback
+ * to the current behavior which allows the third-part to provide their
+ * own version of awt resources, for example even though we never claim
+ * we support it yet.
+ * Look into bug 6299235 for more details.
+ */
+
+public class Bug6299235Test {
+ private static final Locale ru_RU = new Locale("ru", "RU");
+
+ public static void main(String args[]) {
+ Locale locale = Locale.getDefault();
+ try {
+ Locale.setDefault(ru_RU);
+ // Get the value for the test key "foo"
+ String value = Toolkit.getProperty("foo", "undefined");
+ if (!value.equals("bar")) {
+ throw new RuntimeException("key = foo, value = " + value);
+ }
+ // Get the value for a valid key "AWT.enter"
+ value = Toolkit.getProperty("AWT.enter", "DO NOT ENTER");
+ if (value.equals("DO NOT ENTER")) {
+ throw new RuntimeException("AWT.enter undefined.");
+ }
+ } finally {
+ // Restore the default Locale
+ Locale.setDefault(locale);
+ }
+ System.out.println("Bug6299235Test passed");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/Bug6299235/patches/java.desktop/sun/awt/resources/awt_ru_RU.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+package sun.awt.resources;
+
+import java.util.ListResourceBundle;
+
+/**
+ * A faked sun.awt.resources.awt_ru_RU resource file.
+ */
+public class awt_ru_RU extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "foo", "bar" }
+ };
+ }
+}
--- a/test/jdk/java/util/ResourceBundle/Bug6299235Test.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2007, 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.awt.Toolkit;
-import java.util.Locale;
-
-/*
- * After introducing CoreResourceBundleControl for Awt/Swing resources
- * loading, non-existent resources won't be actually searched from
- * bootclasspath and extension directory. But we should still fallback
- * to the current behavior which allows the third-part to provide their
- * own version of awt resources, for example even though we never claim
- * we support it yet.
- * Look into bug 6299235 for more details.
- */
-
-public class Bug6299235Test {
- static final Locale ru_RU = new Locale("ru", "RU");
-
- public static void main(String args[]) {
- Locale locale = Locale.getDefault();
- try {
- Locale.setDefault(ru_RU);
- // Get the value for the test key "foo"
- String value = Toolkit.getProperty("foo", "undefined");
- if (!value.equals("bar")) {
- throw new RuntimeException("key = foo, value = " + value);
- }
- // Get the value for a valid key "AWT.enter"
- value = Toolkit.getProperty("AWT.enter", "DO NOT ENTER");
- if (value.equals("DO NOT ENTER")) {
- throw new RuntimeException("AWT.enter undefined.");
- }
- } finally {
- // Restore the default Locale
- Locale.setDefault(locale);
- }
- System.out.println("Bug6299235Test passed");
- }
-}
--- a/test/jdk/java/util/ResourceBundle/Bug6299235Test.sh Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2007, 2013, 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.
-#
-#!/bin/sh
-#
-# @test
-# @bug 6299235
-# @summary test Bug 6299235 to make sure the third-party provided sun resources could be picked up.
-# @modules java.desktop
-# @build Bug6299235Test
-# @run shell Bug6299235Test.sh
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- PATHSEP=":"
- FILESEP="/"
- ;;
- Windows* | CYGWIN* )
- PATHSEP=";"
- FILESEP="\\"
- ;;
- * )
- echo "${OS} is unrecognized system!"
- exit 1;
- ;;
-esac
-
-if [ -z "${TESTSRC}" ]; then
- echo "TESTSRC undefined: defaulting to ."
- TESTSRC=.
-fi
-
-if [ -z "${TESTJAVA}" ]; then
- echo "TESTJAVA undefined: can't continue."
- exit 1
-fi
-
-echo "TESTJAVA=${TESTJAVA}"
-echo "TESTSRC=${TESTSRC}"
-echo "TESTCLASSES=${TESTCLASSES}"
-
-PATCHDIR=${TESTCLASSES}/patches
-rm -rf $PATCHDIR
-mkdir -p $PATCHDIR/java.desktop
-
-cd ${PATCHDIR}/java.desktop
-${TESTJAVA}/bin/jar xf ${TESTSRC}/awtres.jar
-
-echo
-${TESTJAVA}/bin/java ${TESTVMOPTS} --patch-module java.desktop=${PATCHDIR}/java.desktop \
- -cp ${TESTCLASSES} Bug6299235Test
-
-if [ $? -ne 0 ]
- then
- echo "Test fails: exception thrown!"
- exit 1
-fi
-
-exit 0
Binary file test/jdk/java/util/ResourceBundle/awtres.jar has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/ModuleTestUtil.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2018, 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.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.stream.Stream;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.process.ProcessTools;
+
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
+public class ModuleTestUtil {
+
+ private ModuleTestUtil() {
+ // Private constructor to prevent class instantiation
+ }
+
+ /**
+ * Compile all the java sources and copy the resource files in the module.
+ *
+ * @param src path to the source directory
+ * @param dest path to the destination directory
+ * @param mn module name
+ * @param resFormat resource format
+ */
+ public static void prepareModule(Path src, Path dest, String mn,
+ String resFormat) {
+ compileModule(src, dest, mn);
+ copyResFiles(src, dest, mn, resFormat);
+ }
+
+ /**
+ * Compile all the java sources in the module.
+ *
+ * @param src path to the source directory
+ * @param dest path to the destination directory
+ * @param mn module name
+ */
+ public static void compileModule(Path src, Path dest, String mn) {
+ try {
+ boolean compiled = CompilerUtils.compile(src.resolve(mn), dest,
+ "--module-source-path", src.toString());
+ if (!compiled) {
+ throw new RuntimeException("Compile module " + mn + " failed.");
+ }
+ } catch (IOException e) {
+ throw new RuntimeException("Compile module " + mn + " failed.");
+ }
+ }
+
+ /**
+ * Compile all the java sources in the unnamed package.
+ *
+ * @param src path to the source directory
+ * @param dest path to the destination directory
+ * @param pn package name
+ */
+ public static void compilePkg(Path src, Path dest, String pn) {
+ try {
+ boolean compiled = CompilerUtils.compile(src.resolve(pn),
+ dest.resolve(pn));
+ if (!compiled) {
+ throw new RuntimeException("Compile package " + pn + " failed.");
+ }
+ } catch (IOException e) {
+ throw new RuntimeException("Compile package " + pn + " failed.");
+ }
+ }
+
+ /**
+ * Copy all the resource files.
+ *
+ * @param src path to the source directory
+ * @param dest path to the destination directory
+ * @param mn module name
+ * @param resFormat resource format
+ */
+ public static void copyResFiles(Path src, Path dest, String mn,
+ String resFormat) {
+ try (Stream<Path> stream = Files.walk(src.resolve(mn))
+ .filter(path -> path.toString().endsWith(resFormat))) {
+ stream.forEach(f -> {
+ String resName = f.toString();
+ String relativePath = resName.substring(src.toString().length());
+ Path destFile = Paths.get(dest.toString() + relativePath);
+ try {
+ Path destParentDir = destFile.getParent();
+ if (Files.notExists(destParentDir)) {
+ Files.createDirectories(destParentDir);
+ }
+ Files.copy(f, destFile, REPLACE_EXISTING);
+ } catch (IOException e) {
+ throw new RuntimeException("Copy " + f.toString() + " to "
+ + destFile.toString() + " failed.");
+ }
+ });
+ } catch (IOException e) {
+ throw new RuntimeException("Copy resource files failed.");
+ }
+ }
+
+ /**
+ * Run the module test.
+ *
+ * @param mp module path
+ * @param mn module name
+ * @param localeList locale list
+ */
+ public static void runModule(String mp, String mn, List<String> localeList)
+ throws Throwable {
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
+ launcher.addToolArg("-p")
+ .addToolArg(mp)
+ .addToolArg("-m")
+ .addToolArg(mn);
+ localeList.forEach(launcher::addToolArg);
+
+ int exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ if (exitCode != 0) {
+ throw new RuntimeException("Execution of the test failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+ }
+
+ /**
+ * Run the module test with a jar file specified by the classpath.
+ *
+ * @param cp classpath
+ * @param mp module path
+ * @param mn module name
+ * @param localeList locale list
+ * @param expected expected execution status
+ */
+ public static void runModuleWithCp(String cp, String mp, String mn,
+ List<String> localeList, boolean expected) throws Throwable {
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
+ launcher.addToolArg("-cp")
+ .addToolArg(cp)
+ .addToolArg("-p")
+ .addToolArg(mp)
+ .addToolArg("-m")
+ .addToolArg(mn);
+ localeList.forEach(launcher::addToolArg);
+
+ int exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ if (expected) {
+ if (exitCode != 0) {
+ throw new RuntimeException("Execution of the test loads bundles "
+ + "from the jar file specified by the class-path failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+ } else {
+ if (exitCode == 0) {
+ throw new RuntimeException("Execution of the test not loads bundles "
+ + "from the jar file specified by the class-path failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+ }
+ }
+}
\ No newline at end of file
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/appbasic.sh Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-# @test
-# @bug 8044767
-# @summary Basic test for ResourceBundle with modules; named module "test"
-# contains resource bundles for root and en, and separate named modules
-# "eubundles" and "asiabundles" contain other resource bundles.
-
-set -e
-
-if [ -z "$TESTJAVA" ]; then
- if [ $# -lt 1 ]; then exit 1; fi
- TESTJAVA="$1"; shift
- COMPILEJAVA="${TESTJAVA}"
- TESTSRC="`pwd`"
- TESTCLASSES="`pwd`"
-fi
-
-JAVAC="$COMPILEJAVA/bin/javac"
-JAVA="$TESTJAVA/bin/java"
-
-
-for I in eu asia
-do
- B=${I}bundles
- mkdir -p mods/$B
- CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
- if [ "x$CLASSES" != x ]; then
- $JAVAC -g -d mods --module-source-path $TESTSRC/src -cp mods/test $CLASSES
- fi
- PROPS="`(cd $TESTSRC/src/$B; find . -name '*.properties')`"
- if [ "x$PROPS" != x ]; then
- for P in $PROPS
- do
- D=`dirname $P`
- mkdir -p mods/$B/$D
- cp $TESTSRC/src/$B/$P mods/$B/$D/
- done
- fi
-done
-
-mkdir -p mods/test
-$JAVAC -g -d mods --module-source-path $TESTSRC/src `find $TESTSRC/src/test -name "*.java"`
-
-$JAVA -p mods -m test/jdk.test.Main de fr ja zh-tw en de
-
-exit $?
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources.asia;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.Set;
-import java.util.spi.AbstractResourceBundleProvider;
-
-import jdk.test.resources.spi.MyResourcesProvider;
-
-public class MyResourcesAsia extends AbstractResourceBundleProvider
- implements MyResourcesProvider
-{
- private static Set<Locale> asiaLocales
- = Set.of(Locale.JAPANESE, Locale.CHINESE, Locale.TAIWAN);
-
- @Override
- public String toBundleName(String baseName, Locale locale) {
- String bundleName = super.toBundleName(baseName, locale);
- if (asiaLocales.contains(locale)) {
- int index = bundleName.lastIndexOf('.');
- return bundleName.substring(0, index + 1) + "asia" + bundleName.substring(index);
- }
- return bundleName;
- }
-
- @Override
- public ResourceBundle getBundle(String baseName, Locale locale) {
- if (asiaLocales.contains(locale)) {
- return super.getBundle(baseName, locale);
- }
- return null;
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/asiabundles/jdk/test/resources/asia/MyResources_ja.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=ja: message
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/asiabundles/jdk/test/resources/asia/MyResources_zh.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=zh: message
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/asiabundles/jdk/test/resources/asia/MyResources_zh_TW.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=zh-TW: message
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/asiabundles/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module asiabundles {
- requires test;
-
- provides jdk.test.resources.spi.MyResourcesProvider
- with jdk.test.resources.asia.MyResourcesAsia;
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/eubundles/jdk/test/resources/eu/MyResourcesEU.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources.eu;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.Set;
-import java.util.spi.AbstractResourceBundleProvider;
-
-import jdk.test.resources.spi.MyResourcesProvider;
-
-public class MyResourcesEU extends AbstractResourceBundleProvider
- implements MyResourcesProvider
-{
- private static final Set<Locale> euLocales = Set.of(Locale.GERMAN, Locale.FRENCH);
-
- public MyResourcesEU() {
- super("java.class");
- }
-
- @Override
- public String toBundleName(String baseName, Locale locale) {
- String bundleName = super.toBundleName(baseName, locale);
- if (euLocales.contains(locale)) {
- int index = bundleName.lastIndexOf('.');
- return bundleName.substring(0, index + 1) + "eu" + bundleName.substring(index);
- }
- return bundleName;
- }
-
- @Override
- public ResourceBundle getBundle(String baseName, Locale locale) {
- if (euLocales.contains(locale)) {
- return super.getBundle(baseName, locale);
- }
- return null;
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/eubundles/jdk/test/resources/eu/MyResources_de.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources.eu;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_de extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "de: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/eubundles/jdk/test/resources/eu/MyResources_fr.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources.eu;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_fr extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "fr: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/eubundles/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module eubundles {
- requires test;
-
- provides jdk.test.resources.spi.MyResourcesProvider
- with jdk.test.resources.eu.MyResourcesEU;
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/Main.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-public class Main {
- public static void main(String[] args) throws Exception {
- int errors = 0;
-
- for (String loctag : args) {
- Locale locale = Locale.forLanguageTag(loctag);
- if (locale.equals(Locale.ROOT)) {
- continue;
- }
- ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources", locale);
- String tag = locale.toLanguageTag(); // normalized
- String value = rb.getString("key");
- System.out.println("locale = " + tag + ", value = " + value);
- if (!value.startsWith(tag + ':')) {
- errors++;
- }
- }
- if (errors > 0) {
- throw new RuntimeException(errors + " errors");
- }
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyResources.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "root: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyResourcesProviderImpl.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.spi.AbstractResourceBundleProvider;
-import jdk.test.resources.spi.MyResourcesProvider;
-
-public class MyResourcesProviderImpl extends AbstractResourceBundleProvider
- implements MyResourcesProvider
-{
- public MyResourcesProviderImpl() {
- super("java.class");
- }
- @Override
- public ResourceBundle getBundle(String baseName, Locale locale) {
- if (locale.equals(Locale.ENGLISH) || locale.equals(Locale.ROOT)) {
- return super.getBundle(baseName, locale);
- }
- return null;
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyResources_en.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_en extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "en: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/spi/MyResourcesProvider.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources.spi;
-
-import java.util.spi.ResourceBundleProvider;
-
-public interface MyResourcesProvider extends ResourceBundleProvider {
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic/src/test/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-module test {
- exports jdk.test.resources.spi to eubundles, asiabundles;
- uses jdk.test.resources.spi.MyResourcesProvider;
- provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.MyResourcesProviderImpl;
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/appbasic2.sh Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-# @test
-# @bug 8044767
-# @summary Basic test for ResourceBundle with modules; named module "test"
-# contains resource bundles for root and en, and separate named modules
-# "eubundles" and "asiabundles" contain other resource bundles.
-
-set -e
-
-if [ -z "$TESTJAVA" ]; then
- if [ $# -lt 1 ]; then exit 1; fi
- TESTJAVA="$1"; shift
- COMPILEJAVA="${TESTJAVA}"
- TESTSRC="`pwd`"
- TESTCLASSES="`pwd`"
-fi
-
-JAVAC="$COMPILEJAVA/bin/javac"
-JAVA="$TESTJAVA/bin/java"
-
-
-for I in eu asia
-do
- B=${I}bundles
- mkdir -p mods/$B
- CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
- if [ "x$CLASSES" != x ]; then
- $JAVAC -g -d mods --module-source-path $TESTSRC/src -cp mods/test $CLASSES
- fi
- PROPS="`(cd $TESTSRC/src/$B; find . -name '*.properties')`"
- if [ "x$PROPS" != x ]; then
- for P in $PROPS
- do
- D=`dirname $P`
- mkdir -p mods/$B/$D
- cp $TESTSRC/src/$B/$P mods/$B/$D/
- done
- fi
-done
-
-mkdir -p mods/test
-$JAVAC -g -d mods --module-source-path $TESTSRC/src `find $TESTSRC/src/test -name "*.java"`
-
-$JAVA -p mods -m test/jdk.test.Main de fr ja zh-tw en de
-
-exit $?
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources.asia;
-
-import java.util.Locale;
-import jdk.test.resources.spi.MyResourcesProvider;
-
-public class MyResourcesAsia extends MyResourcesProvider {
- public MyResourcesAsia() {
- super("java.properties");
- }
-
- @Override
- protected String toBundleName(String baseName, Locale locale) {
- // Convert baseName to its properties resource name for the given locale
- // e.g., jdk.test.resources.MyResources -> jdk/test/resources/asia/MyResources_zh_TW
- StringBuilder sb = new StringBuilder();
- int index = baseName.lastIndexOf('.');
- sb.append(baseName.substring(0, index))
- .append(".asia")
- .append(baseName.substring(index));
- String lang = locale.getLanguage();
- if (!lang.isEmpty()) {
- sb.append('_').append(lang);
- String country = locale.getCountry();
- if (!country.isEmpty()) {
- sb.append('_').append(country);
- }
- }
- return sb.toString();
- }
-
- @Override
- protected boolean isSupportedInModule(Locale locale) {
- return locale.equals(Locale.JAPANESE)
- || locale.equals(Locale.CHINESE) || locale.equals(Locale.TAIWAN);
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/asiabundles/jdk/test/resources/asia/MyResources_ja.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=ja: message
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/asiabundles/jdk/test/resources/asia/MyResources_zh.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=zh: message
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/asiabundles/jdk/test/resources/asia/MyResources_zh_TW.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=zh-TW: message
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/asiabundles/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module asiabundles {
- requires test;
-
- provides jdk.test.resources.spi.MyResourcesProvider
- with jdk.test.resources.asia.MyResourcesAsia;
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/eubundles/jdk/test/resources/eu/MyResourcesEU.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources.eu;
-
-import java.util.Locale;
-import jdk.test.resources.spi.MyResourcesProvider;
-
-public class MyResourcesEU extends MyResourcesProvider {
- public MyResourcesEU() {
- super("java.class");
- }
-
- @Override
- protected String toBundleName(String baseName, Locale locale) {
- int index = baseName.lastIndexOf('.');
- String bundleName = baseName.substring(0, index) + ".eu" + baseName.substring(index)
- + '_' + locale.getLanguage();
- return bundleName;
- }
-
- @Override
- protected boolean isSupportedInModule(Locale locale) {
- return locale.equals(Locale.GERMAN) || locale.equals(Locale.FRENCH);
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/eubundles/jdk/test/resources/eu/MyResources_de.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources.eu;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_de extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "de: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/eubundles/jdk/test/resources/eu/MyResources_fr.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources.eu;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_fr extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "fr: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/eubundles/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module eubundles {
- requires test;
-
- provides jdk.test.resources.spi.MyResourcesProvider
- with jdk.test.resources.eu.MyResourcesEU;
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/test/jdk/test/Main.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-public class Main {
- public static void main(String[] args) throws Exception {
- int errors = 0;
-
- for (String loctag : args) {
- Locale locale = Locale.forLanguageTag(loctag);
- if (locale.equals(Locale.ROOT)) {
- continue;
- }
- ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources", locale);
- String tag = locale.toLanguageTag(); // normalized
- String value = rb.getString("key");
- System.out.println("locale = " + tag + ", value = " + value);
- if (!value.startsWith(tag + ':')) {
- errors++;
- }
- }
- if (errors > 0) {
- throw new RuntimeException(errors + " errors");
- }
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/test/jdk/test/resources/MyResources.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "root: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/test/jdk/test/resources/MyResourcesProviderImpl.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.Locale;
-import jdk.test.resources.spi.MyResourcesProvider;
-
-public class MyResourcesProviderImpl extends MyResourcesProvider {
- public MyResourcesProviderImpl() {
- super("java.class");
- }
-
- @Override
- protected String toBundleName(String baseName, Locale locale) {
- return locale.equals(Locale.ROOT) ? baseName : baseName + '_' + locale.getLanguage();
- }
-
- @Override
- protected boolean isSupportedInModule(Locale locale) {
- return locale.equals(Locale.ENGLISH) || locale.equals(Locale.ROOT);
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/test/jdk/test/resources/MyResources_en.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_en extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "en: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/test/jdk/test/resources/spi/MyResourcesProvider.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources.spi;
-
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.spi.AbstractResourceBundleProvider;
-
-public abstract class MyResourcesProvider extends AbstractResourceBundleProvider {
- protected MyResourcesProvider(String... formats) {
- super(formats);
- }
-
- @Override
- public ResourceBundle getBundle(String baseName, Locale locale) {
- if (isSupportedInModule(locale)) {
- return super.getBundle(baseName, locale);
- }
- return null;
- }
-
- protected abstract boolean isSupportedInModule(Locale locale);
-}
--- a/test/jdk/java/util/ResourceBundle/modules/appbasic2/src/test/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module test {
- exports jdk.test.resources.spi to eubundles, asiabundles;
- uses jdk.test.resources.spi.MyResourcesProvider;
- provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.MyResourcesProviderImpl;
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2015, 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8044767 8139067 8210408
+ * @summary Basic tests for ResourceBundle with modules:
+ * 1) Named module "test" contains resource bundles for root and en,
+ * and separate named modules "eubundles" and "asiabundles" contain
+ * other resource bundles.
+ * 2) ResourceBundle.getBundle caller is in named module "test",
+ * resource bundles are grouped in main (module "mainbundles"),
+ * EU (module "eubundles"), and Asia (module "asiabundles").
+ * 3) ResourceBundle.getBundle caller is in named module "test" and all
+ * resource bundles are in single named module "bundles".
+ * 4) ResourceBundle.getBundle caller is in named module "test" and all
+ * resource bundles in xml format are in single named module "bundles".
+ * 5) Resource bundles in a local named module with no ResourceBundleProviders.
+ * @library /test/lib
+ * ..
+ * @build jdk.test.lib.JDKToolLauncher
+ * jdk.test.lib.Utils
+ * jdk.test.lib.compiler.CompilerUtils
+ * jdk.test.lib.process.ProcessTools
+ * ModuleTestUtil
+ * @run testng BasicTest
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
+import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.process.ProcessTools;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static jdk.test.lib.Asserts.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+@Test
+public class BasicTest {
+ private static final String SRC_DIR_APPBASIC = "srcAppbasic";
+ private static final String SRC_DIR_APPBASIC2 = "srcAppbasic2";
+ private static final String SRC_DIR_BASIC = "srcBasic";
+ private static final String SRC_DIR_SIMPLE = "srcSimple";
+ private static final String SRC_DIR_XML = "srcXml";
+ private static final String SRC_DIR_MODLOCAL = "srcModlocal";
+
+ private static final String MODS_DIR_APPBASIC = "modsAppbasic";
+ private static final String MODS_DIR_APPBASIC2 = "modsAppbasic2";
+ private static final String MODS_DIR_BASIC = "modsBasic";
+ private static final String MODS_DIR_SIMPLE = "modsSimple";
+ private static final String MODS_DIR_XML = "modsXml";
+ private static final String MODS_DIR_MODLOCAL = "modsModlocal";
+
+ private static final String EXTRA_JAR_BASIC = "extra_basic.jar";
+ private static final String EXTRA_JAR_MODLOCAL = "extra_modlocal.jar";
+
+ private static final List<String> LOCALE_LIST = List.of("de", "fr", "ja",
+ "zh-tw", "en", "de");
+ private static final List<String> LOCALE_LIST_BASIC = List.of("de", "fr",
+ "ja", "ja-jp", "zh-tw", "en", "de", "ja-jp");
+
+ private static final List<String> MODULE_LIST = List.of("asiabundles",
+ "eubundles", "test");
+ private static final List<String> MODULE_LIST_BASIC = List.of("mainbundles",
+ "asiabundles", "eubundles", "test");
+ private static final List<String> MODULE_LIST_SIMPLE = List.of("bundles", "test");
+
+ private static final String MAIN = "test/jdk.test.Main";
+
+ @DataProvider(name = "basicTestData")
+ Object[][] basicTestData() {
+ return new Object[][] {
+ // Named module "test" contains resource bundles for root and en,
+ // and separate named modules "eubundles" and "asiabundles"
+ // contain other resource bundles.
+ {SRC_DIR_APPBASIC, MODS_DIR_APPBASIC, MODULE_LIST, LOCALE_LIST,
+ ".properties"},
+ {SRC_DIR_APPBASIC2, MODS_DIR_APPBASIC2, MODULE_LIST, LOCALE_LIST,
+ ".properties"},
+
+ // Resource bundles are grouped in main (module "mainbundles"),
+ // EU (module "eubundles"), and Asia (module "asiabundles").
+ {SRC_DIR_BASIC, MODS_DIR_BASIC, MODULE_LIST_BASIC, LOCALE_LIST_BASIC,
+ ".properties"},
+
+ // All resource bundles are in single named module "bundles".
+ {SRC_DIR_SIMPLE, MODS_DIR_SIMPLE, MODULE_LIST_SIMPLE, LOCALE_LIST,
+ ".properties"},
+
+ // All resource bundles in xml format are in single named
+ // module "bundles".
+ {SRC_DIR_XML, MODS_DIR_XML, MODULE_LIST_SIMPLE, LOCALE_LIST, ".xml"},
+
+ // Resource bundles local in named module "test".
+ {SRC_DIR_MODLOCAL, MODS_DIR_MODLOCAL, List.of("test"), LOCALE_LIST,
+ ".properties"},
+ };
+ }
+
+ @Test(dataProvider = "basicTestData")
+ public void runBasicTest(String src, String mod, List<String> moduleList,
+ List<String> localeList, String resFormat) throws Throwable {
+ Path srcPath = Paths.get(Utils.TEST_SRC, src);
+ Path modPath = Paths.get(Utils.TEST_CLASSES, mod);
+ moduleList.forEach(mn -> ModuleTestUtil.prepareModule(srcPath, modPath,
+ mn, resFormat));
+ ModuleTestUtil.runModule(modPath.toString(), MAIN, localeList);
+ }
+
+ @Test
+ public void RunBasicTestWithCp() throws Throwable {
+ Path jarPath = Paths.get(Utils.TEST_CLASSES, EXTRA_JAR_BASIC);
+ Path srcPath = Paths.get(Utils.TEST_SRC, SRC_DIR_BASIC);
+ Path modPath = Paths.get(Utils.TEST_CLASSES, MODS_DIR_BASIC);
+ Path classPath = Paths.get(Utils.TEST_CLASSES).resolve("classes")
+ .resolve("basic");
+
+ jarBasic(srcPath, classPath, jarPath);
+ // jdk.test.Main should NOT load bundles from the jar file specified
+ // by the class-path.
+ ModuleTestUtil.runModuleWithCp(jarPath.toString(), modPath.toString(),
+ MAIN, List.of("es", "vi"), false);
+ }
+
+ @Test
+ public void runModLocalTestWithCp() throws Throwable {
+ Path jarPath = Paths.get(Utils.TEST_CLASSES, EXTRA_JAR_MODLOCAL);
+ Path srcPath = Paths.get(Utils.TEST_SRC, SRC_DIR_MODLOCAL);
+ Path modPath = Paths.get(Utils.TEST_CLASSES, MODS_DIR_MODLOCAL);
+
+ jarModLocal(srcPath, jarPath);
+ // jdk.test.Main should load bundles from the jar file specified by
+ // the class-path.
+ ModuleTestUtil.runModuleWithCp(jarPath.toString(), modPath.toString(),
+ MAIN, List.of("vi"), true);
+ }
+
+ /**
+ * Create extra_basic.jar to be added to the class path. It contains .class
+ * and .properties resource bundles.
+ */
+ private static void jarBasic(Path srcPath, Path classPath, Path jarPath)
+ throws Throwable {
+ boolean compiled = CompilerUtils.compile(srcPath.resolve("extra"),
+ classPath);
+ assertTrue(compiled, "Compile Java files for extra_basic.jar failed.");
+
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jar");
+ launcher.addToolArg("-cf")
+ .addToolArg(jarPath.toString())
+ .addToolArg("-C")
+ .addToolArg(classPath.toString())
+ .addToolArg("jdk/test/resources/eu")
+ .addToolArg("-C")
+ .addToolArg(srcPath.resolve("extra").toString())
+ .addToolArg("jdk/test/resources/asia");
+
+ int exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ assertEquals(exitCode, 0, "Create extra_basic.jar failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+
+ /**
+ * Create extra_modlocal.jar to be added to the class path. Expected
+ * properties files are picked up from the class path.
+ */
+ private static void jarModLocal(Path srcPath, Path jarPath) throws Throwable {
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jar");
+ launcher.addToolArg("-cf")
+ .addToolArg(jarPath.toString())
+ .addToolArg("-C")
+ .addToolArg(srcPath.resolve("extra").toString())
+ .addToolArg("jdk/test/resources");
+
+ int exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ assertEquals(exitCode, 0, "Create extra_modlocal.jar failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+}
\ No newline at end of file
--- a/test/jdk/java/util/ResourceBundle/modules/basic/basic.sh Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-# @test
-# @bug 8044767 8139067
-# @summary Basic test case for ResourceBundle with modules;
-# ResourceBundle.getBundle caller is in module named "test",
-# resource bundles are grouped in main (module "mainbundles"),
-# EU (module "eubundles"), and Asia (module "asiabundles").
-# Also adds a jar file containing resource bundles to the class path.
-
-set -e
-
-if [ -z "$TESTJAVA" ]; then
- if [ $# -lt 1 ]; then exit 1; fi
- TESTJAVA="$1"; shift
- COMPILEJAVA="${TESTJAVA}"
- TESTSRC="`pwd`"
- TESTCLASSES="`pwd`"
-fi
-
-JAVAC="$COMPILEJAVA/bin/javac"
-JAR="$COMPILEJAVA/bin/jar"
-JAVA="$TESTJAVA/bin/java"
-
-rm -rf mods
-
-CP=
-for I in main eu asia
-do
- B=${I}bundles
- mkdir -p mods/$B
- CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
- if [ "x$CLASSES" != x ]; then
- $JAVAC -g -d mods --module-source-path $TESTSRC/src $CP $CLASSES
- fi
- PROPS="`(cd $TESTSRC/src/$B; find . -name '*.properties')`"
- if [ "x$PROPS" != x ]; then
- for P in $PROPS
- do
- D=`dirname $P`
- mkdir -p mods/$B/$D
- cp $TESTSRC/src/$B/$P mods/$B/$D/
- done
- fi
- CP="-cp mods/mainbundles"
-done
-
-mkdir -p mods/test
-$JAVAC -g -cp mods/mainbundles -d mods --module-source-path $TESTSRC/src \
- `find $TESTSRC/src/test -name "*.java"`
-
-# Create a jar to be added to the class path. Expected only properties files are
-# picked up from the class path.
-rm -f extra.jar
-mkdir -p classes
-$JAVAC -d classes $TESTSRC/src/extra/jdk/test/resources/eu/*.java
-$JAR -cf extra.jar -C classes jdk/test/resources/eu \
- -C $TESTSRC/src/extra jdk/test/resources/asia
-
-STATUS=0
-
-echo "jdk.test.Main should load bundles using ResourceBundleProviders."
-$JAVA -p mods -m test/jdk.test.Main de fr ja ja-jp zh-tw en de ja-jp || STATUS=1
-
-echo "jdk.test.Main should NOT load bundles from the jar file specified by the class-path."
-$JAVA -cp extra.jar -p mods -m test/jdk.test.Main es vi && STATUS=1
-
-exit $STATUS
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources.asia;
-
-import java.util.Locale;
-import jdk.test.resources.spi.MyResourcesProvider;
-
-/**
- *
- */
-public class MyResourcesAsia extends MyResourcesProvider {
- public MyResourcesAsia() {
- super("java.properties", "asia",
- Locale.JAPANESE, Locale.JAPAN, Locale.CHINESE, Locale.TAIWAN,
- new Locale("vi"));
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/asiabundles/jdk/test/resources/asia/MyResources_ja.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=ja: message
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/asiabundles/jdk/test/resources/asia/MyResources_ja_JP.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-# This resource bundle is located at jdk/test/resources to demonstrate
-# the unique package requirement is not applicable to .properties bundles.
-
-key=ja-JP: message
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/asiabundles/jdk/test/resources/asia/MyResources_zh.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=zh: message
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/asiabundles/jdk/test/resources/asia/MyResources_zh_TW.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=zh-TW: message
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/asiabundles/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module asiabundles {
- requires mainbundles;
-
- provides jdk.test.resources.spi.MyResourcesProvider
- with jdk.test.resources.asia.MyResourcesAsia;
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/eubundles/jdk/test/resources/eu/MyResourcesEU.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources.eu;
-
-import java.util.Locale;
-import jdk.test.resources.spi.MyResourcesProvider;
-
-/**
- *
- */
-public class MyResourcesEU extends MyResourcesProvider {
- public MyResourcesEU() {
- super("java.class", "eu",
- Locale.GERMAN, Locale.FRENCH, new Locale("es"));
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/eubundles/jdk/test/resources/eu/MyResources_de.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources.eu;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_de extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "de: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/eubundles/jdk/test/resources/eu/MyResources_fr.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources.eu;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_fr extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "fr: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/eubundles/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module eubundles {
- requires mainbundles;
-
- provides jdk.test.resources.spi.MyResourcesProvider
- with jdk.test.resources.eu.MyResourcesEU;
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/extra/jdk/test/resources/asia/MyResources_vi.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=vi: message
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/extra/jdk/test/resources/eu/MyResources_es.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources.eu;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_es extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "es: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/mainbundles/jdk/test/resources/MyResources.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "root: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/mainbundles/jdk/test/resources/MyResourcesMain.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.Locale;
-import jdk.test.resources.spi.MyResourcesProvider;
-
-public class MyResourcesMain extends MyResourcesProvider {
- public MyResourcesMain() {
- super("java.class", "", Locale.ROOT, Locale.ENGLISH);
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/mainbundles/jdk/test/resources/MyResources_en.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_en extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "en: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/mainbundles/jdk/test/resources/spi/MyResourcesProvider.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources.spi;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.ResourceBundle.Control;
-import java.util.Set;
-import java.util.spi.AbstractResourceBundleProvider;
-
-
-public class MyResourcesProvider extends AbstractResourceBundleProvider {
- private final String region;
- private final Set<Locale> supportedLocales;
- private final List<String> formats;
-
- protected MyResourcesProvider() {
- region = "";
- supportedLocales = null;
- formats = Collections.emptyList();
- }
-
- protected MyResourcesProvider(String format, String region, Locale... locales) {
- super(format);
- this.region = region;
- this.supportedLocales = new HashSet<>(Arrays.asList(locales));
- this.formats = Collections.singletonList(format);
- }
-
- @Override
- public ResourceBundle getBundle(String baseName, Locale locale) {
- if (isSupportedInModule(locale)) {
- return super.getBundle(baseName, locale);
- }
- return null;
- }
-
- @Override
- protected String toBundleName(String baseName, Locale locale) {
- String name = addRegion(baseName);
- return Control.getControl(Control.FORMAT_DEFAULT).toBundleName(name, locale);
- }
-
- private String addRegion(String baseName) {
- if (region.isEmpty()) {
- return baseName;
- }
- int index = baseName.lastIndexOf('.');
- return baseName.substring(0, index + 1) + region + baseName.substring(index);
- }
-
- protected boolean isSupportedInModule(Locale locale) {
- return supportedLocales.contains(locale);
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/mainbundles/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module mainbundles {
- exports jdk.test.resources.spi to test, eubundles, asiabundles;
- provides jdk.test.resources.spi.MyResourcesProvider
- with jdk.test.resources.MyResourcesMain;
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/test/jdk/test/Main.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-public class Main {
- public static void main(String[] args) throws Exception {
- int errors = 0;
-
- for (String loctag : args) {
- Locale locale = Locale.forLanguageTag(loctag);
- if (locale.equals(Locale.ROOT)) {
- continue;
- }
- ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources",
- locale);
- String tag = locale.toLanguageTag(); // normalized
- String value = rb.getString("key");
- System.out.println("locale = " + tag + ", value = " + value);
- if (!value.startsWith(tag + ':')) {
- errors++;
- }
- }
- if (errors > 0) {
- throw new RuntimeException(errors + " errors");
- }
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/basic/src/test/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module test {
- requires mainbundles;
- uses jdk.test.resources.spi.MyResourcesProvider;
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources.asia;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.spi.AbstractResourceBundleProvider;
+
+import jdk.test.resources.spi.MyResourcesProvider;
+
+public class MyResourcesAsia extends AbstractResourceBundleProvider
+ implements MyResourcesProvider
+{
+ private static Set<Locale> asiaLocales
+ = Set.of(Locale.JAPANESE, Locale.CHINESE, Locale.TAIWAN);
+
+ @Override
+ public String toBundleName(String baseName, Locale locale) {
+ String bundleName = super.toBundleName(baseName, locale);
+ if (asiaLocales.contains(locale)) {
+ int index = bundleName.lastIndexOf('.');
+ return bundleName.substring(0, index + 1) + "asia" + bundleName.substring(index);
+ }
+ return bundleName;
+ }
+
+ @Override
+ public ResourceBundle getBundle(String baseName, Locale locale) {
+ if (asiaLocales.contains(locale)) {
+ return super.getBundle(baseName, locale);
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/asiabundles/jdk/test/resources/asia/MyResources_ja.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=ja: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/asiabundles/jdk/test/resources/asia/MyResources_zh.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=zh: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/asiabundles/jdk/test/resources/asia/MyResources_zh_TW.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=zh-TW: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/asiabundles/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module asiabundles {
+ requires test;
+
+ provides jdk.test.resources.spi.MyResourcesProvider
+ with jdk.test.resources.asia.MyResourcesAsia;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/eubundles/jdk/test/resources/eu/MyResourcesEU.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources.eu;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.spi.AbstractResourceBundleProvider;
+
+import jdk.test.resources.spi.MyResourcesProvider;
+
+public class MyResourcesEU extends AbstractResourceBundleProvider
+ implements MyResourcesProvider
+{
+ private static final Set<Locale> euLocales = Set.of(Locale.GERMAN, Locale.FRENCH);
+
+ public MyResourcesEU() {
+ super("java.class");
+ }
+
+ @Override
+ public String toBundleName(String baseName, Locale locale) {
+ String bundleName = super.toBundleName(baseName, locale);
+ if (euLocales.contains(locale)) {
+ int index = bundleName.lastIndexOf('.');
+ return bundleName.substring(0, index + 1) + "eu" + bundleName.substring(index);
+ }
+ return bundleName;
+ }
+
+ @Override
+ public ResourceBundle getBundle(String baseName, Locale locale) {
+ if (euLocales.contains(locale)) {
+ return super.getBundle(baseName, locale);
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/eubundles/jdk/test/resources/eu/MyResources_de.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources.eu;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_de extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "de: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/eubundles/jdk/test/resources/eu/MyResources_fr.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources.eu;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_fr extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "fr: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/eubundles/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module eubundles {
+ requires test;
+
+ provides jdk.test.resources.spi.MyResourcesProvider
+ with jdk.test.resources.eu.MyResourcesEU;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/test/jdk/test/Main.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+public class Main {
+ public static void main(String[] args) throws Exception {
+ int errors = 0;
+
+ for (String loctag : args) {
+ Locale locale = Locale.forLanguageTag(loctag);
+ if (locale.equals(Locale.ROOT)) {
+ continue;
+ }
+ ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources", locale);
+ String tag = locale.toLanguageTag(); // normalized
+ String value = rb.getString("key");
+ System.out.println("locale = " + tag + ", value = " + value);
+ if (!value.startsWith(tag + ':')) {
+ errors++;
+ }
+ }
+ if (errors > 0) {
+ throw new RuntimeException(errors + " errors");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/test/jdk/test/resources/MyResources.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "root: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/test/jdk/test/resources/MyResourcesProviderImpl.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.spi.AbstractResourceBundleProvider;
+import jdk.test.resources.spi.MyResourcesProvider;
+
+public class MyResourcesProviderImpl extends AbstractResourceBundleProvider
+ implements MyResourcesProvider
+{
+ public MyResourcesProviderImpl() {
+ super("java.class");
+ }
+ @Override
+ public ResourceBundle getBundle(String baseName, Locale locale) {
+ if (locale.equals(Locale.ENGLISH) || locale.equals(Locale.ROOT)) {
+ return super.getBundle(baseName, locale);
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/test/jdk/test/resources/MyResources_en.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_en extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "en: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/test/jdk/test/resources/spi/MyResourcesProvider.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources.spi;
+
+import java.util.spi.ResourceBundleProvider;
+
+public interface MyResourcesProvider extends ResourceBundleProvider {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic/test/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+module test {
+ exports jdk.test.resources.spi to eubundles, asiabundles;
+ uses jdk.test.resources.spi.MyResourcesProvider;
+ provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.MyResourcesProviderImpl;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources.asia;
+
+import java.util.Locale;
+import jdk.test.resources.spi.MyResourcesProvider;
+
+public class MyResourcesAsia extends MyResourcesProvider {
+ public MyResourcesAsia() {
+ super("java.properties");
+ }
+
+ @Override
+ protected String toBundleName(String baseName, Locale locale) {
+ // Convert baseName to its properties resource name for the given locale
+ // e.g., jdk.test.resources.MyResources -> jdk/test/resources/asia/MyResources_zh_TW
+ StringBuilder sb = new StringBuilder();
+ int index = baseName.lastIndexOf('.');
+ sb.append(baseName.substring(0, index))
+ .append(".asia")
+ .append(baseName.substring(index));
+ String lang = locale.getLanguage();
+ if (!lang.isEmpty()) {
+ sb.append('_').append(lang);
+ String country = locale.getCountry();
+ if (!country.isEmpty()) {
+ sb.append('_').append(country);
+ }
+ }
+ return sb.toString();
+ }
+
+ @Override
+ protected boolean isSupportedInModule(Locale locale) {
+ return locale.equals(Locale.JAPANESE)
+ || locale.equals(Locale.CHINESE) || locale.equals(Locale.TAIWAN);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/asiabundles/jdk/test/resources/asia/MyResources_ja.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=ja: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/asiabundles/jdk/test/resources/asia/MyResources_zh.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=zh: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/asiabundles/jdk/test/resources/asia/MyResources_zh_TW.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=zh-TW: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/asiabundles/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module asiabundles {
+ requires test;
+
+ provides jdk.test.resources.spi.MyResourcesProvider
+ with jdk.test.resources.asia.MyResourcesAsia;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/eubundles/jdk/test/resources/eu/MyResourcesEU.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources.eu;
+
+import java.util.Locale;
+import jdk.test.resources.spi.MyResourcesProvider;
+
+public class MyResourcesEU extends MyResourcesProvider {
+ public MyResourcesEU() {
+ super("java.class");
+ }
+
+ @Override
+ protected String toBundleName(String baseName, Locale locale) {
+ int index = baseName.lastIndexOf('.');
+ String bundleName = baseName.substring(0, index) + ".eu" + baseName.substring(index)
+ + '_' + locale.getLanguage();
+ return bundleName;
+ }
+
+ @Override
+ protected boolean isSupportedInModule(Locale locale) {
+ return locale.equals(Locale.GERMAN) || locale.equals(Locale.FRENCH);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/eubundles/jdk/test/resources/eu/MyResources_de.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources.eu;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_de extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "de: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/eubundles/jdk/test/resources/eu/MyResources_fr.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources.eu;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_fr extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "fr: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/eubundles/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module eubundles {
+ requires test;
+
+ provides jdk.test.resources.spi.MyResourcesProvider
+ with jdk.test.resources.eu.MyResourcesEU;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/test/jdk/test/Main.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+public class Main {
+ public static void main(String[] args) throws Exception {
+ int errors = 0;
+
+ for (String loctag : args) {
+ Locale locale = Locale.forLanguageTag(loctag);
+ if (locale.equals(Locale.ROOT)) {
+ continue;
+ }
+ ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources", locale);
+ String tag = locale.toLanguageTag(); // normalized
+ String value = rb.getString("key");
+ System.out.println("locale = " + tag + ", value = " + value);
+ if (!value.startsWith(tag + ':')) {
+ errors++;
+ }
+ }
+ if (errors > 0) {
+ throw new RuntimeException(errors + " errors");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/test/jdk/test/resources/MyResources.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "root: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/test/jdk/test/resources/MyResourcesProviderImpl.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.Locale;
+import jdk.test.resources.spi.MyResourcesProvider;
+
+public class MyResourcesProviderImpl extends MyResourcesProvider {
+ public MyResourcesProviderImpl() {
+ super("java.class");
+ }
+
+ @Override
+ protected String toBundleName(String baseName, Locale locale) {
+ return locale.equals(Locale.ROOT) ? baseName : baseName + '_' + locale.getLanguage();
+ }
+
+ @Override
+ protected boolean isSupportedInModule(Locale locale) {
+ return locale.equals(Locale.ENGLISH) || locale.equals(Locale.ROOT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/test/jdk/test/resources/MyResources_en.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_en extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "en: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/test/jdk/test/resources/spi/MyResourcesProvider.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources.spi;
+
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.spi.AbstractResourceBundleProvider;
+
+public abstract class MyResourcesProvider extends AbstractResourceBundleProvider {
+ protected MyResourcesProvider(String... formats) {
+ super(formats);
+ }
+
+ @Override
+ public ResourceBundle getBundle(String baseName, Locale locale) {
+ if (isSupportedInModule(locale)) {
+ return super.getBundle(baseName, locale);
+ }
+ return null;
+ }
+
+ protected abstract boolean isSupportedInModule(Locale locale);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcAppbasic2/test/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module test {
+ exports jdk.test.resources.spi to eubundles, asiabundles;
+ uses jdk.test.resources.spi.MyResourcesProvider;
+ provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.MyResourcesProviderImpl;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources.asia;
+
+import java.util.Locale;
+import jdk.test.resources.spi.MyResourcesProvider;
+
+/**
+ *
+ */
+public class MyResourcesAsia extends MyResourcesProvider {
+ public MyResourcesAsia() {
+ super("java.properties", "asia",
+ Locale.JAPANESE, Locale.JAPAN, Locale.CHINESE, Locale.TAIWAN,
+ new Locale("vi"));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResources_ja.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=ja: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResources_ja_JP.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+# This resource bundle is located at jdk/test/resources to demonstrate
+# the unique package requirement is not applicable to .properties bundles.
+
+key=ja-JP: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResources_zh.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=zh: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResources_zh_TW.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=zh-TW: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module asiabundles {
+ requires mainbundles;
+
+ provides jdk.test.resources.spi.MyResourcesProvider
+ with jdk.test.resources.asia.MyResourcesAsia;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/eubundles/jdk/test/resources/eu/MyResourcesEU.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources.eu;
+
+import java.util.Locale;
+import jdk.test.resources.spi.MyResourcesProvider;
+
+/**
+ *
+ */
+public class MyResourcesEU extends MyResourcesProvider {
+ public MyResourcesEU() {
+ super("java.class", "eu",
+ Locale.GERMAN, Locale.FRENCH, new Locale("es"));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/eubundles/jdk/test/resources/eu/MyResources_de.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources.eu;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_de extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "de: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/eubundles/jdk/test/resources/eu/MyResources_fr.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources.eu;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_fr extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "fr: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/eubundles/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module eubundles {
+ requires mainbundles;
+
+ provides jdk.test.resources.spi.MyResourcesProvider
+ with jdk.test.resources.eu.MyResourcesEU;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/extra/jdk/test/resources/asia/MyResources_vi.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=vi: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/extra/jdk/test/resources/eu/MyResources_es.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources.eu;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_es extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "es: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/mainbundles/jdk/test/resources/MyResources.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "root: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/mainbundles/jdk/test/resources/MyResourcesMain.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.Locale;
+import jdk.test.resources.spi.MyResourcesProvider;
+
+public class MyResourcesMain extends MyResourcesProvider {
+ public MyResourcesMain() {
+ super("java.class", "", Locale.ROOT, Locale.ENGLISH);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/mainbundles/jdk/test/resources/MyResources_en.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_en extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "en: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/mainbundles/jdk/test/resources/spi/MyResourcesProvider.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources.spi;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.ResourceBundle.Control;
+import java.util.Set;
+import java.util.spi.AbstractResourceBundleProvider;
+
+
+public class MyResourcesProvider extends AbstractResourceBundleProvider {
+ private final String region;
+ private final Set<Locale> supportedLocales;
+ private final List<String> formats;
+
+ protected MyResourcesProvider() {
+ region = "";
+ supportedLocales = null;
+ formats = Collections.emptyList();
+ }
+
+ protected MyResourcesProvider(String format, String region, Locale... locales) {
+ super(format);
+ this.region = region;
+ this.supportedLocales = new HashSet<>(Arrays.asList(locales));
+ this.formats = Collections.singletonList(format);
+ }
+
+ @Override
+ public ResourceBundle getBundle(String baseName, Locale locale) {
+ if (isSupportedInModule(locale)) {
+ return super.getBundle(baseName, locale);
+ }
+ return null;
+ }
+
+ @Override
+ protected String toBundleName(String baseName, Locale locale) {
+ String name = addRegion(baseName);
+ return Control.getControl(Control.FORMAT_DEFAULT).toBundleName(name, locale);
+ }
+
+ private String addRegion(String baseName) {
+ if (region.isEmpty()) {
+ return baseName;
+ }
+ int index = baseName.lastIndexOf('.');
+ return baseName.substring(0, index + 1) + region + baseName.substring(index);
+ }
+
+ protected boolean isSupportedInModule(Locale locale) {
+ return supportedLocales.contains(locale);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/mainbundles/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module mainbundles {
+ exports jdk.test.resources.spi to test, eubundles, asiabundles;
+ provides jdk.test.resources.spi.MyResourcesProvider
+ with jdk.test.resources.MyResourcesMain;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/test/jdk/test/Main.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public class Main {
+ public static void main(String[] args) throws Exception {
+ int errors = 0;
+
+ for (String loctag : args) {
+ Locale locale = Locale.forLanguageTag(loctag);
+ if (locale.equals(Locale.ROOT)) {
+ continue;
+ }
+ ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources",
+ locale);
+ String tag = locale.toLanguageTag(); // normalized
+ String value = rb.getString("key");
+ System.out.println("locale = " + tag + ", value = " + value);
+ if (!value.startsWith(tag + ':')) {
+ errors++;
+ }
+ }
+ if (errors > 0) {
+ throw new RuntimeException(errors + " errors");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/test/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module test {
+ requires mainbundles;
+ uses jdk.test.resources.spi.MyResourcesProvider;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcModlocal/extra/jdk/test/resources/MyResources_vi.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=vi: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcModlocal/test/jdk/test/Main.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.ResourceBundle.Control;
+import java.util.MissingResourceException;
+
+public class Main {
+ public static void main(String[] args) throws Exception {
+ int errors = 0;
+ for (String loctag : args) {
+ Locale locale = Locale.forLanguageTag(loctag);
+ if (locale.equals(Locale.ROOT)) {
+ continue;
+ }
+ ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources",
+ locale);
+ String tag = locale.toLanguageTag(); // normalized
+ String value = rb.getString("key");
+ System.out.println("locale = " + tag + ", value = " + value);
+ if (!value.startsWith(tag + ':')) {
+ System.out.println("ERROR: " + value + " expected: " + tag);
+ errors++;
+ }
+ }
+
+ // Make sure ResourceBundle.getBundle throws an UnsupportedOperationException with
+ // a ResourceBundle.Control.
+ try {
+ ResourceBundle rb;
+ rb = ResourceBundle.getBundle("jdk.test.resources.MyResources",
+ Locale.ENGLISH,
+ Control.getControl(Control.FORMAT_DEFAULT));
+ System.out.println("ERROR: no UnsupportedOperationException thrown with a ResourceBundle.Control");
+ errors++;
+ } catch (UnsupportedOperationException e) {
+ // OK
+ }
+
+ if (errors > 0) {
+ throw new RuntimeException(errors + " errors");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcModlocal/test/jdk/test/resources/MyResources.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "root: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcModlocal/test/jdk/test/resources/MyResources_de.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_de extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "de: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcModlocal/test/jdk/test/resources/MyResources_en.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_en extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "en: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcModlocal/test/jdk/test/resources/MyResources_fr.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_fr extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "fr: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcModlocal/test/jdk/test/resources/MyResources_ja.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=ja: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcModlocal/test/jdk/test/resources/MyResources_zh.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=zh: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcModlocal/test/jdk/test/resources/MyResources_zh_TW.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=zh-TW: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcModlocal/test/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+module test {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcSimple/bundles/jdk/test/resources/MyResources.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "root: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcSimple/bundles/jdk/test/resources/MyResources_de.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_de extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "de: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcSimple/bundles/jdk/test/resources/MyResources_en.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_en extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "en: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcSimple/bundles/jdk/test/resources/MyResources_fr.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.resources;
+
+import java.util.ListResourceBundle;
+
+public class MyResources_fr extends ListResourceBundle {
+ @Override
+ public Object[][] getContents() {
+ return new Object[][] {
+ { "key", "fr: message" }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcSimple/bundles/jdk/test/resources/MyResources_ja.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=ja: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcSimple/bundles/jdk/test/resources/MyResources_zh.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=zh: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcSimple/bundles/jdk/test/resources/MyResources_zh_TW.properties Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=zh-TW: message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcSimple/bundles/jdk/test/resources/spi/MyResourcesProvider.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources.spi;
+
+import java.util.Locale;
+import java.util.spi.AbstractResourceBundleProvider;
+
+public class MyResourcesProvider extends AbstractResourceBundleProvider {
+ public MyResourcesProvider() {
+ super("java.class", "java.properties");
+ System.err.println("MyResourcesProvider called " + this);
+ }
+
+ @Override
+ protected String toBundleName(String baseName, Locale locale) {
+ StringBuilder sb = new StringBuilder(baseName);
+ String lang = locale.getLanguage();
+ if (!lang.isEmpty()) {
+ sb.append('_').append(lang);
+ String country = locale.getCountry();
+ if (!country.isEmpty()) {
+ sb.append('_').append(country);
+ }
+ }
+ return sb.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcSimple/bundles/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module bundles {
+ exports jdk.test.resources.spi to test;
+ provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.spi.MyResourcesProvider;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcSimple/test/jdk/test/Main.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public class Main {
+ public static void main(String[] args) throws Exception {
+ int errors = 0;
+ for (String loctag : args) {
+ Locale locale = Locale.forLanguageTag(loctag);
+ if (locale.equals(Locale.ROOT)) {
+ continue;
+ }
+ ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources",
+ locale);
+ String tag = locale.toLanguageTag(); // normalized
+ String value = rb.getString("key");
+ System.out.println("locale = " + tag + ", value = " + value);
+ if (!value.startsWith(tag + ':')) {
+ System.out.println("ERROR: " + value + " expected: " + tag);
+ errors++;
+ }
+ }
+ if (errors > 0) {
+ throw new RuntimeException(errors + " errors");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcSimple/test/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module test {
+ requires bundles;
+
+ uses jdk.test.resources.spi.MyResourcesProvider;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources.xml Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!---->
+
+<!-- DTD for properties -->
+<!DOCTYPE properties [
+<!ELEMENT properties ( comment?, entry* ) >
+<!ATTLIST properties version CDATA #FIXED "1.0">
+<!ELEMENT comment (#PCDATA) >
+<!ELEMENT entry (#PCDATA) >
+<!ATTLIST entry key CDATA #REQUIRED>
+]>
+
+<properties>
+ <comment>Test data for ResourceBundle</comment>
+ <entry key="key">root: message</entry>
+</properties>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_de.xml Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!---->
+
+<!-- DTD for properties -->
+<!DOCTYPE properties [
+<!ELEMENT properties ( comment?, entry* ) >
+<!ATTLIST properties version CDATA #FIXED "1.0">
+<!ELEMENT comment (#PCDATA) >
+<!ELEMENT entry (#PCDATA) >
+<!ATTLIST entry key CDATA #REQUIRED>
+]>
+
+<properties>
+ <comment>Test data for ResourceBundle</comment>
+ <entry key="key">de: message</entry>
+</properties>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_en.xml Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!---->
+
+<!-- DTD for properties -->
+<!DOCTYPE properties [
+<!ELEMENT properties ( comment?, entry* ) >
+<!ATTLIST properties version CDATA #FIXED "1.0">
+<!ELEMENT comment (#PCDATA) >
+<!ELEMENT entry (#PCDATA) >
+<!ATTLIST entry key CDATA #REQUIRED>
+]>
+
+<properties>
+ <comment>Test data for ResourceBundle</comment>
+ <entry key="key">en: message</entry>
+</properties>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_fr.xml Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!---->
+
+<!-- DTD for properties -->
+<!DOCTYPE properties [
+<!ELEMENT properties ( comment?, entry* ) >
+<!ATTLIST properties version CDATA #FIXED "1.0">
+<!ELEMENT comment (#PCDATA) >
+<!ELEMENT entry (#PCDATA) >
+<!ATTLIST entry key CDATA #REQUIRED>
+]>
+
+<properties>
+ <comment>Test data for ResourceBundle</comment>
+ <entry key="key">fr: message</entry>
+</properties>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_ja.xml Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!---->
+
+<!-- DTD for properties -->
+<!DOCTYPE properties [
+<!ELEMENT properties ( comment?, entry* ) >
+<!ATTLIST properties version CDATA #FIXED "1.0">
+<!ELEMENT comment (#PCDATA) >
+<!ELEMENT entry (#PCDATA) >
+<!ATTLIST entry key CDATA #REQUIRED>
+]>
+
+<properties>
+ <comment>Test data for ResourceBundle in named modules.</comment>
+ <entry key="key">ja: message</entry>
+</properties>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh.xml Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!---->
+
+<!-- DTD for properties -->
+<!DOCTYPE properties [
+<!ELEMENT properties ( comment?, entry* ) >
+<!ATTLIST properties version CDATA #FIXED "1.0">
+<!ELEMENT comment (#PCDATA) >
+<!ELEMENT entry (#PCDATA) >
+<!ATTLIST entry key CDATA #REQUIRED>
+]>
+
+<properties>
+ <comment>Test data for ResourceBundle in named modules.</comment>
+ <entry key="key">zh: message</entry>
+</properties>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh_TW.xml Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!---->
+
+<!-- DTD for properties -->
+<!DOCTYPE properties [
+<!ELEMENT properties ( comment?, entry* ) >
+<!ATTLIST properties version CDATA #FIXED "1.0">
+<!ELEMENT comment (#PCDATA) >
+<!ELEMENT entry (#PCDATA) >
+<!ATTLIST entry key CDATA #REQUIRED>
+]>
+
+<properties>
+ <comment>Test data for ResourceBundle in named modules.</comment>
+ <entry key="key">zh-TW: message</entry>
+</properties>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/spi/MyResourcesProvider.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+package jdk.test.resources.spi;
+
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.spi.ResourceBundleProvider;
+
+public class MyResourcesProvider implements ResourceBundleProvider {
+ @Override
+ public ResourceBundle getBundle(String baseName, Locale locale) {
+ String xmlName = toXMLName(baseName, locale);
+ try (InputStream is = this.getClass().getModule().getResourceAsStream(xmlName)) {
+ return new XMLResourceBundle(new BufferedInputStream(is));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private String toXMLName(String baseName, Locale locale) {
+ StringBuilder sb = new StringBuilder(baseName.replace('.', '/'));
+ String lang = locale.getLanguage();
+ if (!lang.isEmpty()) {
+ sb.append('_').append(lang);
+ String country = locale.getCountry();
+ if (!country.isEmpty()) {
+ sb.append('_').append(country);
+ }
+ }
+ return sb.append(".xml").toString();
+ }
+
+ private static class XMLResourceBundle extends ResourceBundle {
+ private Properties props;
+
+ XMLResourceBundle(InputStream stream) throws IOException {
+ props = new Properties();
+ props.loadFromXML(stream);
+ }
+
+ @Override
+ protected Object handleGetObject(String key) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ return props.get(key);
+ }
+
+ @Override
+ public Enumeration<String> getKeys() {
+ // Not implemented
+ return null;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module bundles {
+ exports jdk.test.resources.spi to test;
+ provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.spi.MyResourcesProvider;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/test/jdk/test/Main.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public class Main {
+ public static void main(String[] args) throws Exception {
+ int errors = 0;
+ for (String loctag : args) {
+ Locale locale = Locale.forLanguageTag(loctag);
+ if (locale.equals(Locale.ROOT)) {
+ continue;
+ }
+ ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources",
+ locale);
+ String tag = locale.toLanguageTag(); // normalized
+ String value = rb.getString("key");
+ System.out.println("locale = " + tag + ", value = " + value);
+ if (!value.startsWith(tag + ':')) {
+ System.out.println("ERROR: " + value + " expected: " + tag);
+ errors++;
+ }
+ }
+ if (errors > 0) {
+ throw new RuntimeException(errors + " errors");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/test/module-info.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 2017, 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.
+ */
+
+module test {
+ requires bundles;
+
+ uses jdk.test.resources.spi.MyResourcesProvider;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/layer/LayerTest.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2017, 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8180375 8185251 8210408
+ * @summary Tests resource bundles are correctly loaded from modules through
+ * "<packageName>.spi.<simpleName>Provider" types.
+ * @library /test/lib
+ * ..
+ * @build jdk.test.lib.JDKToolLauncher
+ * jdk.test.lib.Utils
+ * jdk.test.lib.compiler.CompilerUtils
+ * jdk.test.lib.process.ProcessTools
+ * ModuleTestUtil
+ * @run main LayerTest
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+
+public class LayerTest {
+ private static final Path SRC_DIR = Paths.get(Utils.TEST_SRC, "src");
+ private static final Path MODS_DIR = Paths.get(Utils.TEST_CLASSES, "mods");
+ private static final List<String> MODULE_LIST = List.of("m1", "m2");
+
+ public static void main(String[] args) throws Throwable {
+ MODULE_LIST.forEach(mn -> ModuleTestUtil.prepareModule(SRC_DIR,
+ MODS_DIR, mn, ".properties"));
+ compileCmd();
+ runCmd();
+ }
+
+ private static void compileCmd() throws Throwable {
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("javac");
+ launcher.addToolArg("-d")
+ .addToolArg(Utils.TEST_CLASSES)
+ .addToolArg(SRC_DIR.resolve("Main.java").toString());
+
+ int exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ if (exitCode != 0) {
+ throw new RuntimeException("Compile of the test failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+ }
+
+ private static void runCmd() throws Throwable {
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
+ launcher.addToolArg("-cp")
+ .addToolArg(Utils.TEST_CLASSES)
+ .addToolArg("Main")
+ .addToolArg(Utils.TEST_CLASSES);
+
+ int exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ if (exitCode != 0) {
+ throw new RuntimeException("Execution of the test failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+ }
+}
\ No newline at end of file
--- a/test/jdk/java/util/ResourceBundle/modules/layer/run.sh Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-
-# @test
-# @bug 8180375 8185251
-# @summary Tests resource bundles are correctly loaded from
-# modules through "<packageName>.spi.<simpleName>Provider" types.
-
-set -e
-
-if [ -z "$TESTJAVA" ]; then
- if [ $# -lt 1 ]; then exit 1; fi
- TESTJAVA="$1"; shift
- COMPILEJAVA="${TESTJAVA}"
- TESTSRC="`pwd`"
- TESTCLASSES="`pwd`"
-fi
-
-JAVAC="$COMPILEJAVA/bin/javac"
-JAVA="$TESTJAVA/bin/java"
-
-rm -rf mods
-$JAVAC --module-source-path $TESTSRC/src -d mods --module m1,m2
-
-mkdir -p mods/m1/p/resources mods/m2/p/resources
-cp $TESTSRC/src/m1/p/resources/*.properties mods/m1/p/resources
-cp $TESTSRC/src/m2/p/resources/*.properties mods/m2/p/resources
-
-mkdir classes
-$JAVAC -d classes $TESTSRC/src/Main.java
-
-$JAVA -cp classes Main
--- a/test/jdk/java/util/ResourceBundle/modules/layer/src/Main.java Thu Nov 15 21:26:35 2018 -0800
+++ b/test/jdk/java/util/ResourceBundle/modules/layer/src/Main.java Thu Nov 15 21:53:30 2018 -0800
@@ -31,7 +31,7 @@
public class Main {
public static void main(String... args) throws Exception {
- ModuleFinder afterFinder = ModuleFinder.of(Paths.get("mods"));
+ ModuleFinder afterFinder = ModuleFinder.of(Paths.get(args[0], "mods"));
Configuration cf = ModuleLayer.boot().configuration()
.resolveAndBind(ModuleFinder.of(), afterFinder,
--- a/test/jdk/java/util/ResourceBundle/modules/modlocal/modlocal.sh Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-# @test
-# @bug 8044767 8139067
-# @summary Test case for having resource bundles in a local named module
-# with no ResourceBundleProviders.
-
-
-set -e
-
-if [ -z "$TESTJAVA" ]; then
- if [ $# -lt 1 ]; then exit 1; fi
- TESTJAVA="$1"; shift
- COMPILEJAVA="${TESTJAVA}"
- TESTSRC="`pwd`"
- TESTCLASSES="`pwd`"
-fi
-
-JAVAC="$COMPILEJAVA/bin/javac"
-JAR="$COMPILEJAVA/bin/jar"
-JAVA="$TESTJAVA/bin/java"
-
-rm -rf mods
-mkdir -p mods/test
-
-#
-# Copy .properties files
-#
-PROPS="`(cd $TESTSRC/src; find . -name '*.properties')`"
-if [ "x$PROPS" != x ]; then
- for P in $PROPS
- do
- D=`dirname $P`
- mkdir -p mods/$D
- cp $TESTSRC/src/$P mods/$D/
- done
-fi
-
-$JAVAC -g -d mods --module-source-path $TESTSRC/src \
- -cp mods/bundles `find $TESTSRC/src/test -name "*.java"`
-
-# Create a jar to be added to the class path. Expected properties files are
-# picked up from the class path.
-rm -f extra.jar
-mkdir -p classes
-$JAR -cf extra.jar -C $TESTSRC/src/extra jdk/test/resources
-
-STATUS=0
-
-echo 'jdk.test.Main should load bundles local to named module "test".'
-$JAVA -p mods -m test/jdk.test.Main de fr ja zh-tw en de || STATUS=1
-
-echo "jdk.test.Main should load bundles from the jar file specified by the class-path."
-$JAVA -cp extra.jar -p mods -m test/jdk.test.Main vi || STATUS=1
-
-
-exit $STATUS
--- a/test/jdk/java/util/ResourceBundle/modules/modlocal/src/extra/jdk/test/resources/MyResources_vi.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=vi: message
--- a/test/jdk/java/util/ResourceBundle/modules/modlocal/src/test/jdk/test/Main.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.ResourceBundle.Control;
-import java.util.MissingResourceException;
-
-public class Main {
- public static void main(String[] args) throws Exception {
- int errors = 0;
- for (String loctag : args) {
- Locale locale = Locale.forLanguageTag(loctag);
- if (locale.equals(Locale.ROOT)) {
- continue;
- }
- ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources",
- locale);
- String tag = locale.toLanguageTag(); // normalized
- String value = rb.getString("key");
- System.out.println("locale = " + tag + ", value = " + value);
- if (!value.startsWith(tag + ':')) {
- System.out.println("ERROR: " + value + " expected: " + tag);
- errors++;
- }
- }
-
- // Make sure ResourceBundle.getBundle throws an UnsupportedOperationException with
- // a ResourceBundle.Control.
- try {
- ResourceBundle rb;
- rb = ResourceBundle.getBundle("jdk.test.resources.MyResources",
- Locale.ENGLISH,
- Control.getControl(Control.FORMAT_DEFAULT));
- System.out.println("ERROR: no UnsupportedOperationException thrown with a ResourceBundle.Control");
- errors++;
- } catch (UnsupportedOperationException e) {
- // OK
- }
-
- if (errors > 0) {
- throw new RuntimeException(errors + " errors");
- }
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/modlocal/src/test/jdk/test/resources/MyResources.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "root: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/modlocal/src/test/jdk/test/resources/MyResources_de.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_de extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "de: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/modlocal/src/test/jdk/test/resources/MyResources_en.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_en extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "en: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/modlocal/src/test/jdk/test/resources/MyResources_fr.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_fr extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "fr: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/modlocal/src/test/jdk/test/resources/MyResources_ja.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=ja: message
--- a/test/jdk/java/util/ResourceBundle/modules/modlocal/src/test/jdk/test/resources/MyResources_zh.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=zh: message
--- a/test/jdk/java/util/ResourceBundle/modules/modlocal/src/test/jdk/test/resources/MyResources_zh_TW.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=zh-TW: message
--- a/test/jdk/java/util/ResourceBundle/modules/modlocal/src/test/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-module test {
-}
--- a/test/jdk/java/util/ResourceBundle/modules/simple/simple.sh Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-# @test
-# @bug 8044767
-# @summary Simple test case for ResourceBundle with named modules;
-# ResourceBundle.getBundle caller is in named module "test" and
-# all resource bundles are in single named module "bundles" with
-# service providers.
-
-
-set -e
-
-if [ -z "$TESTJAVA" ]; then
- if [ $# -lt 1 ]; then exit 1; fi
- TESTJAVA="$1"; shift
- COMPILEJAVA="${TESTJAVA}"
- TESTSRC="`pwd`"
- TESTCLASSES="`pwd`"
-fi
-
-JAVAC="$COMPILEJAVA/bin/javac"
-JAVA="$TESTJAVA/bin/java"
-
-rm -rf mods
-
-mkdir -p mods/test
-
-B=bundles
-mkdir -p mods/$B
-CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
-if [ "x$CLASSES" != x ]; then
- $JAVAC -g -d mods --module-source-path $TESTSRC/src $CLASSES
-fi
-PROPS="`(cd $TESTSRC/src/$B; find . -name '*.properties')`"
-if [ "x$PROPS" != x ]; then
- for P in $PROPS
- do
- D=`dirname $P`
- mkdir -p mods/$B/$D
- cp $TESTSRC/src/$B/$P mods/$B/$D/
- done
-fi
-
-$JAVAC -g -d mods --module-source-path $TESTSRC/src \
- -cp mods/bundles `find $TESTSRC/src/test -name "*.java"`
-
-$JAVA -p mods -m test/jdk.test.Main de fr ja zh-tw en de
-
-exit $?
--- a/test/jdk/java/util/ResourceBundle/modules/simple/src/bundles/jdk/test/resources/MyResources.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "root: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/simple/src/bundles/jdk/test/resources/MyResources_de.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_de extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "de: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/simple/src/bundles/jdk/test/resources/MyResources_en.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_en extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "en: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/simple/src/bundles/jdk/test/resources/MyResources_fr.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test.resources;
-
-import java.util.ListResourceBundle;
-
-public class MyResources_fr extends ListResourceBundle {
- @Override
- public Object[][] getContents() {
- return new Object[][] {
- { "key", "fr: message" }
- };
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/simple/src/bundles/jdk/test/resources/MyResources_ja.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=ja: message
--- a/test/jdk/java/util/ResourceBundle/modules/simple/src/bundles/jdk/test/resources/MyResources_zh.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=zh: message
--- a/test/jdk/java/util/ResourceBundle/modules/simple/src/bundles/jdk/test/resources/MyResources_zh_TW.properties Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-key=zh-TW: message
--- a/test/jdk/java/util/ResourceBundle/modules/simple/src/bundles/jdk/test/resources/spi/MyResourcesProvider.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources.spi;
-
-import java.util.Locale;
-import java.util.spi.AbstractResourceBundleProvider;
-
-public class MyResourcesProvider extends AbstractResourceBundleProvider {
- public MyResourcesProvider() {
- super("java.class", "java.properties");
- System.err.println("MyResourcesProvider called " + this);
- }
-
- @Override
- protected String toBundleName(String baseName, Locale locale) {
- StringBuilder sb = new StringBuilder(baseName);
- String lang = locale.getLanguage();
- if (!lang.isEmpty()) {
- sb.append('_').append(lang);
- String country = locale.getCountry();
- if (!country.isEmpty()) {
- sb.append('_').append(country);
- }
- }
- return sb.toString();
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/simple/src/bundles/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module bundles {
- exports jdk.test.resources.spi to test;
- provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.spi.MyResourcesProvider;
-}
--- a/test/jdk/java/util/ResourceBundle/modules/simple/src/test/jdk/test/Main.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-public class Main {
- public static void main(String[] args) throws Exception {
- int errors = 0;
- for (String loctag : args) {
- Locale locale = Locale.forLanguageTag(loctag);
- if (locale.equals(Locale.ROOT)) {
- continue;
- }
- ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources",
- locale);
- String tag = locale.toLanguageTag(); // normalized
- String value = rb.getString("key");
- System.out.println("locale = " + tag + ", value = " + value);
- if (!value.startsWith(tag + ':')) {
- System.out.println("ERROR: " + value + " expected: " + tag);
- errors++;
- }
- }
- if (errors > 0) {
- throw new RuntimeException(errors + " errors");
- }
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/simple/src/test/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module test {
- requires bundles;
-
- uses jdk.test.resources.spi.MyResourcesProvider;
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/unnamed/UnNamedTest.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2016, 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8210408
+ * @summary Test unnamed module to find resource bundles exported from a named
+ * module.
+ * @library /test/lib
+ * ..
+ * @build jdk.test.lib.JDKToolLauncher
+ * jdk.test.lib.Utils
+ * jdk.test.lib.compiler.CompilerUtils
+ * jdk.test.lib.process.ProcessTools
+ * ModuleTestUtil
+ * @run main UnNamedTest
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+
+public class UnNamedTest {
+ private static final Path SRC_DIR = Paths.get(Utils.TEST_SRC, "src");
+ private static final Path MODS_DIR = Paths.get(Utils.TEST_CLASSES, "mods");
+
+ private static final List<String> LOCALE_LIST = List.of("de", "fr", "ja",
+ "zh-tw", "en", "de");
+
+ public static void main(String[] args) throws Throwable {
+ ModuleTestUtil.prepareModule(SRC_DIR, MODS_DIR, "bundles", ".properties");
+ compileCmd();
+ runCmd();
+ }
+
+ private static void compileCmd() throws Throwable {
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("javac");
+ launcher.addToolArg("-d")
+ .addToolArg(Utils.TEST_CLASSES)
+ .addToolArg(Paths.get(Utils.TEST_SRC, "Main.java").toString());
+
+ int exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ if (exitCode != 0) {
+ throw new RuntimeException("Compile of the test failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+ }
+
+ private static void runCmd() throws Throwable {
+ // access resource bundles that are exported private unconditionally.
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
+ launcher.addToolArg("-cp")
+ .addToolArg(Utils.TEST_CLASSES)
+ .addToolArg("--module-path")
+ .addToolArg(MODS_DIR.toString())
+ .addToolArg("--add-modules")
+ .addToolArg("bundles")
+ .addToolArg("Main");
+ LOCALE_LIST.forEach(launcher::addToolArg);
+
+ int exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ if (exitCode != 0) {
+ throw new RuntimeException("Execution of the test1 failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+
+ // --add-exports can't open resources
+ launcher = JDKToolLauncher.createUsingTestJDK("java");
+ launcher.addToolArg("-cp")
+ .addToolArg(Utils.TEST_CLASSES)
+ .addToolArg("--module-path")
+ .addToolArg(MODS_DIR.toString())
+ .addToolArg("--add-modules")
+ .addToolArg("bundles")
+ .addToolArg("--add-opens")
+ .addToolArg("bundles/jdk.test.internal.resources=ALL-UNNAMED")
+ .addToolArg("Main");
+ LOCALE_LIST.forEach(launcher::addToolArg);
+
+ exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ if (exitCode != 0) {
+ throw new RuntimeException("Execution of the test2 failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+ }
+}
\ No newline at end of file
--- a/test/jdk/java/util/ResourceBundle/modules/unnamed/unnamed.sh Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-#
-# 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.
-#
-
-# @test
-# @summary Test unnamed module to find resource bundles exported
-# from a named module
-
-
-set -e
-
-if [ -z "$TESTJAVA" ]; then
- if [ $# -lt 1 ]; then exit 1; fi
- TESTJAVA="$1"; shift
- COMPILEJAVA="${TESTJAVA}"
- TESTSRC="`pwd`"
- TESTCLASSES="`pwd`"
-fi
-
-JAVAC="$COMPILEJAVA/bin/javac"
-JAVA="$TESTJAVA/bin/java"
-
-rm -rf mods
-
-mkdir -p mods/test
-
-B=bundles
-mkdir -p mods/$B
-CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
-if [ "x$CLASSES" != x ]; then
- $JAVAC -g -d mods --module-source-path $TESTSRC/src $CLASSES
-fi
-PROPS="`(cd $TESTSRC/src/$B; find . -name '*.properties')`"
-if [ "x$PROPS" != x ]; then
- for P in $PROPS
- do
- D=`dirname $P`
- mkdir -p mods/$B/$D
- cp $TESTSRC/src/$B/$P mods/$B/$D/
- done
-fi
-
-mkdir classes
-$JAVAC -d classes $TESTSRC/Main.java
-
-# access resource bundles that are exported private unconditionally
-$JAVA -cp classes --module-path mods --add-modules bundles \
- Main de fr ja zh-tw en de
-
-# --add-exports can't open resources
-$JAVA -cp classes --module-path mods --add-modules bundles \
- --add-opens bundles/jdk.test.internal.resources=ALL-UNNAMED \
- Main de fr ja zh-tw en de
-
-exit $?
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ResourceBundle/modules/visibility/VisibilityTest.java Thu Nov 15 21:53:30 2018 -0800
@@ -0,0 +1,336 @@
+/*
+ * Copyright (c) 2015, 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8137317 8139238 8210408
+ * @summary Visibility tests for ResourceBundle.getBundle with and without
+ * an unnamed module argument.
+ * @library /test/lib
+ * ..
+ * @build jdk.test.lib.JDKToolLauncher
+ * jdk.test.lib.Utils
+ * jdk.test.lib.compiler.CompilerUtils
+ * jdk.test.lib.process.ProcessTools
+ * ModuleTestUtil
+ * @run testng VisibilityTest
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+
+@Test
+public class VisibilityTest {
+ private static final Path SRC_DIR = Paths.get(Utils.TEST_SRC, "src");
+ private static final Path MODS_DIR = Paths.get(Utils.TEST_CLASSES, "mods");
+ private static final Path CLASSES_DIR = Paths.get(Utils.TEST_CLASSES, "classes");
+ private static final Path NAMED_BUNDLES_DIR = MODS_DIR.resolve("named.bundles");
+ private static final Path EXPORTED_NAMED_BUNDLES_DIR = MODS_DIR.resolve("exported.named.bundles");
+
+ private static final List<String> MODULE_LIST = List.of("embargo",
+ "exported.named.bundles", "named.bundles", "test");
+
+ @BeforeTest
+ public void prepareTestEnv() throws Throwable {
+ MODULE_LIST.forEach(mn -> ModuleTestUtil.prepareModule(SRC_DIR,
+ MODS_DIR, mn, ".properties"));
+
+ // Prepare resource bundles in an unnamed module
+ ModuleTestUtil.compilePkg(SRC_DIR, CLASSES_DIR, "pkg");
+ ModuleTestUtil.copyResFiles(SRC_DIR, CLASSES_DIR, "pkg", ".properties");
+
+ }
+
+ /**
+ * Package jdk.test is in named module "test".
+ * Package jdk.embargo is in named module "embargo".
+ *
+ * jdk.{test,embargo}.TestWithUnnamedModuleArg call:
+ * ResourceBundle.getBundle(basename, classloader.getUnnamedModule())
+ * where classloader is the TCCL or system class loader.
+ * jdk.{test,embargo}.TestWithNoModuleArg call:
+ * ResourceBundle.getBundle(basename)
+ *
+ * jdk.test.resources[.exported].classes.* are class-based resource bundles.
+ * jdk.test.resources[.exported].props.* are properties file-based resource bundles.
+ *
+ * Packages jdk.test.resources.{classes,props} in named module "named.bundles"
+ * are exported only to named module "test".
+ * Packages jdk.test.resources.exported.{classes,props} in named module
+ * "exported.named.bundle" are exported to unnamed modules.
+ */
+
+ @DataProvider(name = "RunWithTestResData")
+ Object[][] RunWithTestResData() {
+ return new Object[][] {
+ // Tests using jdk.test.TestWithNoModuleArg and jdk.embargo.TestWithNoModuleArg.
+ // Neither of which specifies an unnamed module with ResourceBundle.getBundle().
+
+ // jdk.test.resources.{classes,props}.* are available only to
+ // named module "test" by ResourceBundleProvider.
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithNoModuleArg",
+ "jdk.test.resources.classes.MyResources", "true")},
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithNoModuleArg",
+ "jdk.test.resources.props.MyResources", "true")},
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithNoModuleArg",
+ "jdk.test.resources.classes.MyResources", "false")},
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithNoModuleArg",
+ "jdk.test.resources.props.MyResources", "false")},
+
+ // Add mods/named.bundles to the class path.
+ {List.of("-cp", NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithNoModuleArg",
+ "jdk.test.resources.classes.MyResources", "true")},
+ {List.of("-cp", NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithNoModuleArg",
+ "jdk.test.resources.props.MyResources", "true")},
+ {List.of("-cp", NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithNoModuleArg",
+ "jdk.test.resources.classes.MyResources", "true")},
+ {List.of("-cp", NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithNoModuleArg",
+ "jdk.test.resources.props.MyResources", "true")},
+
+ // Tests using jdk.test.TestWithUnnamedModuleArg and
+ // jdk.embargo.TestWithUnnamedModuleArg.
+ // Both of which specify an unnamed module with ResourceBundle.getBundle.
+
+ // jdk.test.resources.classes is exported to named module "test".
+ // IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithUnnamedModuleArg",
+ "jdk.test.resources.classes.MyResources", "false")},
+
+ // jdk.test.resources.props is exported to named module "test".
+ // loader.getResource() doesn't find jdk.test.resources.props.MyResources.
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithUnnamedModuleArg",
+ "jdk.test.resources.props.MyResources", "false")},
+
+ // IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithUnnamedModuleArg",
+ "jdk.test.resources.classes.MyResources", "false")},
+
+ // jdk.test.resources.props is exported to named module "test".
+ // loader.getResource() doesn't find jdk.test.resources.props.MyResources.
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithUnnamedModuleArg",
+ "jdk.test.resources.props.MyResources", "false")},
+
+ // Add mods/named.bundles to the class path.
+
+ // IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
+ {List.of("-cp", NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithUnnamedModuleArg",
+ "jdk.test.resources.classes.MyResources", "false")},
+
+ // loader.getResource() finds jdk.test.resources.exported.props.MyResources.
+ {List.of("-cp", NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithUnnamedModuleArg",
+ "jdk.test.resources.props.MyResources", "true")},
+
+ // jdk.test.resources.exported.classes.MyResources is treated
+ // as if the class is in an unnamed module.
+ {List.of("-cp", NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithUnnamedModuleArg",
+ "jdk.test.resources.classes.MyResources", "true")},
+
+ // loader.getResource() finds jdk.test.resources.exported.props.MyResources.
+ {List.of("-cp", NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithUnnamedModuleArg",
+ "jdk.test.resources.props.MyResources", "true")},
+ };
+ }
+
+ @DataProvider(name = "RunWithExportedResData")
+ Object[][] RunWithExportedResData() {
+ return new Object[][] {
+ // Tests using jdk.test.TestWithNoModuleArg and jdk.embargo.TestWithNoModuleArg
+ // neither of which specifies an unnamed module with ResourceBundle.getBundle.
+
+ // None of jdk.test.resources.exported.** is available to the named modules.
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithNoModuleArg",
+ "jdk.test.resources.exported.classes.MyResources", "false")},
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithNoModuleArg",
+ "jdk.test.resources.exported.props.MyResources", "false")},
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithNoModuleArg",
+ "jdk.test.resources.exported.classes.MyResources", "false")},
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithNoModuleArg",
+ "jdk.test.resources.exported.props.MyResources", "false")},
+
+ // Add mods/exported.named.bundles to the class path.
+ {List.of("-cp", EXPORTED_NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithNoModuleArg",
+ "jdk.test.resources.exported.classes.MyResources", "true")},
+ {List.of("-cp", EXPORTED_NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithNoModuleArg",
+ "jdk.test.resources.exported.props.MyResources", "true")},
+ {List.of("-cp", EXPORTED_NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithNoModuleArg",
+ "jdk.test.resources.exported.classes.MyResources", "true")},
+ {List.of("-cp", EXPORTED_NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithNoModuleArg",
+ "jdk.test.resources.exported.props.MyResources", "true")},
+
+ // Tests using jdk.test.TestWithUnnamedModuleArg and
+ // jdk.embargo.TestWithUnnamedModuleArg which specify
+ // an unnamed module with ResourceBundle.getBundle.
+
+ // loader.loadClass() doesn't find jdk.test.resources.exported.classes.MyResources
+ // and throws a ClassNotFoundException.
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithUnnamedModuleArg",
+ "jdk.test.resources.exported.classes.MyResources", "false")},
+
+ // The properties files in jdk.test.resources.exported.props
+ // are not found with loader.getResource().
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithUnnamedModuleArg",
+ "jdk.test.resources.exported.props.MyResources", "false")},
+
+ // loader.loadClass() doesn't find jdk.test.resources.exported.classes.MyResources
+ // and throws a ClassNotFoundException.
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithUnnamedModuleArg",
+ "jdk.test.resources.exported.classes.MyResources", "false")},
+
+ // The properties files in jdk.test.resources.exported.props are not found
+ // with loader.getResource().
+ {List.of("-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithUnnamedModuleArg",
+ "jdk.test.resources.exported.props.MyResources", "false")},
+
+ // Add mods/exported.named.bundles to the class path.
+
+ // jdk.test.resources.exported.classes.MyResources.getModule().isNamed()
+ // returns false.
+ {List.of("-cp", EXPORTED_NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithUnnamedModuleArg",
+ "jdk.test.resources.exported.classes.MyResources", "true")},
+
+ // loader.getResource() finds jdk.test.resources.exported.props.MyResources.
+ {List.of("-cp", EXPORTED_NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "test/jdk.test.TestWithUnnamedModuleArg",
+ "jdk.test.resources.exported.props.MyResources", "true")},
+
+ // jdk.test.resources.exported.classes.MyResources.getModule().isNamed()
+ // returns false.
+ {List.of("-cp", EXPORTED_NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithUnnamedModuleArg",
+ "jdk.test.resources.exported.classes.MyResources", "true")},
+
+ // loader.getResource() finds jdk.test.resources.exported.props.MyResources.
+ {List.of("-cp", EXPORTED_NAMED_BUNDLES_DIR.toString(),
+ "-p", MODS_DIR.toString(),
+ "-m", "embargo/jdk.embargo.TestWithUnnamedModuleArg",
+ "jdk.test.resources.exported.props.MyResources", "true")},
+
+ };
+ }
+
+ @DataProvider(name = "RunWithPkgResData")
+ Object[][] RunWithPkgResData() {
+ return new Object[][] {
+ // jdk.pkg.resources.* are in an unnamed module.
+ // jdk.pkg.test.Main calls ResourceBundle.getBundle with an unnamed module.
+ { List.of("-cp", CLASSES_DIR.resolve("pkg").toString(), "jdk.pkg.test.Main",
+ "jdk.pkg.resources.classes.MyResources", "true")},
+ { List.of("-cp", CLASSES_DIR.resolve("pkg").toString(), "jdk.pkg.test.Main",
+ "jdk.pkg.resources.props.MyResources", "true")},
+ };
+ }
+
+ /**
+ * Test cases with jdk.test.resources.*
+ */
+ @Test(dataProvider = "RunWithTestResData")
+ public void RunWithTestRes(List<String> argsList) throws Throwable {
+ int exitCode = runCmd(argsList);
+ assertEquals(exitCode, 0, "Execution of the tests with "
+ + "jdk.test.resources.* failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+
+ /**
+ * Test cases with jdk.test.resources.exported.*
+ */
+ @Test(dataProvider = "RunWithExportedResData")
+ public void RunWithExportedRes(List<String> argsList) throws Throwable {
+ int exitCode = runCmd(argsList);
+ assertEquals(exitCode, 0, "Execution of the tests with "
+ + "jdk.test.resources.exported.* failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+
+ /**
+ * Test cases with jdk.pkg.resources.*
+ */
+ @Test(dataProvider = "RunWithPkgResData")
+ public void RunWithPkgRes(List<String> argsList) throws Throwable {
+ int exitCode = runCmd(argsList);
+ assertEquals(exitCode, 0, "Execution of the tests with "
+ + "jdk.pkg.resources.* failed. "
+ + "Unexpected exit code: " + exitCode);
+ }
+
+ private int runCmd(List<String> argsList) throws Throwable {
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
+ argsList.forEach(launcher::addToolArg);
+
+ return ProcessTools.executeCommand(launcher.getCommand()).getExitValue();
+ }
+}
\ No newline at end of file
--- a/test/jdk/java/util/ResourceBundle/modules/visibility/visibility.sh Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-# @test
-# @bug 8137317 8139238
-# @summary Visibility tests for ResourceBundle.getBundle with and without
-# an unnamed module argument.
-
-
-set -e
-STATUS=0
-
-runJava()
-{
- echo "Executing java $@"
- $JAVA $@ || STATUS=1
- echo
-}
-
-if [ -z "$TESTJAVA" ]; then
- if [ $# -lt 1 ]; then exit 1; fi
- TESTJAVA="$1"; shift
- COMPILEJAVA="${TESTJAVA}"
- TESTSRC="`pwd`"
- TESTCLASSES="`pwd`"
-fi
-
-JAVAC="$COMPILEJAVA/bin/javac"
-JAVA="$TESTJAVA/bin/java"
-
-rm -rf mods classes
-
-MODS=`cd $TESTSRC/src; find . -name module-info.java -exec dirname {} \; | sed 's:\./::'`
-
-for M in $MODS
-do
- mkdir -p mods/$M
- CLASSES="`find $TESTSRC/src/$M -name '*.java'`"
- if [ "x$CLASSES" != x ]; then
- $JAVAC -g -d mods --module-source-path $TESTSRC/src $CLASSES
- fi
- PROPS="`(cd $TESTSRC/src/$M; find . -name '*.properties')`"
- if [ "x$PROPS" != x ]; then
- for P in $PROPS
- do
- D=`dirname $P`
- mkdir -p mods/$M/$D
- cp $TESTSRC/src/$M/$P mods/$M/$D/
- done
- fi
-done
-
-# Package jdk.test is in named module "test".
-# Package jdk.embargo is in named module "embargo".
-
-# jdk.{test,embargo}.TestWithUnnamedModuleArg call:
-# ResourceBundle.getBundle(basename, classloader.getUnnamedModule())
-# where classloader is the TCCL or system class loader.
-# jdk.{test,embargo}.TestWithNoModuleArg call:
-# ResourceBundle.getBundle(basename)
-
-# jdk.test.resources[.exported].classes.* are class-based resource bundles.
-# jdk.test.resources[.exported].props.* are properties file-based resource bundles.
-
-# Packages jdk.test.resources.{classes,props} in named module "named.bundles"
-# are exported only to named module "test".
-# Packages jdk.test.resources.exported.{classes,props} in named module
-# "exported.named.bundle" are exported to unnamed modules.
-
-########################################
-# Test cases with jdk.test.resources.* #
-########################################
-
-# Tests using jdk.test.TestWithNoModuleArg and jdk.embargo.TestWithNoModuleArg
-# neither of which specifies an unnamed module with ResourceBundle.getBundle().
-
-# jdk.test.resources.{classes,props}.* are available only to named module "test"
-# by ResourceBundleProvider.
-runJava -p mods -m test/jdk.test.TestWithNoModuleArg \
- jdk.test.resources.classes.MyResources true
-runJava -p mods -m test/jdk.test.TestWithNoModuleArg \
- jdk.test.resources.props.MyResources true
-runJava -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
- jdk.test.resources.classes.MyResources false
-runJava -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
- jdk.test.resources.props.MyResources false
-
-# Add mods/named.bundles to the class path.
-runJava -cp mods/named.bundles -p mods -m test/jdk.test.TestWithNoModuleArg \
- jdk.test.resources.classes.MyResources true
-runJava -cp mods/named.bundles -p mods -m test/jdk.test.TestWithNoModuleArg \
- jdk.test.resources.props.MyResources true
-runJava -cp mods/named.bundles -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
- jdk.test.resources.classes.MyResources true
-runJava -cp mods/named.bundles -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
- jdk.test.resources.props.MyResources true
-
-# Tests using jdk.test.TestWithUnnamedModuleArg and jdk.embargo.TestWithUnnamedModuleArg
-# both of which specify an unnamed module with ResourceBundle.getBundle.
-
-# jdk.test.resources.classes is exported to named module "test".
-# IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
-runJava -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
- jdk.test.resources.classes.MyResources false
-
-# jdk.test.resources.props is exported to named module "test".
-# loader.getResource() doesn't find jdk.test.resources.props.MyResources.
-runJava -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
- jdk.test.resources.props.MyResources false
-
-# IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
-runJava -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
- jdk.test.resources.classes.MyResources false
-# jdk.test.resources.props is exported to named module "test".
-# loader.getResource() doesn't find jdk.test.resources.props.MyResources.
-runJava -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
- jdk.test.resources.props.MyResources false
-
-# Add mods/named.bundles to the class path
-
-# IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
-runJava -cp mods/named.bundles -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
- jdk.test.resources.classes.MyResources false
-# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
-runJava -cp mods/named.bundles -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
- jdk.test.resources.props.MyResources true
-
-# jdk.test.resources.exported.classes.MyResources is treated
-# as if the class is in an unnamed module.
-runJava -cp mods/named.bundles -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
- jdk.test.resources.classes.MyResources true
-# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
-runJava -cp mods/named.bundles -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
- jdk.test.resources.props.MyResources true
-
-#################################################
-# Test cases with jdk.test.resources.exported.* #
-#################################################
-# Tests using jdk.test.TestWithNoModuleArg and jdk.embargo.TestWithNoModuleArg
-# neither of which specifies an unnamed module with ResourceBundle.getBundle.
-
-# None of jdk.test.resources.exported.** is available to the named modules.
-runJava -p mods -m test/jdk.test.TestWithNoModuleArg \
- jdk.test.resources.exported.classes.MyResources false
-runJava -p mods -m test/jdk.test.TestWithNoModuleArg \
- jdk.test.resources.exported.props.MyResources false
-runJava -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
- jdk.test.resources.exported.classes.MyResources false
-runJava -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
- jdk.test.resources.exported.props.MyResources false
-
-# Add mods/exported.named.bundles to the class path.
-runJava -cp mods/exported.named.bundles -p mods -m test/jdk.test.TestWithNoModuleArg \
- jdk.test.resources.exported.classes.MyResources true
-runJava -cp mods/exported.named.bundles -p mods -m test/jdk.test.TestWithNoModuleArg \
- jdk.test.resources.exported.props.MyResources true
-runJava -cp mods/exported.named.bundles -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
- jdk.test.resources.exported.classes.MyResources true
-runJava -cp mods/exported.named.bundles -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
- jdk.test.resources.exported.props.MyResources true
-
-# Tests using jdk.test.TestWithUnnamedModuleArg and jdk.embargo.TestWithUnnamedModuleArg
-# which specify an unnamed module with ResourceBundle.getBundle.
-
-# loader.loadClass() doesn't find jdk.test.resources.exported.classes.MyResources
-# and throws a ClassNotFoundException.
-runJava -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
- jdk.test.resources.exported.classes.MyResources false
-# The properties files in jdk.test.resources.exported.props are not found with loader.getResource().
-runJava -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
- jdk.test.resources.exported.props.MyResources false
-
-
-# loader.loadClass() doesn't find jdk.test.resources.exported.classes.MyResources
-# and throws a ClassNotFoundException.
-runJava -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
- jdk.test.resources.exported.classes.MyResources false
-# The properties files in jdk.test.resources.exported.props are not found
-# with loader.getResource().
-runJava -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
- jdk.test.resources.exported.props.MyResources false
-
-# Add mods/exported.named.bundles to the class path.
-
-# jdk.test.resources.exported.classes.MyResources.getModule().isNamed() returns false.
-runJava -cp mods/exported.named.bundles -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
- jdk.test.resources.exported.classes.MyResources true
-# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
-runJava -cp mods/exported.named.bundles -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
- jdk.test.resources.exported.props.MyResources true
-
-# jdk.test.resources.exported.classes.MyResources.getModule().isNamed() returns false.
-runJava -cp mods/exported.named.bundles -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
- jdk.test.resources.exported.classes.MyResources true
-# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
-runJava -cp mods/exported.named.bundles -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
- jdk.test.resources.exported.props.MyResources true
-
-#######################################
-# Test cases with jdk.pkg.resources.* #
-#######################################
-# Prepare resource bundles in an unnamed module
-PKG=$TESTSRC/src/pkg
-mkdir -p classes/jdk/pkg/resources/props
-$JAVAC -g -d classes $PKG/jdk/pkg/test/Main.java $PKG/jdk/pkg/resources/classes/MyResources.java
-cp $PKG/jdk/pkg/resources/props/MyResources.properties classes/jdk/pkg/resources/props
-
-# jdk.pkg.resources.* are in an unnamed module.
-# jdk.pkg.test.Main calls ResourceBundle.getBundle with an unnamed module.
-runJava -cp classes jdk.pkg.test.Main jdk.pkg.resources.classes.MyResources true
-runJava -cp classes jdk.pkg.test.Main jdk.pkg.resources.props.MyResources true
-
-exit $STATUS
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/src/bundles/jdk/test/resources/MyResources.xml Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!---->
-
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
-<properties>
- <comment>Test data for ResourceBundle</comment>
- <entry key="key">root: message</entry>
-</properties>
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/src/bundles/jdk/test/resources/MyResources_de.xml Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!---->
-
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
-<properties>
- <comment>Test data for ResourceBundle</comment>
- <entry key="key">de: message</entry>
-</properties>
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/src/bundles/jdk/test/resources/MyResources_en.xml Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!---->
-
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
-<properties>
- <comment>Test data for ResourceBundle</comment>
- <entry key="key">en: message</entry>
-</properties>
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/src/bundles/jdk/test/resources/MyResources_fr.xml Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!---->
-
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
-<properties>
- <comment>Test data for ResourceBundle</comment>
- <entry key="key">fr: message</entry>
-</properties>
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/src/bundles/jdk/test/resources/MyResources_ja.xml Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!---->
-
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
-<properties>
- <comment>Test data for ResourceBundle in named modules.</comment>
- <entry key="key">ja: message</entry>
-</properties>
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/src/bundles/jdk/test/resources/MyResources_zh.xml Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!---->
-
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
-<properties>
- <comment>Test data for ResourceBundle in named modules.</comment>
- <entry key="key">zh: message</entry>
-</properties>
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/src/bundles/jdk/test/resources/MyResources_zh_TW.xml Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!---->
-
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
-<properties>
- <comment>Test data for ResourceBundle in named modules.</comment>
- <entry key="key">zh-TW: message</entry>
-</properties>
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/src/bundles/jdk/test/resources/spi/MyResourcesProvider.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-package jdk.test.resources.spi;
-
-import java.io.BufferedInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.ResourceBundle;
-import java.util.spi.ResourceBundleProvider;
-
-public class MyResourcesProvider implements ResourceBundleProvider {
- @Override
- public ResourceBundle getBundle(String baseName, Locale locale) {
- String xmlName = toXMLName(baseName, locale);
- try (InputStream is = this.getClass().getModule().getResourceAsStream(xmlName)) {
- return new XMLResourceBundle(new BufferedInputStream(is));
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- private String toXMLName(String baseName, Locale locale) {
- StringBuilder sb = new StringBuilder(baseName.replace('.', '/'));
- String lang = locale.getLanguage();
- if (!lang.isEmpty()) {
- sb.append('_').append(lang);
- String country = locale.getCountry();
- if (!country.isEmpty()) {
- sb.append('_').append(country);
- }
- }
- return sb.append(".xml").toString();
- }
-
- private static class XMLResourceBundle extends ResourceBundle {
- private Properties props;
-
- XMLResourceBundle(InputStream stream) throws IOException {
- props = new Properties();
- props.loadFromXML(stream);
- }
-
- @Override
- protected Object handleGetObject(String key) {
- if (key == null) {
- throw new NullPointerException();
- }
- return props.get(key);
- }
-
- @Override
- public Enumeration<String> getKeys() {
- // Not implemented
- return null;
- }
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/src/bundles/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module bundles {
- exports jdk.test.resources.spi to test;
- provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.spi.MyResourcesProvider;
-}
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/src/test/jdk/test/Main.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-package jdk.test;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-public class Main {
- public static void main(String[] args) throws Exception {
- int errors = 0;
- for (String loctag : args) {
- Locale locale = Locale.forLanguageTag(loctag);
- if (locale.equals(Locale.ROOT)) {
- continue;
- }
- ResourceBundle rb = ResourceBundle.getBundle("jdk.test.resources.MyResources",
- locale);
- String tag = locale.toLanguageTag(); // normalized
- String value = rb.getString("key");
- System.out.println("locale = " + tag + ", value = " + value);
- if (!value.startsWith(tag + ':')) {
- System.out.println("ERROR: " + value + " expected: " + tag);
- errors++;
- }
- }
- if (errors > 0) {
- throw new RuntimeException(errors + " errors");
- }
- }
-}
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/src/test/module-info.java Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.
- */
-
-module test {
- requires bundles;
-
- uses jdk.test.resources.spi.MyResourcesProvider;
-}
--- a/test/jdk/java/util/ResourceBundle/modules/xmlformat/xmlformat.sh Thu Nov 15 21:26:35 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-#
-# Copyright (c) 2015, 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.
-#
-
-# @test
-# @summary Simple test case for ResourceBundle with modules;
-# ResourceBundle.getBundle caller is in module named "test" and
-# all resource bundles are in single module named "bundles".
-
-
-set -e
-
-if [ -z "$TESTJAVA" ]; then
- if [ $# -lt 1 ]; then exit 1; fi
- TESTJAVA="$1"; shift
- COMPILEJAVA="${TESTJAVA}"
- TESTSRC="`pwd`"
- TESTCLASSES="`pwd`"
-fi
-
-JAVAC="$COMPILEJAVA/bin/javac"
-JAVA="$TESTJAVA/bin/java"
-
-rm -rf mods
-
-mkdir -p mods/test
-
-B=bundles
-mkdir -p mods/$B
-CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
-if [ "x$CLASSES" != x ]; then
- $JAVAC -g -d mods --module-source-path $TESTSRC/src $CLASSES
-fi
-PROPS="`(cd $TESTSRC/src/$B; find . -name '*.xml')`"
-if [ "x$PROPS" != x ]; then
- for P in $PROPS
- do
- D=`dirname $P`
- mkdir -p mods/$B/$D
- cp $TESTSRC/src/$B/$P mods/$B/$D/
- done
-fi
-
-$JAVAC -g -d mods --module-source-path $TESTSRC/src \
- -cp mods/bundles `find $TESTSRC/src/test -name "*.java"`
-
-$JAVA -p mods -m test/jdk.test.Main de fr ja zh-tw en de
-
-exit $?