--- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java Wed Jul 05 18:46:58 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java Mon Feb 18 11:33:35 2013 -0800
@@ -29,6 +29,10 @@
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
/**
* This class is duplicated for each subpackage so keep it in sync.
@@ -141,6 +145,38 @@
});
}
+ /**
+ * Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
+ * @param bundle the base name of the resource bundle, a fully qualified class name
+ * @return a resource bundle for the given base name and the default locale
+ */
+ public static ResourceBundle getResourceBundle(String bundle) {
+ return getResourceBundle(bundle, Locale.getDefault());
+ }
+
+ /**
+ * Gets a resource bundle using the specified base name and locale, and the caller's class loader.
+ * @param bundle the base name of the resource bundle, a fully qualified class name
+ * @param locale the locale for which a resource bundle is desired
+ * @return a resource bundle for the given base name and locale
+ */
+ public static ResourceBundle getResourceBundle(final String bundle, final Locale locale) {
+ return AccessController.doPrivileged(new PrivilegedAction<ResourceBundle>() {
+ public ResourceBundle run() {
+ try {
+ return PropertyResourceBundle.getBundle(bundle, locale);
+ } catch (MissingResourceException e) {
+ try {
+ return PropertyResourceBundle.getBundle(bundle, new Locale("en", "US"));
+ } catch (MissingResourceException e2) {
+ throw new MissingResourceException(
+ "Could not load any resource bundle by " + bundle, bundle, "");
+ }
+ }
+ }
+ });
+ }
+
static boolean getFileExists(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {