*
*
+ * @version $Id: JavaWrapper.java,v 1.3 2007-07-19 04:34:52 ofung Exp $
* @author M. Dahm
* @see ClassLoader
*/
@@ -79,7 +80,7 @@ public class JavaWrapper {
private java.lang.ClassLoader loader;
private static java.lang.ClassLoader getClassLoader() {
- String s = System.getProperty("bcel.classloader");
+ String s = SecuritySupport.getSystemProperty("bcel.classloader");
if((s == null) || "".equals(s))
s = "com.sun.org.apache.bcel.internal.util.ClassLoader";
diff --git a/jaxp/src/com/sun/org/apache/bcel/internal/util/SecuritySupport.java b/jaxp/src/com/sun/org/apache/bcel/internal/util/SecuritySupport.java
new file mode 100644
index 00000000000..22f8d39e124
--- /dev/null
+++ b/jaxp/src/com/sun/org/apache/bcel/internal/util/SecuritySupport.java
@@ -0,0 +1,223 @@
+/*
+ * reserved comment block
+ * DO NOT REMOVE OR ALTER!
+ */
+/*
+ * Copyright 2002-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.sun.org.apache.bcel.internal.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.InputStream;
+import java.lang.ClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ListResourceBundle;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * This class is duplicated for each subpackage so keep it in sync. It is
+ * package private and therefore is not exposed as part of any API.
+ *
+ * @xerces.internal
+ */
+public final class SecuritySupport {
+
+ private static final SecuritySupport securitySupport = new SecuritySupport();
+
+ /**
+ * Return an instance of this class.
+ */
+ public static SecuritySupport getInstance() {
+ return securitySupport;
+ }
+
+ static ClassLoader getContextClassLoader() {
+ return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+
+ static ClassLoader getSystemClassLoader() {
+ return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = ClassLoader.getSystemClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+
+ static ClassLoader getParentClassLoader(final ClassLoader cl) {
+ return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader parent = null;
+ try {
+ parent = cl.getParent();
+ } catch (SecurityException ex) {
+ }
+
+ // eliminate loops in case of the boot
+ // ClassLoader returning itself as a parent
+ return (parent == cl) ? null : parent;
+ }
+ });
+ }
+
+ public static String getSystemProperty(final String propName) {
+ return (String) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return System.getProperty(propName);
+ }
+ });
+ }
+
+ static FileInputStream getFileInputStream(final File file)
+ throws FileNotFoundException {
+ try {
+ return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws FileNotFoundException {
+ return new FileInputStream(file);
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (FileNotFoundException) e.getException();
+ }
+ }
+
+ /**
+ * Return resource using the same classloader for the ObjectFactory by
+ * default or bootclassloader when Security Manager is in place
+ */
+ public static InputStream getResourceAsStream(final String name) {
+ if (System.getSecurityManager() != null) {
+ return getResourceAsStream(null, name);
+ } else {
+ return getResourceAsStream(findClassLoader(), name);
+ }
+ }
+
+ public static InputStream getResourceAsStream(final ClassLoader cl,
+ final String name) {
+ return (InputStream) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ InputStream ris;
+ if (cl == null) {
+ ris = Object.class.getResourceAsStream("/" + name);
+ } else {
+ ris = cl.getResourceAsStream(name);
+ }
+ return ris;
+ }
+ });
+ }
+
+ /**
+ * 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 ListResourceBundle 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 ListResourceBundle getResourceBundle(final String bundle, final Locale locale) {
+ return AccessController.doPrivileged(new PrivilegedAction() {
+ public ListResourceBundle run() {
+ try {
+ return (ListResourceBundle) ResourceBundle.getBundle(bundle, locale);
+ } catch (MissingResourceException e) {
+ try {
+ return (ListResourceBundle) ResourceBundle.getBundle(bundle, new Locale("en", "US"));
+ } catch (MissingResourceException e2) {
+ throw new MissingResourceException(
+ "Could not load any resource bundle by " + bundle, bundle, "");
+ }
+ }
+ }
+ });
+ }
+
+ public static String[] getFileList(final File f, final FilenameFilter filter) {
+ return ((String[]) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return f.list(filter);
+ }
+ }));
+ }
+
+ public static boolean getFileExists(final File f) {
+ return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+ }
+ })).booleanValue();
+ }
+
+ static long getLastModified(final File f) {
+ return ((Long) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return new Long(f.lastModified());
+ }
+ })).longValue();
+ }
+
+
+ /**
+ * Figure out which ClassLoader to use.
+ */
+ public static ClassLoader findClassLoader()
+ {
+ if (System.getSecurityManager()!=null) {
+ //this will ensure bootclassloader is used
+ return null;
+ } else {
+ return SecuritySupport.class.getClassLoader();
+ }
+ } // findClassLoader():ClassLoader
+
+ private SecuritySupport() {
+ }
+}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLMessages.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLMessages.java
index 2c2f3c1509c..00d11e97f51 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLMessages.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLMessages.java
@@ -22,68 +22,72 @@
*/
package com.sun.org.apache.xalan.internal.res;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.util.ListResourceBundle;
import com.sun.org.apache.xpath.internal.res.XPATHMessages;
/**
- * Sets things up for issuing error messages. This class is misnamed, and
- * should be called XalanMessages, or some such.
+ * Sets things up for issuing error messages. This class is misnamed, and should
+ * be called XalanMessages, or some such.
+ *
* @xsl.usage internal
*/
-public class XSLMessages extends XPATHMessages
-{
+public class XSLMessages extends XPATHMessages {
- /** The language specific resource object for Xalan messages. */
- private static ListResourceBundle XSLTBundle = null;
+ /**
+ * The language specific resource object for Xalan messages.
+ */
+ private static ListResourceBundle XSLTBundle = null;
+ /**
+ * The class name of the Xalan error message string table.
+ */
+ private static final String XSLT_ERROR_RESOURCES =
+ "com.sun.org.apache.xalan.internal.res.XSLTErrorResources";
- /** The class name of the Xalan error message string table. */
- private static final String XSLT_ERROR_RESOURCES =
- "com.sun.org.apache.xalan.internal.res.XSLTErrorResources";
-
- /**
- * Creates a message from the specified key and replacement
- * arguments, localized to the given locale.
- *
- * @param msgKey The key for the message text.
- * @param args The arguments to be used as replacement text
- * in the message created.
- *
- * @return The formatted message string.
- */
- public static final String createMessage(String msgKey, Object args[]) //throws Exception
- {
- if (XSLTBundle == null)
- XSLTBundle = loadResourceBundle(XSLT_ERROR_RESOURCES);
-
- if (XSLTBundle != null)
+ /**
+ * Creates a message from the specified key and replacement arguments,
+ * localized to the given locale.
+ *
+ * @param msgKey The key for the message text.
+ * @param args The arguments to be used as replacement text in the message
+ * created.
+ *
+ * @return The formatted message string.
+ */
+ public static String createMessage(String msgKey, Object args[]) //throws Exception
{
- return createMsg(XSLTBundle, msgKey, args);
+ if (XSLTBundle == null) {
+ XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES);
+ }
+
+ if (XSLTBundle != null) {
+ return createMsg(XSLTBundle, msgKey, args);
+ } else {
+ return "Could not load any resource bundles.";
+ }
}
- else
- return "Could not load any resource bundles.";
- }
- /**
- * Creates a message from the specified key and replacement
- * arguments, localized to the given locale.
- *
- * @param msgKey The key for the message text.
- * @param args The arguments to be used as replacement text
- * in the message created.
- *
- * @return The formatted warning string.
- */
- public static final String createWarning(String msgKey, Object args[]) //throws Exception
- {
- if (XSLTBundle == null)
- XSLTBundle = loadResourceBundle(XSLT_ERROR_RESOURCES);
-
- if (XSLTBundle != null)
+ /**
+ * Creates a message from the specified key and replacement arguments,
+ * localized to the given locale.
+ *
+ * @param msgKey The key for the message text.
+ * @param args The arguments to be used as replacement text in the message
+ * created.
+ *
+ * @return The formatted warning string.
+ */
+ public static String createWarning(String msgKey, Object args[]) //throws Exception
{
- return createMsg(XSLTBundle, msgKey, args);
+ if (XSLTBundle == null) {
+ XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES);
+ }
+
+ if (XSLTBundle != null) {
+ return createMsg(XSLTBundle, msgKey, args);
+ } else {
+ return "Could not load any resource bundles.";
+ }
}
- else
- return "Could not load any resource bundles.";
- }
}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java
index 65d4ae14f72..aea4fffa668 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java
@@ -1448,68 +1448,4 @@ public class XSLTErrorResources extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
}
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
-
-}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java
index 7700f049e85..d528a26f957 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java
@@ -1448,68 +1448,4 @@ public class XSLTErrorResources_de extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
}
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
-
-}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java
index f6031bf3d22..68fda6d4971 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java
@@ -1448,68 +1448,4 @@ public class XSLTErrorResources_es extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
}
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
-
-}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java
index 0b96e29db96..eb373095af1 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java
@@ -1448,68 +1448,4 @@ public class XSLTErrorResources_fr extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
}
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
-
-}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java
index fcddcebc84c..ff335021637 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java
@@ -1448,68 +1448,4 @@ public class XSLTErrorResources_it extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
}
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
-
-}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java
index 9556671f703..ed1a0243585 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java
@@ -1448,68 +1448,4 @@ public class XSLTErrorResources_ja extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
}
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
-
-}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java
index 49534e07009..9a57758af14 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java
@@ -1448,68 +1448,4 @@ public class XSLTErrorResources_ko extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
}
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
-
-}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java
index d4fafaf4524..62341a60b83 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java
@@ -1449,68 +1449,5 @@ public class XSLTErrorResources_pt_BR extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java
index 12808a68aea..ee85426b0dc 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java
@@ -1448,68 +1448,4 @@ public class XSLTErrorResources_sv extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
}
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
-
-}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java
index e43497dcc48..1c3a0c7cc2c 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java
@@ -1448,68 +1448,4 @@ public class XSLTErrorResources_zh_CN extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
}
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
-
-}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java
index 4e172c56f10..07ad5afa9c0 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java
@@ -1448,68 +1448,4 @@ public class XSLTErrorResources_zh_TW extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
}
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
-
-}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java b/jaxp/src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java
index 8e489bb736d..ff9b1a6e6a5 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java
@@ -54,6 +54,8 @@ public class ObjectFactory {
//
// Constants
//
+ private static final String XALAN_INTERNAL = "com.sun.org.apache.xalan.internal";
+ private static final String XERCES_INTERNAL = "com.sun.org.apache.xerces.internal";
// name of default properties file to look for in JDK's jre/lib directory
private static final String DEFAULT_PROPERTIES_FILENAME =
@@ -514,12 +516,17 @@ public class ObjectFactory {
//class. Restrict the access to the package classes as specified in java.security policy.
SecurityManager security = System.getSecurityManager();
try{
- if (security != null){
+ if (security != null){
+ if (className.startsWith(XALAN_INTERNAL) ||
+ className.startsWith(XERCES_INTERNAL)) {
+ cl = null;
+ } else {
final int lastDot = className.lastIndexOf(".");
String packageName = className;
if (lastDot != -1) packageName = className.substring(0, lastDot);
security.checkPackageAccess(packageName);
- }
+ }
+ }
}catch(SecurityException e){
throw e;
}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java b/jaxp/src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
index 4437a488e6a..b813b4c0d28 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
@@ -32,10 +32,14 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import java.util.ListResourceBundle;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
/**
- * This class is duplicated for each subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of any API.
+ * This class is duplicated for each subpackage so keep it in sync. It is
+ * package private and therefore is not exposed as part of any API.
*
* @xerces.internal
*/
@@ -51,39 +55,39 @@ public final class SecuritySupport {
}
static ClassLoader getContextClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
+ return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
- } catch (SecurityException ex) { }
+ } catch (SecurityException ex) {
+ }
return cl;
}
});
}
static ClassLoader getSystemClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
+ return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
try {
cl = ClassLoader.getSystemClassLoader();
- } catch (SecurityException ex) {}
+ } catch (SecurityException ex) {
+ }
return cl;
}
});
}
static ClassLoader getParentClassLoader(final ClassLoader cl) {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
+ return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader parent = null;
try {
parent = cl.getParent();
- } catch (SecurityException ex) {}
+ } catch (SecurityException ex) {
+ }
// eliminate loops in case of the boot
// ClassLoader returning itself as a parent
@@ -93,20 +97,25 @@ public final class SecuritySupport {
}
public static String getSystemProperty(final String propName) {
- return (String)
- AccessController.doPrivileged(new PrivilegedAction() {
+ return (String) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(propName);
}
});
}
+ public static String getSystemProperty(final String propName, final String def) {
+ return (String) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return System.getProperty(propName, def);
+ }
+ });
+ }
+
static FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
+ throws FileNotFoundException {
try {
- return (FileInputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws FileNotFoundException {
return new FileInputStream(file);
}
@@ -115,9 +124,10 @@ public final class SecuritySupport {
throw (FileNotFoundException)e.getException();
}
}
+
/**
- * Return resource using the same classloader for the ObjectFactory by default
- * or bootclassloader when Security Manager is in place
+ * Return resource using the same classloader for the ObjectFactory by
+ * default or bootclassloader when Security Manager is in place
*/
public static InputStream getResourceAsStream(final String name) {
if (System.getSecurityManager()!=null) {
@@ -128,10 +138,8 @@ public final class SecuritySupport {
}
public static InputStream getResourceAsStream(final ClassLoader cl,
- final String name)
- {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
+ final String name) {
+ return (InputStream) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
InputStream ris;
if (cl == null) {
@@ -144,9 +152,40 @@ public final class SecuritySupport {
});
}
- static boolean getFileExists(final File f) {
- return ((Boolean)
- AccessController.doPrivileged(new PrivilegedAction() {
+ /**
+ * 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 ListResourceBundle 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 ListResourceBundle getResourceBundle(final String bundle, final Locale locale) {
+ return AccessController.doPrivileged(new PrivilegedAction() {
+ public ListResourceBundle run() {
+ try {
+ return (ListResourceBundle)ResourceBundle.getBundle(bundle, locale);
+ } catch (MissingResourceException e) {
+ try {
+ return (ListResourceBundle)ResourceBundle.getBundle(bundle, new Locale("en", "US"));
+ } catch (MissingResourceException e2) {
+ throw new MissingResourceException(
+ "Could not load any resource bundle by " + bundle, bundle, "");
+ }
+ }
+ }
+ });
+ }
+
+ public static boolean getFileExists(final File f) {
+ return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return f.exists() ? Boolean.TRUE : Boolean.FALSE;
}
@@ -154,13 +193,14 @@ public final class SecuritySupport {
}
static long getLastModified(final File f) {
- return ((Long)
- AccessController.doPrivileged(new PrivilegedAction() {
+ return ((Long) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return new Long(f.lastModified());
}
})).longValue();
}
- private SecuritySupport () {}
+
+ private SecuritySupport() {
+ }
}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java b/jaxp/src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
index 11d2cdcdc46..928da3e9e9d 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
@@ -23,6 +23,7 @@
package com.sun.org.apache.xalan.internal.xslt;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.File;
import java.io.FileWriter;
@@ -574,7 +575,7 @@ public class EnvironmentCheck
// Grab java version for later use
try
{
- String javaVersion = System.getProperty("java.version");
+ String javaVersion = SecuritySupport.getSystemProperty("java.version");
h.put("java.version", javaVersion);
}
@@ -593,7 +594,7 @@ public class EnvironmentCheck
{
// This is present in all JVM's
- String cp = System.getProperty("java.class.path");
+ String cp = SecuritySupport.getSystemProperty("java.class.path");
h.put("java.class.path", cp);
@@ -603,7 +604,7 @@ public class EnvironmentCheck
h.put(FOUNDCLASSES + "java.class.path", classpathJars);
// Also check for JDK 1.2+ type classpaths
- String othercp = System.getProperty("sun.boot.class.path");
+ String othercp = SecuritySupport.getSystemProperty("sun.boot.class.path");
if (null != othercp)
{
@@ -617,7 +618,7 @@ public class EnvironmentCheck
//@todo NOTE: We don't actually search java.ext.dirs for
// *.jar files therein! This should be updated
- othercp = System.getProperty("java.ext.dirs");
+ othercp = SecuritySupport.getSystemProperty("java.ext.dirs");
if (null != othercp)
{
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xslt/Process.java b/jaxp/src/com/sun/org/apache/xalan/internal/xslt/Process.java
index 216c4cfee28..67aa7040834 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xslt/Process.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xslt/Process.java
@@ -57,6 +57,7 @@ import com.sun.org.apache.xalan.internal.res.XSLMessages;
import com.sun.org.apache.xalan.internal.res.XSLTErrorResources;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.ConfigurationError;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
//J2SE does not support Xalan interpretive
/*
@@ -180,7 +181,7 @@ public class Process
java.io.PrintWriter diagnosticsWriter = new PrintWriter(System.err, true);
java.io.PrintWriter dumpWriter = diagnosticsWriter;
ResourceBundle resbundle =
- (XSLMessages.loadResourceBundle(
+ (SecuritySupport.getResourceBundle(
com.sun.org.apache.xml.internal.utils.res.XResourceBundle.ERROR_RESOURCES));
String flavor = "s2s";
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
index 3cf487aa4ef..80ce77bb8b8 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
@@ -410,7 +410,7 @@ public class Parser implements Constants, ContentHandler {
}
}
catch (TypeCheckError e) {
- reportError(ERROR, new ErrorMsg(e));
+ reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
}
}
@@ -430,7 +430,7 @@ public class Parser implements Constants, ContentHandler {
}
catch (IOException e) {
if (_xsltc.debug()) e.printStackTrace();
- reportError(ERROR,new ErrorMsg(e));
+ reportError(ERROR,new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
}
catch (SAXException e) {
Throwable ex = e.getException();
@@ -438,15 +438,15 @@ public class Parser implements Constants, ContentHandler {
e.printStackTrace();
if (ex != null) ex.printStackTrace();
}
- reportError(ERROR, new ErrorMsg(e));
+ reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
}
catch (CompilerException e) {
if (_xsltc.debug()) e.printStackTrace();
- reportError(ERROR, new ErrorMsg(e));
+ reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
}
catch (Exception e) {
if (_xsltc.debug()) e.printStackTrace();
- reportError(ERROR, new ErrorMsg(e));
+ reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
}
return null;
}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
index e29915c0ecd..454027819b8 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
@@ -41,10 +41,12 @@ import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import com.sun.org.apache.bcel.internal.classfile.JavaClass;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
import com.sun.org.apache.xml.internal.dtm.DTM;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
@@ -278,7 +280,7 @@ public final class XSLTC {
return compile(input, _className);
}
catch (IOException e) {
- _parser.reportError(Constants.FATAL, new ErrorMsg(e));
+ _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
return false;
}
}
@@ -297,7 +299,7 @@ public final class XSLTC {
return compile(input, name);
}
catch (IOException e) {
- _parser.reportError(Constants.FATAL, new ErrorMsg(e));
+ _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
return false;
}
}
@@ -382,11 +384,11 @@ public final class XSLTC {
}
catch (Exception e) {
/*if (_debug)*/ e.printStackTrace();
- _parser.reportError(Constants.FATAL, new ErrorMsg(e));
+ _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
}
catch (Error e) {
if (_debug) e.printStackTrace();
- _parser.reportError(Constants.FATAL, new ErrorMsg(e));
+ _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
}
finally {
_reader = null; // reset this here to be sure it is not re-used
@@ -594,7 +596,7 @@ public final class XSLTC {
*/
public boolean setDestDirectory(String dstDirName) {
final File dir = new File(dstDirName);
- if (dir.exists() || dir.mkdirs()) {
+ if (SecuritySupport.getFileExists(dir) || dir.mkdirs()) {
_destDir = dir;
return true;
}
@@ -767,7 +769,7 @@ public final class XSLTC {
String parentDir = outFile.getParent();
if (parentDir != null) {
File parentFile = new File(parentDir);
- if (!parentFile.exists())
+ if (!SecuritySupport.getFileExists(parentFile))
parentFile.mkdirs();
}
}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java
index d2e68d4c1f0..de3783997e2 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java
@@ -997,7 +997,12 @@ public class ErrorMessages extends ListResourceBundle {
"kilobytes. This is usually caused by templates in a stylesheet " +
"that are very large. Try restructuring your stylesheet to use " +
"smaller templates."
- }
+ },
+
+ {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "When Java security is enabled, " +
+ "support for deserializing TemplatesImpl is disabled." +
+ "This can be overridden by setting the jdk.xml.enableTemplatesImplDeserialization" +
+ " system property to true."}
};
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java
index 1b1a80d8eea..faa7e99c26a 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java
@@ -23,6 +23,7 @@
package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
@@ -46,6 +47,8 @@ public final class ErrorMsg {
Object[] _params = null;
private boolean _isWarningError;
+ Throwable _cause;
+
// Compiler error messages
public static final String MULTIPLE_STYLESHEET_ERR = "MULTIPLE_STYLESHEET_ERR";
public static final String TEMPLATE_REDEF_ERR = "TEMPLATE_REDEF_ERR";
@@ -165,6 +168,8 @@ public final class ErrorMsg {
public static final String OUTLINE_ERR_METHOD_TOO_BIG =
"OUTLINE_ERR_METHOD_TOO_BIG";
+ public static final String DESERIALIZE_TRANSLET_ERR = "DESERIALIZE_TEMPLATES_ERR";
+
// All error messages are localized and are stored in resource bundles.
// This array and the following 4 strings are read from that bundle.
private static ResourceBundle _bundle;
@@ -175,7 +180,7 @@ public final class ErrorMsg {
public final static String RUNTIME_ERROR_KEY = "RUNTIME_ERROR_KEY";
static {
- _bundle = ResourceBundle.getBundle(
+ _bundle = SecuritySupport.getResourceBundle(
"com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMessages",
Locale.getDefault());
}
@@ -185,10 +190,11 @@ public final class ErrorMsg {
_line = 0;
}
- public ErrorMsg(Throwable e) {
- _code = null;
+ public ErrorMsg(String code, Throwable e) {
+ _code = code;
_message = e.getMessage();
_line = 0;
+ _cause = e;
}
public ErrorMsg(String message, int line) {
@@ -240,6 +246,10 @@ public final class ErrorMsg {
_params[1] = param2;
}
+ public Throwable getCause() {
+ return _cause;
+ }
+
private String getFileName(SyntaxTreeNode node) {
Stylesheet stylesheet = node.getStylesheet();
if (stylesheet != null)
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java
index a7409cedae2..f1f92221072 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java
@@ -26,6 +26,7 @@ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
import java.util.StringTokenizer;
import com.sun.org.apache.bcel.internal.generic.Type;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
import com.sun.org.apache.xml.internal.utils.XML11Char;
@@ -37,7 +38,7 @@ public final class Util {
private static char filesep;
static {
- String temp = System.getProperty("file.separator", "/");
+ String temp = SecuritySupport.getSystemProperty("file.separator", "/");
filesep = temp.charAt(0);
}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java
index 7057a32ffe2..aaf997a726c 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java
@@ -33,6 +33,7 @@ import com.sun.org.apache.xalan.internal.xsltc.TransletException;
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
import com.sun.org.apache.xml.internal.utils.StringComparable;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
/**
* Base class for sort records containing application specific sort keys
@@ -112,7 +113,7 @@ public abstract class NodeSortRecord {
try {
// -- W. Eliot Kimber (eliot@isogen.com)
colFactClassname =
- System.getProperty("com.sun.org.apache.xalan.internal.xsltc.COLLATOR_FACTORY");
+ SecuritySupport.getSystemProperty("com.sun.org.apache.xalan.internal.xsltc.COLLATOR_FACTORY");
}
catch (SecurityException e) {
// If we can't read the propery, just use default collator
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
index fc388d92ea9..554e1fd998d 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
@@ -23,6 +23,7 @@
package com.sun.org.apache.xalan.internal.xsltc.runtime;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.FieldPosition;
@@ -1583,7 +1584,7 @@ public final class BasisLibrary {
static {
String resource = "com.sun.org.apache.xalan.internal.xsltc.runtime.ErrorMessages";
- m_bundle = ResourceBundle.getBundle(resource);
+ m_bundle = SecuritySupport.getResourceBundle(resource);
}
/**
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java
index 11e14f05cfa..2b04e01fea4 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java
@@ -23,6 +23,7 @@
package com.sun.org.apache.xalan.internal.xsltc.runtime.output;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
@@ -36,7 +37,7 @@ class WriterOutputBuffer implements OutputBuffer {
static {
// Set a larger buffer size for Solaris
- final String osName = System.getProperty("os.name");
+ final String osName = SecuritySupport.getSystemProperty("os.name");
if (osName.equalsIgnoreCase("solaris")) {
BUFFER_SIZE = 32 * KB;
}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java
index 4ebf238565f..a3bd7f6d1ab 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java
@@ -43,6 +43,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
/**
* @author Morten Jorgensen
@@ -52,6 +53,8 @@ import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
*/
public final class TemplatesImpl implements Templates, Serializable {
static final long serialVersionUID = 673094361519270707L;
+ public final static String DESERIALIZE_TRANSLET = "jdk.xml.enableTemplatesImplDeserialization";
+
/**
* Name of the superclass of all translets. This is needed to
* determine which, among all classes comprising a translet,
@@ -186,6 +189,15 @@ public final class TemplatesImpl implements Templates, Serializable {
private void readObject(ObjectInputStream is)
throws IOException, ClassNotFoundException
{
+ SecurityManager security = System.getSecurityManager();
+ if (security != null){
+ String temp = SecuritySupport.getSystemProperty(DESERIALIZE_TRANSLET);
+ if (temp == null || !(temp.length()==0 || temp.equalsIgnoreCase("true"))) {
+ ErrorMsg err = new ErrorMsg(ErrorMsg.DESERIALIZE_TRANSLET_ERR);
+ throw new UnsupportedOperationException(err.toString());
+ }
+ }
+
is.defaultReadObject();
if (is.readBoolean()) {
_uriResolver = (URIResolver) is.readObject();
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
index 26b2f56de86..78d96aa0479 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
@@ -73,7 +73,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
-
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLFilter;
@@ -881,8 +881,14 @@ public class TransformerFactoryImpl
// Check that the transformation went well before returning
if (bytecodes == null) {
- ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
- TransformerConfigurationException exc = new TransformerConfigurationException(err.toString());
+ Vector errs = xsltc.getErrors();
+ ErrorMsg err = null;
+ if (errs != null) {
+ err = (ErrorMsg)errs.get(errs.size()-1);
+ } else {
+ err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
+ }
+ TransformerConfigurationException exc = new TransformerConfigurationException(err.toString(), err.getCause());
// Pass compiler errors to the error listener
if (_errorListener != null) {
@@ -1229,7 +1235,7 @@ public class TransformerFactoryImpl
// Find the parent directory of the translet.
String transletParentDir = transletFile.getParent();
if (transletParentDir == null)
- transletParentDir = System.getProperty("user.dir");
+ transletParentDir = SecuritySupport.getSystemProperty("user.dir");
File transletParentFile = new File(transletParentDir);
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMMessageFormatter.java b/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMMessageFormatter.java
index 8747181b874..f7d131fdb9b 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMMessageFormatter.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMMessageFormatter.java
@@ -20,10 +20,10 @@
package com.sun.org.apache.xerces.internal.dom;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
/**
* Used to format DOM error messages, using the system locale.
@@ -31,6 +31,7 @@ import java.util.PropertyResourceBundle;
* @xerces.internal
*
* @author Sandy Gao, IBM
+ * @version $Id: DOMMessageFormatter.java,v 1.6 2010-11-01 04:39:38 joehw Exp $
*/
public class DOMMessageFormatter {
public static final String DOM_DOMAIN = "http://www.w3.org/dom/DOMTR";
@@ -122,13 +123,13 @@ public class DOMMessageFormatter {
*/
public static void init(){
if (locale != null) {
- domResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages", locale);
- serResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages", locale);
- xmlResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ domResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages", locale);
+ serResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages", locale);
+ xmlResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
}else{
- domResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages");
- serResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages");
- xmlResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ domResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages");
+ serResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages");
+ xmlResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
}
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java
index 84e2c81634a..b761fc41974 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java
@@ -51,6 +51,7 @@ import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.parser.*;
import com.sun.org.apache.xerces.internal.impl.Constants;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.xml.internal.stream.Entity;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
@@ -1727,7 +1728,7 @@ protected static final String PARSER_SETTINGS =
// get the user.dir property
String userDir = "";
try {
- userDir = System.getProperty("user.dir");
+ userDir = SecuritySupport.getSystemProperty("user.dir");
}
catch (SecurityException se) {
}
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/DatatypeException.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/DatatypeException.java
index 9a0e0db4338..f38b1d3797f 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/DatatypeException.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/DatatypeException.java
@@ -20,6 +20,7 @@
package com.sun.org.apache.xerces.internal.impl.dv;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import java.util.MissingResourceException;
@@ -34,6 +35,7 @@ import java.util.MissingResourceException;
*
* @author Sandy Gao, IBM
*
+ * @version $Id: DatatypeException.java,v 1.6 2010-11-01 04:39:43 joehw Exp $
*/
public class DatatypeException extends Exception {
@@ -84,7 +86,7 @@ public class DatatypeException extends Exception {
*/
public String getMessage() {
ResourceBundle resourceBundle = null;
- resourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
+ resourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
if (resourceBundle == null)
throw new MissingResourceException("Property file not found!", "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", key);
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter.java
index 98a8e87325f..adb8c44ab2e 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter.java
@@ -20,12 +20,11 @@
package com.sun.org.apache.xerces.internal.impl.msg;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
@@ -34,7 +33,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Eric Ye, IBM
- * @version $Id: XMLMessageFormatter.java 3020 2011-02-28 23:51:33Z joehw $
+ * @version $Id: XMLMessageFormatter.java 3094 2012-03-21 05:50:01Z joehw $
*
*/
public class XMLMessageFormatter implements MessageFormatter {
@@ -72,12 +71,12 @@ public class XMLMessageFormatter implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_de.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_de.java
index 686371c830a..1f9d2816165 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_de.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_de.java
@@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
@@ -34,7 +35,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Eric Ye, IBM
- * @version $Id: XMLMessageFormatter_de.java 3021 2011-03-01 00:12:28Z joehw $
+ * @version $Id: XMLMessageFormatter_de.java 3094 2012-03-21 05:50:01Z joehw $
*
*/
public class XMLMessageFormatter_de implements MessageFormatter {
@@ -72,12 +73,12 @@ public class XMLMessageFormatter_de implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_es.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_es.java
index 437d33af1a5..164a2513a9e 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_es.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_es.java
@@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
@@ -34,7 +35,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Eric Ye, IBM
- * @version $Id: XMLMessageFormatter_es.java 3021 2011-03-01 00:12:28Z joehw $
+ * @version $Id: XMLMessageFormatter_es.java 3094 2012-03-21 05:50:01Z joehw $
*
*/
public class XMLMessageFormatter_es implements MessageFormatter {
@@ -72,12 +73,12 @@ public class XMLMessageFormatter_es implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_fr.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_fr.java
index 2acdd6632b7..e4e41292716 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_fr.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_fr.java
@@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
@@ -34,7 +35,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Eric Ye, IBM
- * @version $Id: XMLMessageFormatter_fr.java 3021 2011-03-01 00:12:28Z joehw $
+ * @version $Id: XMLMessageFormatter_fr.java 3094 2012-03-21 05:50:01Z joehw $
*
*/
public class XMLMessageFormatter_fr implements MessageFormatter {
@@ -72,12 +73,12 @@ public class XMLMessageFormatter_fr implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_it.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_it.java
index cd288bda0dc..e2dd5132d21 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_it.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_it.java
@@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
@@ -34,7 +35,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Eric Ye, IBM
- * @version $Id: XMLMessageFormatter_it.java 3021 2011-03-01 00:12:28Z joehw $
+ * @version $Id: XMLMessageFormatter_it.java 3094 2012-03-21 05:50:01Z joehw $
*
*/
public class XMLMessageFormatter_it implements MessageFormatter {
@@ -72,12 +73,12 @@ public class XMLMessageFormatter_it implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ja.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ja.java
index e232fe0801f..b3fb8563e67 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ja.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ja.java
@@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
@@ -34,7 +35,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Eric Ye, IBM
- * @version $Id: XMLMessageFormatter_ja.java 3021 2011-03-01 00:12:28Z joehw $
+ * @version $Id: XMLMessageFormatter_ja.java 3094 2012-03-21 05:50:01Z joehw $
*
*/
public class XMLMessageFormatter_ja implements MessageFormatter {
@@ -72,12 +73,12 @@ public class XMLMessageFormatter_ja implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ko.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ko.java
index e874485128a..3de7757c5bc 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ko.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ko.java
@@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
@@ -34,7 +35,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Eric Ye, IBM
- * @version $Id: XMLMessageFormatter_ko.java 3021 2011-03-01 00:12:28Z joehw $
+ * @version $Id: XMLMessageFormatter_ko.java 3094 2012-03-21 05:50:01Z joehw $
*
*/
public class XMLMessageFormatter_ko implements MessageFormatter {
@@ -72,12 +73,12 @@ public class XMLMessageFormatter_ko implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_pt_BR.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_pt_BR.java
index 15957b71da6..59b3d1d30a7 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_pt_BR.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_pt_BR.java
@@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
@@ -34,7 +35,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Eric Ye, IBM
- * @version $Id: XMLMessageFormatter_pt_BR.java 3021 2011-03-01 00:12:28Z joehw $
+ * @version $Id: XMLMessageFormatter_pt_BR.java 3094 2012-03-21 05:50:01Z joehw $
*
*/
public class XMLMessageFormatter_pt_BR implements MessageFormatter {
@@ -72,12 +73,12 @@ public class XMLMessageFormatter_pt_BR implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_sv.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_sv.java
index 4c220a7779d..00217ae4f7b 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_sv.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_sv.java
@@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
@@ -34,7 +35,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Eric Ye, IBM
- * @version $Id: XMLMessageFormatter_sv.java 3021 2011-03-01 00:12:28Z joehw $
+ * @version $Id: XMLMessageFormatter_sv.java 3094 2012-03-21 05:50:01Z joehw $
*
*/
public class XMLMessageFormatter_sv implements MessageFormatter {
@@ -72,12 +73,12 @@ public class XMLMessageFormatter_sv implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_CN.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_CN.java
index bebf698d364..4cfa9686da0 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_CN.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_CN.java
@@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
@@ -34,7 +35,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Eric Ye, IBM
- * @version $Id: XMLMessageFormatter_zh_CN.java 3021 2011-03-01 00:12:28Z joehw $
+ * @version $Id: XMLMessageFormatter_zh_CN.java 3094 2012-03-21 05:50:01Z joehw $
*
*/
public class XMLMessageFormatter_zh_CN implements MessageFormatter {
@@ -72,12 +73,12 @@ public class XMLMessageFormatter_zh_CN implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_TW.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_TW.java
index e594e853c86..4f34fa2adc5 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_TW.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_TW.java
@@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
@@ -34,7 +35,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Eric Ye, IBM
- * @version $Id: XMLMessageFormatter_zh_TW.java 3021 2011-03-01 00:12:28Z joehw $
+ * @version $Id: XMLMessageFormatter_zh_TW.java 3094 2012-03-21 05:50:01Z joehw $
*
*/
public class XMLMessageFormatter_zh_TW implements MessageFormatter {
@@ -72,12 +73,12 @@ public class XMLMessageFormatter_zh_TW implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegexParser.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegexParser.java
index 089a7240770..ed1cda9ba3e 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegexParser.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegexParser.java
@@ -20,6 +20,7 @@
package com.sun.org.apache.xerces.internal.impl.xpath.regex;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -95,10 +96,10 @@ class RegexParser {
public void setLocale(Locale locale) {
try {
if (locale != null) {
- this.resources = ResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message", locale);
+ this.resources = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message", locale);
}
else {
- this.resources = ResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message");
+ this.resources = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message");
}
}
catch (MissingResourceException mre) {
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XSMessageFormatter.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XSMessageFormatter.java
index 1f1c616d1b1..0a51a3c6b8f 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XSMessageFormatter.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XSMessageFormatter.java
@@ -20,11 +20,11 @@
package com.sun.org.apache.xerces.internal.impl.xs;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
/**
@@ -34,6 +34,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* @xerces.internal
*
* @author Elena Litani, IBM
+ * @version $Id: XSMessageFormatter.java,v 1.6 2010-11-01 04:39:55 joehw Exp $
*/
public class XSMessageFormatter implements MessageFormatter {
/**
@@ -66,12 +67,12 @@ public class XSMessageFormatter implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
}
String msg = fResourceBundle.getString(key);
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/JAXPValidationMessageFormatter.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/JAXPValidationMessageFormatter.java
index ccf12a5ab0f..5c510533c98 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/JAXPValidationMessageFormatter.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/JAXPValidationMessageFormatter.java
@@ -20,15 +20,16 @@
package com.sun.org.apache.xerces.internal.jaxp.validation;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
/**
*
Used to format JAXP Validation API error messages using a specified locale.
*
* @author Michael Glavassevich, IBM
+ * @version $Id: JAXPValidationMessageFormatter.java,v 1.5 2010-11-01 04:40:08 joehw Exp $
*/
final class JAXPValidationMessageFormatter {
@@ -54,11 +55,11 @@ final class JAXPValidationMessageFormatter {
ResourceBundle resourceBundle = null;
if (locale != null) {
resourceBundle =
- PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages", locale);
+ SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages", locale);
}
else {
resourceBundle =
- PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages");
+ SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/util/DatatypeMessageFormatter.java b/jaxp/src/com/sun/org/apache/xerces/internal/util/DatatypeMessageFormatter.java
index 7c1c12b9891..b964a8fbfd8 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/util/DatatypeMessageFormatter.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/DatatypeMessageFormatter.java
@@ -20,15 +20,16 @@
package com.sun.org.apache.xerces.internal.util;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
-import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
/**
*
Used to format JAXP 1.3 Datatype API error messages using a specified locale.
*
* @author Neeraj Bajaj, Sun Microsystems
+ * @version $Id: DatatypeMessageFormatter.java,v 1.6 2010-11-01 04:40:14 joehw Exp $
*/
public class DatatypeMessageFormatter {
@@ -56,11 +57,11 @@ public class DatatypeMessageFormatter {
ResourceBundle resourceBundle = null;
if (locale != null) {
resourceBundle =
- PropertyResourceBundle.getBundle(BASE_NAME, locale);
+ SecuritySupport.getResourceBundle(BASE_NAME, locale);
}
else {
resourceBundle =
- PropertyResourceBundle.getBundle(BASE_NAME);
+ SecuritySupport.getResourceBundle(BASE_NAME);
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/util/SAXMessageFormatter.java b/jaxp/src/com/sun/org/apache/xerces/internal/util/SAXMessageFormatter.java
index afcfec38d80..29648a629f9 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/util/SAXMessageFormatter.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/SAXMessageFormatter.java
@@ -19,16 +19,17 @@
*/
package com.sun.org.apache.xerces.internal.util;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
/**
* Used to format SAX error messages using a specified locale.
*
* @author Michael Glavassevich, IBM
*
+ * @version $Id: SAXMessageFormatter.java,v 1.6 2010-11-01 04:40:14 joehw Exp $
*/
public class SAXMessageFormatter {
@@ -54,11 +55,11 @@ public class SAXMessageFormatter {
ResourceBundle resourceBundle = null;
if (locale != null) {
resourceBundle =
- PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages", locale);
+ SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages", locale);
}
else {
resourceBundle =
- PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages");
+ SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages");
}
// format message
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java
index c405a22ec7e..dd510b622bc 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java
@@ -61,6 +61,8 @@
package com.sun.org.apache.xerces.internal.util;
import com.sun.org.apache.xerces.internal.impl.Constants;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
/**
* This class is a container for parser settings that relate to
* security, or more specifically, it is intended to be used to prevent denial-of-service
@@ -77,6 +79,7 @@ import com.sun.org.apache.xerces.internal.impl.Constants;
*
* @author Neil Graham, IBM
*
+ * @version $Id: SecurityManager.java,v 1.5 2010-11-01 04:40:14 joehw Exp $
*/
public final class SecurityManager {
@@ -176,41 +179,48 @@ public final class SecurityManager {
private void readSystemProperties(){
- //TODO: also read SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT
- try {
- String value = System.getProperty(Constants.ENTITY_EXPANSION_LIMIT);
- if(value != null && !value.equals("")){
- entityExpansionLimit = Integer.parseInt(value);
- if (entityExpansionLimit < 0)
- entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
- }
- else
- entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
- }catch(Exception ex){}
+ //TODO: also read SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT
+ try {
+ String value = getSystemProperty(Constants.ENTITY_EXPANSION_LIMIT);
+ if(value != null && !value.equals("")){
+ entityExpansionLimit = Integer.parseInt(value);
+ if (entityExpansionLimit < 0)
+ entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
+ }
+ else
+ entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
+ }catch(Exception ex){}
- try {
- String value = System.getProperty(Constants.MAX_OCCUR_LIMIT);
- if(value != null && !value.equals("")){
- maxOccurLimit = Integer.parseInt(value);
- if (maxOccurLimit < 0)
- maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
- }
- else
- maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
- }catch(Exception ex){}
+ try {
+ String value = getSystemProperty(Constants.MAX_OCCUR_LIMIT);
+ if(value != null && !value.equals("")){
+ maxOccurLimit = Integer.parseInt(value);
+ if (maxOccurLimit < 0)
+ maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
+ }
+ else
+ maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
+ }catch(Exception ex){}
- try {
- String value = System.getProperty(Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT);
- if(value != null && !value.equals("")){
- fElementAttributeLimit = Integer.parseInt(value);
- if ( fElementAttributeLimit < 0)
- fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
- }
- else
- fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
+ try {
+ String value = getSystemProperty(Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT);
+ if(value != null && !value.equals("")){
+ fElementAttributeLimit = Integer.parseInt(value);
+ if ( fElementAttributeLimit < 0)
+ fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
+ }
+ else
+ fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
}catch(Exception ex){}
}
+ private String getSystemProperty(final String propName) {
+ return AccessController.doPrivileged(new PrivilegedAction() {
+ public String run() {
+ return System.getProperty(propName);
+ }
+ });
+ }
} // class SecurityManager
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java b/jaxp/src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java
index afc0d45a5a1..63ce5e59b08 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java
@@ -48,6 +48,7 @@ public final class ObjectFactory {
//
// Constants
//
+ private static final String DEFAULT_INTERNAL_CLASSES = "com.sun.org.apache.";
// name of default properties file to look for in JDK's jre/lib directory
private static final String DEFAULT_PROPERTIES_FILENAME = "xerces.properties";
@@ -305,10 +306,14 @@ public final class ObjectFactory {
//restrict the access to package as speicified in java.security policy
SecurityManager security = System.getSecurityManager();
if (security != null) {
- final int lastDot = className.lastIndexOf(".");
- String packageName = className;
- if (lastDot != -1) packageName = className.substring(0, lastDot);
- security.checkPackageAccess(packageName);
+ if (className.startsWith(DEFAULT_INTERNAL_CLASSES)) {
+ cl = null;
+ } else {
+ final int lastDot = className.lastIndexOf(".");
+ String packageName = className;
+ if (lastDot != -1) packageName = className.substring(0, lastDot);
+ security.checkPackageAccess(packageName);
+ }
}
Class providerClass;
if (cl == null) {
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java b/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
index 42ca503a8cb..b1d9d870412 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
@@ -29,6 +29,10 @@ import java.security.AccessController;
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 @@ public final class SecuritySupport {
});
}
+ /**
+ * 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() {
+ 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() {
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeMessageFormatter.java b/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeMessageFormatter.java
index 0e6adc175eb..0275615e2fc 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeMessageFormatter.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeMessageFormatter.java
@@ -20,11 +20,11 @@
package com.sun.org.apache.xerces.internal.xinclude;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
// TODO: fix error messages in XIncludeMessages.properties
/**
@@ -32,6 +32,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
*
* @author Peter McCracken, IBM
*
+ * @version $Id: XIncludeMessageFormatter.java,v 1.7 2010-11-01 04:40:18 joehw Exp $
*/
public class XIncludeMessageFormatter implements MessageFormatter {
@@ -61,12 +62,12 @@ public class XIncludeMessageFormatter implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages", locale);
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages");
}
String msg = fResourceBundle.getString(key);
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java
index 069cebd6fcc..639bdef7784 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java
@@ -24,6 +24,7 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* XPointerMessageFormatter provides error messages for the XPointer Framework
@@ -31,6 +32,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
*
* @xerces.internal
*
+ * @version $Id: XPointerMessageFormatter.java,v 1.5 2010-11-01 04:40:26 joehw Exp $
*/
class XPointerMessageFormatter implements MessageFormatter {
@@ -64,14 +66,14 @@ class XPointerMessageFormatter implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
- fResourceBundle = PropertyResourceBundle.getBundle(
+ fResourceBundle = SecuritySupport.getResourceBundle(
"com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
- fResourceBundle = PropertyResourceBundle
- .getBundle("com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages");
+ fResourceBundle = SecuritySupport.getResourceBundle(
+ "com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages");
}
String msg = fResourceBundle.getString(key);
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java b/jaxp/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java
index 0c5c0866dcb..711814e80e1 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java
@@ -27,6 +27,7 @@ import com.sun.org.apache.xml.internal.res.XMLMessages;
import com.sun.org.apache.xml.internal.utils.PrefixResolver;
import com.sun.org.apache.xml.internal.utils.XMLStringFactory;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
/**
* A DTMManager instance can be used to create DTM and
@@ -383,7 +384,7 @@ public abstract class DTMManager
{
try
{
- debug = System.getProperty("dtm.debug") != null;
+ debug = SecuritySupport.getSystemProperty("dtm.debug") != null;
}
catch (SecurityException ex){}
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources.java
index f3dc2eb27b1..8d1ab9b948d 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -453,67 +450,4 @@ public class XMLErrorResources extends ListResourceBundle
return contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ca.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ca.java
index f7cb448f07f..5dcb27c62c5 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ca.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ca.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -443,67 +440,4 @@ public class XMLErrorResources_ca extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("ca", "ES"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_cs.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_cs.java
index c0594bb5ec0..f3e3c3ec756 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_cs.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_cs.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -443,67 +440,4 @@ public class XMLErrorResources_cs extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("cs", "CZ"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_de.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_de.java
index a53064e4bb2..ac19d0dbdd9 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_de.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_de.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -453,67 +450,4 @@ public class XMLErrorResources_de extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java
index 43ddf652392..f35db360989 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -453,67 +450,4 @@ public class XMLErrorResources_es extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_fr.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_fr.java
index 7a617894d41..b5891d6cb7e 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_fr.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_fr.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -453,67 +450,4 @@ public class XMLErrorResources_fr extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_it.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_it.java
index 77179c4d3b8..c7d01ffc962 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_it.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_it.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -453,67 +450,4 @@ public class XMLErrorResources_it extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ja.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ja.java
index 1ce4af03e9c..b1a811fb9c9 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ja.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ja.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -453,67 +450,4 @@ public class XMLErrorResources_ja extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java
index 5d1343ecd5f..97215695644 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -453,67 +450,4 @@ public class XMLErrorResources_ko extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_pt_BR.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_pt_BR.java
index 8cf45bc8a60..593f8b8ff3f 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_pt_BR.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_pt_BR.java
@@ -25,9 +25,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -463,67 +460,4 @@ public class XMLErrorResources_pt_BR extends ListResourceBundle
return msgCopy;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sk.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sk.java
index cc86baa0492..1e4b293c59b 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sk.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sk.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -443,67 +440,4 @@ public class XMLErrorResources_sk extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sv.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sv.java
index 43c4778fb93..4fa6a340057 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sv.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sv.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -452,68 +449,4 @@ public class XMLErrorResources_sv extends ListResourceBundle
protected Object[][] getContents() {
return _contents;
}
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_tr.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_tr.java
index 47730b4910c..58973c6af99 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_tr.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_tr.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -443,67 +440,4 @@ public class XMLErrorResources_tr extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("tr", "TR"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_CN.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_CN.java
index 261509bbcee..aa861e25a97 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_CN.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_CN.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -453,67 +450,4 @@ public class XMLErrorResources_zh_CN extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_TW.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_TW.java
index f5fdad8b691..78df8fd081e 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_TW.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_TW.java
@@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -453,67 +450,4 @@ public class XMLErrorResources_zh_TW extends ListResourceBundle
return _contents;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XMLErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XMLErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XMLErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLMessages.java b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLMessages.java
index f1ac0e14a2b..bb2f9bb4062 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/res/XMLMessages.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/res/XMLMessages.java
@@ -22,10 +22,9 @@
*/
package com.sun.org.apache.xml.internal.res;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.util.ListResourceBundle;
import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* A utility class for issuing XML error messages.
@@ -82,8 +81,9 @@ public class XMLMessages
*/
public static final String createXMLMessage(String msgKey, Object args[])
{
- if (XMLBundle == null)
- XMLBundle = loadResourceBundle(XML_ERROR_RESOURCES);
+ if (XMLBundle == null) {
+ XMLBundle = SecuritySupport.getResourceBundle(XML_ERROR_RESOURCES);
+ }
if (XMLBundle != null)
{
@@ -156,61 +156,4 @@ public class XMLMessages
return fmsg;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className The class name of the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static ListResourceBundle loadResourceBundle(String className)
- throws MissingResourceException
- {
- Locale locale = Locale.getDefault();
-
- try
- {
- return (ListResourceBundle)ResourceBundle.getBundle(className, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (ListResourceBundle)ResourceBundle.getBundle(
- className, new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles." + className, className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which can be appended to a resource name
- */
- protected static String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/resolver/Catalog.java b/jaxp/src/com/sun/org/apache/xml/internal/resolver/Catalog.java
index 24a14b21f1d..a5c0e683825 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/resolver/Catalog.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/resolver/Catalog.java
@@ -24,6 +24,7 @@
package com.sun.org.apache.xml.internal.resolver;
import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.io.InputStream;
@@ -821,7 +822,7 @@ public class Catalog {
// tack on a basename because URLs point to files not dirs
catalogCwd = FileURL.makeURL("basename");
} catch (MalformedURLException e) {
- String userdir = System.getProperty("user.dir");
+ String userdir = SecuritySupport.getSystemProperty("user.dir");
userdir.replace('\\', '/');
catalogManager.debug.message(1, "Malformed URL on cwd", userdir);
catalogCwd = null;
@@ -1717,7 +1718,7 @@ public class Catalog {
protected String resolveLocalSystem(String systemId)
throws MalformedURLException, IOException {
- String osname = System.getProperty("os.name");
+ String osname = SecuritySupport.getSystemProperty("os.name");
boolean windows = (osname.indexOf("Windows") >= 0);
Enumeration en = catalogEntries.elements();
while (en.hasMoreElements()) {
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java b/jaxp/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java
index 166c0331a45..247bd40fdd0 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java
@@ -23,6 +23,7 @@
package com.sun.org.apache.xml.internal.resolver;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.io.InputStream;
import java.net.URL;
@@ -142,8 +143,8 @@ public class CatalogManager {
/** Flag to ignore missing property files and/or properties */
private boolean ignoreMissingProperties
- = (System.getProperty(pIgnoreMissing) != null
- || System.getProperty(pFiles) != null);
+ = (SecuritySupport.getSystemProperty(pIgnoreMissing) != null
+ || SecuritySupport.getSystemProperty(pFiles) != null);
/** Holds the resources after they are loaded from the file. */
private ResourceBundle resources;
@@ -338,7 +339,7 @@ public class CatalogManager {
private int queryVerbosity () {
String defaultVerbStr = Integer.toString(defaultVerbosity);
- String verbStr = System.getProperty(pVerbosity);
+ String verbStr = SecuritySupport.getSystemProperty(pVerbosity);
if (verbStr == null) {
if (resources==null) readProperties();
@@ -473,7 +474,7 @@ public class CatalogManager {
* @return A semicolon delimited list of catlog file URIs
*/
private String queryCatalogFiles () {
- String catalogList = System.getProperty(pFiles);
+ String catalogList = SecuritySupport.getSystemProperty(pFiles);
fromPropertiesFile = false;
if (catalogList == null) {
@@ -558,7 +559,7 @@ public class CatalogManager {
* defaultPreferSetting.
*/
private boolean queryPreferPublic () {
- String prefer = System.getProperty(pPrefer);
+ String prefer = SecuritySupport.getSystemProperty(pPrefer);
if (prefer == null) {
if (resources==null) readProperties();
@@ -617,7 +618,7 @@ public class CatalogManager {
* defaultUseStaticCatalog.
*/
private boolean queryUseStaticCatalog () {
- String staticCatalog = System.getProperty(pStatic);
+ String staticCatalog = SecuritySupport.getSystemProperty(pStatic);
if (staticCatalog == null) {
if (resources==null) readProperties();
@@ -748,7 +749,7 @@ public class CatalogManager {
* defaultOasisXMLCatalogPI.
*/
public boolean queryAllowOasisXMLCatalogPI () {
- String allow = System.getProperty(pAllowPI);
+ String allow = SecuritySupport.getSystemProperty(pAllowPI);
if (allow == null) {
if (resources==null) readProperties();
@@ -804,7 +805,7 @@ public class CatalogManager {
*
*/
public String queryCatalogClassName () {
- String className = System.getProperty(pClassname);
+ String className = SecuritySupport.getSystemProperty(pClassname);
if (className == null) {
if (resources==null) readProperties();
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/resolver/Resolver.java b/jaxp/src/com/sun/org/apache/xml/internal/resolver/Resolver.java
index 35a852fbf60..721d67c8d4e 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/resolver/Resolver.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/resolver/Resolver.java
@@ -33,6 +33,7 @@ import java.net.URLConnection;
import java.net.MalformedURLException;
import javax.xml.parsers.SAXParserFactory;
import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
@@ -524,7 +525,7 @@ public class Resolver extends Catalog {
*/
private Vector resolveAllLocalSystem(String systemId) {
Vector map = new Vector();
- String osname = System.getProperty("os.name");
+ String osname = SecuritySupport.getSystemProperty("os.name");
boolean windows = (osname.indexOf("Windows") >= 0);
Enumeration en = catalogEntries.elements();
while (en.hasMoreElements()) {
@@ -552,7 +553,7 @@ public class Resolver extends Catalog {
*/
private Vector resolveLocalSystemReverse(String systemId) {
Vector map = new Vector();
- String osname = System.getProperty("os.name");
+ String osname = SecuritySupport.getSystemProperty("os.name");
boolean windows = (osname.indexOf("Windows") >= 0);
Enumeration en = catalogEntries.elements();
while (en.hasMoreElements()) {
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java b/jaxp/src/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java
index 22bcad610cb..25da0c6517a 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java
@@ -22,6 +22,7 @@
package com.sun.org.apache.xml.internal.serialize;
import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.io.OutputStream;
import java.io.Writer;
import java.io.UnsupportedEncodingException;
@@ -64,7 +65,7 @@ public abstract class SerializerFactory
factory = new SerializerFactoryImpl( Method.TEXT );
registerSerializerFactory( factory );
- list = System.getProperty( FactoriesProperty );
+ list = SecuritySupport.getSystemProperty( FactoriesProperty );
if ( list != null ) {
token = new StringTokenizer( list, " ;,:" );
while ( token.hasMoreTokens() ) {
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java b/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java
index dcb6dc8e077..35845697a32 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java
@@ -219,7 +219,7 @@ public final class Encodings extends Object
// Get the default system character encoding. This may be
// incorrect if they passed in a writer, but right now there
// seems to be no way to get the encoding from a writer.
- encoding = System.getProperty("file.encoding", "UTF8");
+ encoding = SecuritySupport.getSystemProperty("file.encoding", "UTF8");
if (null != encoding)
{
@@ -313,7 +313,7 @@ public final class Encodings extends Object
try
{
- urlString = System.getProperty(ENCODINGS_PROP, "");
+ urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
}
catch (SecurityException e)
{
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java b/jaxp/src/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java
index 3daff744064..0d91b7aeb3c 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java
@@ -22,6 +22,7 @@
*/
package com.sun.org.apache.xml.internal.serializer;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -471,7 +472,7 @@ public final class OutputPropertiesFactory
String value = null;
try
{
- value = System.getProperty(key);
+ value = SecuritySupport.getSystemProperty(key);
}
catch (SecurityException se)
{
@@ -484,7 +485,7 @@ public final class OutputPropertiesFactory
String newValue = null;
try
{
- newValue = System.getProperty(newKey);
+ newValue = SecuritySupport.getSystemProperty(newKey);
}
catch (SecurityException se)
{
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToStream.java b/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToStream.java
index 8c4c2ec8892..2301763c07c 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToStream.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToStream.java
@@ -22,6 +22,7 @@
*/
package com.sun.org.apache.xml.internal.serializer;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
@@ -140,7 +141,7 @@ abstract public class ToStream extends SerializerBase
* extension attribute xalan:line-separator.
*/
protected char[] m_lineSep =
- System.getProperty("line.separator").toCharArray();
+ SecuritySupport.getSystemProperty("line.separator").toCharArray();
/**
* True if the the system line separator is to be used.
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java b/jaxp/src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java
index d77f48d520f..007e9c7b3d4 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java
@@ -22,6 +22,7 @@
*/
package com.sun.org.apache.xml.internal.serializer;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.File;
import com.sun.org.apache.xml.internal.serializer.utils.AttList;
@@ -104,7 +105,7 @@ public final class TreeWalker
else {
try {
// Bug see Bugzilla 26741
- m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
+ m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl");
}
catch (SecurityException se) {// user.dir not accessible from applet
}
@@ -115,7 +116,7 @@ public final class TreeWalker
m_contentHandler.setDocumentLocator(m_locator);
try {
// Bug see Bugzilla 26741
- m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
+ m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl");
}
catch (SecurityException se){// user.dir not accessible from applet
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/Messages.java b/jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/Messages.java
index 32393082107..84f4c9840bb 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/Messages.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/Messages.java
@@ -22,6 +22,7 @@
*/
package com.sun.org.apache.xml.internal.serializer.utils;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
@@ -87,9 +88,6 @@ import java.util.ResourceBundle;
* can have the Message strings translated in an alternate language
* in a errorResourceClass with a language suffix.
*
- * More sophisticated use of this class would be to pass null
- * when contructing it, but then call loadResourceBundle()
- * before creating any messages.
*
* This class is not a public API, it is only public because it is
* used in com.sun.org.apache.xml.internal.serializer.
@@ -126,18 +124,6 @@ public final class Messages
m_resourceBundleName = resourceBundle;
}
- /*
- * Set the Locale object to use. If this method is not called the
- * default locale is used. This method needs to be called before
- * loadResourceBundle().
- *
- * @param locale non-null reference to Locale object.
- * @xsl.usage internal
- */
-// public void setLocale(Locale locale)
-// {
-// m_locale = locale;
-// }
/**
* Get the Locale object that is being used.
@@ -150,16 +136,6 @@ public final class Messages
return m_locale;
}
- /**
- * Get the ListResourceBundle being used by this Messages instance which was
- * previously set by a call to loadResourceBundle(className)
- * @xsl.usage internal
- */
- private ListResourceBundle getResourceBundle()
- {
- return m_resourceBundle;
- }
-
/**
* Creates a message from the specified key and replacement
* arguments, localized to the given locale.
@@ -174,7 +150,7 @@ public final class Messages
public final String createMessage(String msgKey, Object args[])
{
if (m_resourceBundle == null)
- m_resourceBundle = loadResourceBundle(m_resourceBundleName);
+ m_resourceBundle = SecuritySupport.getResourceBundle(m_resourceBundleName);
if (m_resourceBundle != null)
{
@@ -293,76 +269,4 @@ public final class Messages
return fmsg;
}
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements ListResourceBundle,
- * without language suffix.
- * @return the ResourceBundle
- * @throws MissingResourceException
- * @xsl.usage internal
- */
- private ListResourceBundle loadResourceBundle(String resourceBundle)
- throws MissingResourceException
- {
- m_resourceBundleName = resourceBundle;
- Locale locale = getLocale();
-
- ListResourceBundle lrb;
-
- try
- {
-
- ResourceBundle rb =
- ResourceBundle.getBundle(m_resourceBundleName, locale);
- lrb = (ListResourceBundle) rb;
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- lrb =
- (ListResourceBundle) ResourceBundle.getBundle(
- m_resourceBundleName,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles." + m_resourceBundleName,
- m_resourceBundleName,
- "");
- }
- }
- m_resourceBundle = lrb;
- return lrb;
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which can be appended to a resource name
- * @xsl.usage internal
- */
- private static String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
}
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/utils/TreeWalker.java b/jaxp/src/com/sun/org/apache/xml/internal/utils/TreeWalker.java
index a26a00684ba..f7a3ddf65b8 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/utils/TreeWalker.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/utils/TreeWalker.java
@@ -22,6 +22,7 @@
*/
package com.sun.org.apache.xml.internal.utils;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.File;
import org.w3c.dom.Comment;
@@ -93,7 +94,7 @@ public class TreeWalker
else {
try {
// Bug see Bugzilla 26741
- m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
+ m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl");
}
catch (SecurityException se) {// user.dir not accessible from applet
}
@@ -112,7 +113,7 @@ public class TreeWalker
m_contentHandler.setDocumentLocator(m_locator);
try {
// Bug see Bugzilla 26741
- m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
+ m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl");
}
catch (SecurityException se){// user.dir not accessible from applet
}
@@ -131,7 +132,7 @@ public class TreeWalker
m_contentHandler.setDocumentLocator(m_locator);
try {
// Bug see Bugzilla 26741
- m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
+ m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl");
}
catch (SecurityException se){// user.dir not accessible from applet
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java b/jaxp/src/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java
index b2beed7262f..708fbb47400 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java
@@ -22,6 +22,8 @@
*/
package com.sun.org.apache.xml.internal.utils.res;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
@@ -29,114 +31,45 @@ import java.util.ResourceBundle;
/**
* The default (english) resource bundle.
+ *
* @xsl.usage internal
*/
-public class XResourceBundle extends ListResourceBundle
-{
+public class XResourceBundle extends ListResourceBundle {
- /** Error resource constants */
- public static final String ERROR_RESOURCES =
- "com.sun.org.apache.xalan.internal.res.XSLTErrorResources", XSLT_RESOURCE =
- "com.sun.org.apache.xml.internal.utils.res.XResourceBundle", LANG_BUNDLE_NAME =
- "com.sun.org.apache.xml.internal.utils.res.XResources", MULT_ORDER =
- "multiplierOrder", MULT_PRECEDES = "precedes", MULT_FOLLOWS =
- "follows", LANG_ORIENTATION = "orientation", LANG_RIGHTTOLEFT =
- "rightToLeft", LANG_LEFTTORIGHT = "leftToRight", LANG_NUMBERING =
- "numbering", LANG_ADDITIVE = "additive", LANG_MULT_ADD =
- "multiplicative-additive", LANG_MULTIPLIER =
- "multiplier", LANG_MULTIPLIER_CHAR =
- "multiplierChar", LANG_NUMBERGROUPS = "numberGroups", LANG_NUM_TABLES =
- "tables", LANG_ALPHABET = "alphabet", LANG_TRAD_ALPHABET = "tradAlphabet";
+ /**
+ * Error resource constants
+ */
+ public static final String ERROR_RESOURCES =
+ "com.sun.org.apache.xalan.internal.res.XSLTErrorResources", XSLT_RESOURCE =
+ "com.sun.org.apache.xml.internal.utils.res.XResourceBundle", LANG_BUNDLE_NAME =
+ "com.sun.org.apache.xml.internal.utils.res.XResources", MULT_ORDER =
+ "multiplierOrder", MULT_PRECEDES = "precedes", MULT_FOLLOWS =
+ "follows", LANG_ORIENTATION = "orientation", LANG_RIGHTTOLEFT =
+ "rightToLeft", LANG_LEFTTORIGHT = "leftToRight", LANG_NUMBERING =
+ "numbering", LANG_ADDITIVE = "additive", LANG_MULT_ADD =
+ "multiplicative-additive", LANG_MULTIPLIER =
+ "multiplier", LANG_MULTIPLIER_CHAR =
+ "multiplierChar", LANG_NUMBERGROUPS = "numberGroups", LANG_NUM_TABLES =
+ "tables", LANG_ALPHABET = "alphabet", LANG_TRAD_ALPHABET = "tradAlphabet";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @param locale the locale to prefer when searching for the bundle
- */
- public static final XResourceBundle loadResourceBundle(
- String className, Locale locale) throws MissingResourceException
- {
- String suffix = getResourceSuffix(locale);
-
- //System.out.println("resource " + className + suffix);
- try
- {
-
- // first try with the given locale
- String resourceName = className + suffix;
- return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale);
+ /**
+ * Get the association list.
+ *
+ * @return The association list.
+ */
+ public Object[][] getContents() {
+ return new Object[][]{
+ {"ui_language", "en"}, {"help_language", "en"}, {"language", "en"},
+ {"alphabet", new CharArrayWrapper(new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G',
+ 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
+ 'V', 'W', 'X', 'Y', 'Z'})},
+ {"tradAlphabet", new CharArrayWrapper(new char[]{'A', 'B', 'C', 'D', 'E', 'F',
+ 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
+ 'U', 'V', 'W', 'X', 'Y', 'Z'})},
+ //language orientation
+ {"orientation", "LeftToRight"},
+ //language numbering
+ {"numbering", "additive"},};
}
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XResourceBundle) ResourceBundle.getBundle(
- XSLT_RESOURCE, new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String lang = locale.getLanguage();
- String country = locale.getCountry();
- String variant = locale.getVariant();
- String suffix = "_" + locale.getLanguage();
-
- if (lang.equals("zh"))
- suffix += "_" + country;
-
- if (country.equals("JP"))
- suffix += "_" + country + "_" + variant;
-
- return suffix;
- }
-
- /**
- * Get the association list.
- *
- * @return The association list.
- */
- public Object[][] getContents()
- {
- return new Object[][]
- {
- { "ui_language", "en" }, { "help_language", "en" }, { "language", "en" },
- { "alphabet", new CharArrayWrapper(new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G',
- 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
- 'V', 'W', 'X', 'Y', 'Z' })},
- { "tradAlphabet", new CharArrayWrapper(new char[]{ 'A', 'B', 'C', 'D', 'E', 'F',
- 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
- 'U', 'V', 'W', 'X', 'Y', 'Z' }) },
-
- //language orientation
- { "orientation", "LeftToRight" },
-
- //language numbering
- { "numbering", "additive" },
- };
- }
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java b/jaxp/src/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java
index 1fbcc878c6a..4f9a9684960 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java
@@ -102,7 +102,7 @@ public class FuncSystemProperty extends FunctionOneArg
try
{
- result = System.getProperty(propName);
+ result = SecuritySupport.getSystemProperty(propName);
if (null == result)
{
@@ -124,7 +124,7 @@ public class FuncSystemProperty extends FunctionOneArg
{
try
{
- result = System.getProperty(fullName);
+ result = SecuritySupport.getSystemProperty(fullName);
if (null == result)
{
@@ -165,12 +165,11 @@ public class FuncSystemProperty extends FunctionOneArg
* should already be fully qualified as path/filename
* @param target The target property bag the file will be placed into.
*/
- private void loadPropertyFile(String file, Properties target)
+ public void loadPropertyFile(String file, Properties target)
{
try
{
// Use SecuritySupport class to provide priveleged access to property file
-
InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
file);
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java
index 1bacf25d242..68b4853f3d9 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java
@@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN ";
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XPATHErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XPATHErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XPATHErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java
index db0051dce36..2b1389ac5ef 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java
@@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN ";
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XPATHErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XPATHErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XPATHErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java
index 6200908cb08..034531e1242 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java
@@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN ";
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XPATHErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XPATHErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XPATHErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java
index 41be11f7b56..3526941fdae 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java
@@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN ";
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XPATHErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XPATHErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XPATHErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java
index 356bffc64ff..0000b182da8 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java
@@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN ";
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XPATHErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XPATHErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XPATHErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java
index 5427da5219f..256b88c190d 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java
@@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN ";
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XPATHErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XPATHErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XPATHErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java
index de70b6a2fc5..6e1f37e8e80 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java
@@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN ";
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XPATHErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XPATHErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XPATHErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_pt_BR.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_pt_BR.java
index 54bb5387e2d..85504928969 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_pt_BR.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_pt_BR.java
@@ -24,9 +24,6 @@
package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -940,68 +937,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN ";
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XPATHErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XPATHErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XPATHErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java
index 6afe36fe42b..f9152568fa1 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java
@@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN ";
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XPATHErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XPATHErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XPATHErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java
index f781e6ba411..2618e5991eb 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java
@@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN ";
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XPATHErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XPATHErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XPATHErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java
index dfafed8d09e..8fdd1e50ca8 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java
@@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN ";
-
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className Name of local-specific subclass.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XPATHErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
-
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
-
- try
- {
-
- // first try with the given locale
- return (XPATHErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
-
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XPATHErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
-
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
-
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
-
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
-
- if (country.equals("TW"))
- suffix += "_" + country;
-
- return suffix;
- }
-
}
diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHMessages.java b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHMessages.java
index 3bcf1da48f2..1d0fe6ff49c 100644
--- a/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHMessages.java
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHMessages.java
@@ -22,130 +22,128 @@
*/
package com.sun.org.apache.xpath.internal.res;
-import java.util.ListResourceBundle;
-
+import com.sun.org.apache.bcel.internal.util.SecuritySupport;
import com.sun.org.apache.xml.internal.res.XMLMessages;
+import java.util.ListResourceBundle;
/**
* A utility class for issuing XPath error messages.
+ *
* @xsl.usage internal
*/
-public class XPATHMessages extends XMLMessages
-{
- /** The language specific resource object for XPath messages. */
- private static ListResourceBundle XPATHBundle = null;
+public class XPATHMessages extends XMLMessages {
- /** The class name of the XPath error message string table. */
- private static final String XPATH_ERROR_RESOURCES =
- "com.sun.org.apache.xpath.internal.res.XPATHErrorResources";
+ /**
+ * The language specific resource object for XPath messages.
+ */
+ private static ListResourceBundle XPATHBundle = null;
+ /**
+ * The class name of the XPath error message string table.
+ */
+ private static final String XPATH_ERROR_RESOURCES =
+ "com.sun.org.apache.xpath.internal.res.XPATHErrorResources";
- /**
- * Creates a message from the specified key and replacement
- * arguments, localized to the given locale.
- *
- * @param msgKey The key for the message text.
- * @param args The arguments to be used as replacement text
- * in the message created.
- *
- * @return The formatted message string.
- */
- public static final String createXPATHMessage(String msgKey, Object args[]) //throws Exception
- {
- if (XPATHBundle == null)
- XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES);
-
- if (XPATHBundle != null)
+ /**
+ * Creates a message from the specified key and replacement arguments,
+ * localized to the given locale.
+ *
+ * @param msgKey The key for the message text.
+ * @param args The arguments to be used as replacement text in the message
+ * created.
+ *
+ * @return The formatted message string.
+ */
+ public static final String createXPATHMessage(String msgKey, Object args[]) //throws Exception
{
- return createXPATHMsg(XPATHBundle, msgKey, args);
- }
- else
- return "Could not load any resource bundles.";
- }
-
- /**
- * Creates a message from the specified key and replacement
- * arguments, localized to the given locale.
- *
- * @param msgKey The key for the message text.
- * @param args The arguments to be used as replacement text
- * in the message created.
- *
- * @return The formatted warning string.
- */
- public static final String createXPATHWarning(String msgKey, Object args[]) //throws Exception
- {
- if (XPATHBundle == null)
- XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES);
-
- if (XPATHBundle != null)
- {
- return createXPATHMsg(XPATHBundle, msgKey, args);
- }
- else
- return "Could not load any resource bundles.";
- }
-
- /**
- * Creates a message from the specified key and replacement
- * arguments, localized to the given locale.
- *
- * @param fResourceBundle The resource bundle to use.
- * @param msgKey The message key to use.
- * @param args The arguments to be used as replacement text
- * in the message created.
- *
- * @return The formatted message string.
- */
- public static final String createXPATHMsg(ListResourceBundle fResourceBundle,
- String msgKey, Object args[]) //throws Exception
- {
-
- String fmsg = null;
- boolean throwex = false;
- String msg = null;
-
- if (msgKey != null)
- msg = fResourceBundle.getString(msgKey);
-
- if (msg == null)
- {
- msg = fResourceBundle.getString(XPATHErrorResources.BAD_CODE);
- throwex = true;
- }
-
- if (args != null)
- {
- try
- {
-
- // Do this to keep format from crying.
- // This is better than making a bunch of conditional
- // code all over the place.
- int n = args.length;
-
- for (int i = 0; i < n; i++)
- {
- if (null == args[i])
- args[i] = "";
+ if (XPATHBundle == null) {
+ XPATHBundle = SecuritySupport.getResourceBundle(XPATH_ERROR_RESOURCES);
}
- fmsg = java.text.MessageFormat.format(msg, args);
- }
- catch (Exception e)
- {
- fmsg = fResourceBundle.getString(XPATHErrorResources.FORMAT_FAILED);
- fmsg += " " + msg;
- }
+ if (XPATHBundle != null) {
+ return createXPATHMsg(XPATHBundle, msgKey, args);
+ } else {
+ return "Could not load any resource bundles.";
+ }
}
- else
- fmsg = msg;
- if (throwex)
+ /**
+ * Creates a message from the specified key and replacement arguments,
+ * localized to the given locale.
+ *
+ * @param msgKey The key for the message text.
+ * @param args The arguments to be used as replacement text in the message
+ * created.
+ *
+ * @return The formatted warning string.
+ */
+ public static final String createXPATHWarning(String msgKey, Object args[]) //throws Exception
{
- throw new RuntimeException(fmsg);
+ if (XPATHBundle == null) {
+ XPATHBundle = SecuritySupport.getResourceBundle(XPATH_ERROR_RESOURCES);
+ }
+
+ if (XPATHBundle != null) {
+ return createXPATHMsg(XPATHBundle, msgKey, args);
+ } else {
+ return "Could not load any resource bundles.";
+ }
}
- return fmsg;
- }
+ /**
+ * Creates a message from the specified key and replacement arguments,
+ * localized to the given locale.
+ *
+ * @param fResourceBundle The resource bundle to use.
+ * @param msgKey The message key to use.
+ * @param args The arguments to be used as replacement text in the message
+ * created.
+ *
+ * @return The formatted message string.
+ */
+ public static final String createXPATHMsg(ListResourceBundle fResourceBundle,
+ String msgKey, Object args[]) //throws Exception
+ {
+ String fmsg = null;
+ boolean throwex = false;
+ String msg = null;
+
+ if (msgKey != null) {
+ msg = fResourceBundle.getString(msgKey);
+ }
+
+ if (msg == null) {
+ msg = fResourceBundle.getString(XPATHErrorResources.BAD_CODE);
+ throwex = true;
+ }
+
+ if (args != null) {
+ try {
+
+ // Do this to keep format from crying.
+ // This is better than making a bunch of conditional
+ // code all over the place.
+ int n = args.length;
+
+ for (int i = 0; i < n; i++) {
+ if (null == args[i]) {
+ args[i] = "";
+ }
+ }
+
+ fmsg = java.text.MessageFormat.format(msg, args);
+ } catch (Exception e) {
+ fmsg = fResourceBundle.getString(XPATHErrorResources.FORMAT_FAILED);
+ fmsg += " " + msg;
+ }
+ } else {
+ fmsg = msg;
+ }
+
+ if (throwex) {
+ throw new RuntimeException(fmsg);
+ }
+
+ return fmsg;
+ }
}
diff --git a/jaxp/src/com/sun/xml/internal/stream/XMLEntityStorage.java b/jaxp/src/com/sun/xml/internal/stream/XMLEntityStorage.java
index 8343d9bba85..2a8183bbe8c 100644
--- a/jaxp/src/com/sun/xml/internal/stream/XMLEntityStorage.java
+++ b/jaxp/src/com/sun/xml/internal/stream/XMLEntityStorage.java
@@ -36,6 +36,7 @@ import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
import com.sun.org.apache.xerces.internal.impl.PropertyManager;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.impl.Constants;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Enumeration;
/**
@@ -414,7 +415,7 @@ public class XMLEntityStorage {
// get the user.dir property
String userDir = "";
try {
- userDir = System.getProperty("user.dir");
+ userDir = SecuritySupport.getSystemProperty("user.dir");
}
catch (SecurityException se) {
}
diff --git a/jaxp/src/com/sun/xml/internal/stream/writers/WriterUtility.java b/jaxp/src/com/sun/xml/internal/stream/writers/WriterUtility.java
index e266c9e3b40..6ec4201996b 100644
--- a/jaxp/src/com/sun/xml/internal/stream/writers/WriterUtility.java
+++ b/jaxp/src/com/sun/xml/internal/stream/writers/WriterUtility.java
@@ -32,6 +32,7 @@ import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import com.sun.org.apache.xerces.internal.util.XMLChar;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
/**
* Implements common xml writer functions.
@@ -240,7 +241,7 @@ public class WriterUtility {
private CharsetEncoder getDefaultEncoder(){
try{
- String encoding = System.getProperty("file.encoding");
+ String encoding = SecuritySupport.getSystemProperty("file.encoding");
if(encoding != null){
return Charset.forName(encoding).newEncoder();
}
diff --git a/jaxp/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java b/jaxp/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java
index 30bee23582c..832fa6ddfbb 100644
--- a/jaxp/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java
+++ b/jaxp/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java
@@ -53,6 +53,7 @@ import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.PropertyManager;
import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.xml.internal.stream.util.ReadOnlyIterator;
@@ -340,7 +341,7 @@ public final class XMLStreamWriterImpl extends AbstractMap implements XMLStreamW
fEncoder = Charset.forName(encoding).newEncoder();
}
} else {
- encoding = System.getProperty("file.encoding");
+ encoding = SecuritySupport.getSystemProperty("file.encoding");
if (encoding != null && encoding.equalsIgnoreCase("utf-8")) {
fWriter = new UTF8OutputStreamWriter(os);
} else {
diff --git a/jaxp/src/javax/xml/datatype/FactoryFinder.java b/jaxp/src/javax/xml/datatype/FactoryFinder.java
index 37811e6fad9..deb47eaa11c 100644
--- a/jaxp/src/javax/xml/datatype/FactoryFinder.java
+++ b/jaxp/src/javax/xml/datatype/FactoryFinder.java
@@ -44,6 +44,7 @@ import java.net.URL;
* @author Santiago.PericasGeertsen@sun.com
*/
class FactoryFinder {
+ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
/**
* Internal debug flag.
@@ -95,18 +96,24 @@ class FactoryFinder {
* If the class loader supplied is null, first try using the
* context class loader followed by the current (i.e. bootstrap) class
* loader.
+ *
+ * Use bootstrap classLoader if cl = null and useBSClsLoader is true
*/
static private Class getProviderClass(String className, ClassLoader cl,
- boolean doFallback) throws ClassNotFoundException
+ boolean doFallback, boolean useBSClsLoader) throws ClassNotFoundException
{
try {
if (cl == null) {
- cl = ss.getContextClassLoader();
- if (cl == null) {
- throw new ClassNotFoundException();
- }
- else {
- return cl.loadClass(className);
+ if (useBSClsLoader) {
+ return Class.forName(className, true, FactoryFinder.class.getClassLoader());
+ } else {
+ cl = ss.getContextClassLoader();
+ if (cl == null) {
+ throw new ClassNotFoundException();
+ }
+ else {
+ return cl.loadClass(className);
+ }
}
}
else {
@@ -131,8 +138,8 @@ class FactoryFinder {
* @param className Name of the concrete class corresponding to the
* service provider
*
- * @param cl ClassLoader to use to load the class, null means to use
- * the bootstrap ClassLoader
+ * @param cl ClassLoader used to load the factory class. If null
+ * current Thread's context classLoader is used to load the factory class.
*
* @param doFallback True if the current ClassLoader should be tried as
* a fallback if the class is not found using cl
@@ -140,8 +147,38 @@ class FactoryFinder {
static Object newInstance(String className, ClassLoader cl, boolean doFallback)
throws ConfigurationError
{
+ return newInstance(className, cl, doFallback, false);
+ }
+
+ /**
+ * Create an instance of a class. Delegates to method
+ * getProviderClass() in order to load the class.
+ *
+ * @param className Name of the concrete class corresponding to the
+ * service provider
+ *
+ * @param cl ClassLoader to use to load the class, null means to use
+ * the bootstrap ClassLoader
+ *
+ * @param doFallback True if the current ClassLoader should be tried as
+ * a fallback if the class is not found using cl
+ *
+ * @param useBSClsLoader True if cl=null actually meant bootstrap classLoader. This parameter
+ * is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader.
+ */
+ static Object newInstance(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader)
+ throws ConfigurationError
+ {
+ // make sure we have access to restricted packages
+ if (System.getSecurityManager() != null) {
+ if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
+ cl = null;
+ useBSClsLoader = true;
+ }
+ }
+
try {
- Class providerClass = getProviderClass(className, cl, doFallback);
+ Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader);
Object instance = providerClass.newInstance();
if (debug) { // Extra check to avoid computing cl strings
dPrint("created new instance of " + providerClass +
@@ -244,6 +281,7 @@ class FactoryFinder {
// First try the Context ClassLoader
ClassLoader cl = ss.getContextClassLoader();
+ boolean useBSClsLoader = false;
if (cl != null) {
is = ss.getResourceAsStream(cl, serviceId);
@@ -251,11 +289,13 @@ class FactoryFinder {
if (is == null) {
cl = FactoryFinder.class.getClassLoader();
is = ss.getResourceAsStream(cl, serviceId);
+ useBSClsLoader = true;
}
} else {
// No Context ClassLoader, try the current ClassLoader
cl = FactoryFinder.class.getClassLoader();
is = ss.getResourceAsStream(cl, serviceId);
+ useBSClsLoader = true;
}
if (is == null) {
@@ -293,7 +333,7 @@ class FactoryFinder {
// ClassLoader because we want to avoid the case where the
// resource file was found using one ClassLoader and the
// provider class was instantiated using a different one.
- return newInstance(factoryClassName, cl, false);
+ return newInstance(factoryClassName, cl, false, useBSClsLoader);
}
// No provider found
diff --git a/jaxp/src/javax/xml/parsers/FactoryFinder.java b/jaxp/src/javax/xml/parsers/FactoryFinder.java
index 43a6e020ac7..214f87f2239 100644
--- a/jaxp/src/javax/xml/parsers/FactoryFinder.java
+++ b/jaxp/src/javax/xml/parsers/FactoryFinder.java
@@ -42,7 +42,7 @@ import java.util.Properties;
* @author Huizhe.Wang@oracle.com
*/
class FactoryFinder {
-
+ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
/**
* Internal debug flag.
*/
@@ -166,6 +166,14 @@ class FactoryFinder {
static Object newInstance(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader)
throws ConfigurationError
{
+ // make sure we have access to restricted packages
+ if (System.getSecurityManager() != null) {
+ if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
+ cl = null;
+ useBSClsLoader = true;
+ }
+ }
+
try {
Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader);
Object instance = providerClass.newInstance();
diff --git a/jaxp/src/javax/xml/stream/FactoryFinder.java b/jaxp/src/javax/xml/stream/FactoryFinder.java
index a2491ac8c59..bcfeba10e04 100644
--- a/jaxp/src/javax/xml/stream/FactoryFinder.java
+++ b/jaxp/src/javax/xml/stream/FactoryFinder.java
@@ -25,14 +25,12 @@
package javax.xml.stream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.File;
-import java.io.FileInputStream;
-
-import java.util.Properties;
import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
+import java.util.Properties;
/**
*
Implements pluggable Datatypes.
@@ -43,6 +41,8 @@ import java.io.InputStreamReader;
* @author Santiago.PericasGeertsen@sun.com
*/
class FactoryFinder {
+ // Check we have access to package.
+ private static final String DEFAULT_PACKAGE = "com.sun.xml.internal.";
/**
* Internal debug flag.
@@ -94,18 +94,24 @@ class FactoryFinder {
* If the class loader supplied is null, first try using the
* context class loader followed by the current (i.e. bootstrap) class
* loader.
+ *
+ * Use bootstrap classLoader if cl = null and useBSClsLoader is true
*/
static private Class getProviderClass(String className, ClassLoader cl,
- boolean doFallback) throws ClassNotFoundException
+ boolean doFallback, boolean useBSClsLoader) throws ClassNotFoundException
{
try {
if (cl == null) {
- cl = ss.getContextClassLoader();
- if (cl == null) {
- throw new ClassNotFoundException();
- }
- else {
- return cl.loadClass(className);
+ if (useBSClsLoader) {
+ return Class.forName(className, true, FactoryFinder.class.getClassLoader());
+ } else {
+ cl = ss.getContextClassLoader();
+ if (cl == null) {
+ throw new ClassNotFoundException();
+ }
+ else {
+ return cl.loadClass(className);
+ }
}
}
else {
@@ -130,8 +136,8 @@ class FactoryFinder {
* @param className Name of the concrete class corresponding to the
* service provider
*
- * @param cl ClassLoader to use to load the class, null means to use
- * the bootstrap ClassLoader
+ * @param cl ClassLoader used to load the factory class. If null
+ * current Thread's context classLoader is used to load the factory class.
*
* @param doFallback True if the current ClassLoader should be tried as
* a fallback if the class is not found using cl
@@ -139,8 +145,38 @@ class FactoryFinder {
static Object newInstance(String className, ClassLoader cl, boolean doFallback)
throws ConfigurationError
{
+ return newInstance(className, cl, doFallback, false);
+ }
+
+ /**
+ * Create an instance of a class. Delegates to method
+ * getProviderClass() in order to load the class.
+ *
+ * @param className Name of the concrete class corresponding to the
+ * service provider
+ *
+ * @param cl ClassLoader used to load the factory class. If null
+ * current Thread's context classLoader is used to load the factory class.
+ *
+ * @param doFallback True if the current ClassLoader should be tried as
+ * a fallback if the class is not found using cl
+ *
+ * @param useBSClsLoader True if cl=null actually meant bootstrap classLoader. This parameter
+ * is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader.
+ */
+ static Object newInstance(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader)
+ throws ConfigurationError
+ {
+ // make sure we have access to restricted packages
+ if (System.getSecurityManager() != null) {
+ if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
+ cl = null;
+ useBSClsLoader = true;
+ }
+ }
+
try {
- Class providerClass = getProviderClass(className, cl, doFallback);
+ Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader);
Object instance = providerClass.newInstance();
if (debug) { // Extra check to avoid computing cl strings
dPrint("created new instance of " + providerClass +
@@ -233,10 +269,10 @@ class FactoryFinder {
if (ss.doesFileExist(f)) {
dPrint("Read properties file "+f);
cacheProps.load(ss.getFileInputStream(f));
- }
- }
}
}
+ }
+ }
}
factoryClassName = cacheProps.getProperty(factoryId);
@@ -276,6 +312,7 @@ class FactoryFinder {
// First try the Context ClassLoader
ClassLoader cl = ss.getContextClassLoader();
+ boolean useBSClsLoader = false;
if (cl != null) {
is = ss.getResourceAsStream(cl, serviceId);
@@ -283,11 +320,13 @@ class FactoryFinder {
if (is == null) {
cl = FactoryFinder.class.getClassLoader();
is = ss.getResourceAsStream(cl, serviceId);
+ useBSClsLoader = true;
}
} else {
// No Context ClassLoader, try the current ClassLoader
cl = FactoryFinder.class.getClassLoader();
is = ss.getResourceAsStream(cl, serviceId);
+ useBSClsLoader = true;
}
if (is == null) {
@@ -325,7 +364,7 @@ class FactoryFinder {
// ClassLoader because we want to avoid the case where the
// resource file was found using one ClassLoader and the
// provider class was instantiated using a different one.
- return newInstance(factoryClassName, cl, false);
+ return newInstance(factoryClassName, cl, false, useBSClsLoader);
}
// No provider found
diff --git a/jaxp/src/javax/xml/transform/FactoryFinder.java b/jaxp/src/javax/xml/transform/FactoryFinder.java
index 9ded4fb61e4..63cc8cd3f22 100644
--- a/jaxp/src/javax/xml/transform/FactoryFinder.java
+++ b/jaxp/src/javax/xml/transform/FactoryFinder.java
@@ -43,6 +43,7 @@ import java.util.Properties;
* @author Huizhe.Wang@oracle.com
*/
class FactoryFinder {
+ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xalan.internal.";
/**
* Internal debug flag.
@@ -169,6 +170,14 @@ class FactoryFinder {
static Object newInstance(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader, boolean useServicesMechanism)
throws ConfigurationError
{
+ // make sure we have access to restricted packages
+ if (System.getSecurityManager() != null) {
+ if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
+ cl = null;
+ useBSClsLoader = true;
+ }
+ }
+
try {
Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader);
Object instance = null;
diff --git a/jaxp/src/javax/xml/validation/SchemaFactoryFinder.java b/jaxp/src/javax/xml/validation/SchemaFactoryFinder.java
index abd0a7ca0af..6ae593a105c 100644
--- a/jaxp/src/javax/xml/validation/SchemaFactoryFinder.java
+++ b/jaxp/src/javax/xml/validation/SchemaFactoryFinder.java
@@ -54,6 +54,7 @@ class SchemaFactoryFinder {
*
Take care of restrictions imposed by java security model
*/
private static SecuritySupport ss = new SecuritySupport();
+ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
/**
*
Cache properties for performance.
*/
@@ -213,28 +214,6 @@ class SchemaFactoryFinder {
}
}
- /**
- // try to read from $java.home/lib/jaxp.properties
- try {
- String javah = ss.getSystemProperty( "java.home" );
- String configFile = javah + File.separator +
- "lib" + File.separator + "jaxp.properties";
- File f = new File( configFile );
- if( ss.doesFileExist(f)) {
- sf = loadFromProperty(
- propertyName,f.getAbsolutePath(), new FileInputStream(f));
- if(sf!=null) return sf;
- } else {
- debugPrintln("Tried to read "+ f.getAbsolutePath()+", but it doesn't exist.");
- }
- } catch(Throwable e) {
- if( debug ) {
- debugPrintln("failed to read $java.home/lib/jaxp.properties");
- e.printStackTrace();
- }
- }
- */
-
// try META-INF/services files
Iterator sitr = createServiceFileIterator();
while(sitr.hasNext()) {
@@ -269,14 +248,20 @@ class SchemaFactoryFinder {
*/
private Class createClass(String className) {
Class clazz;
+ // make sure we have access to restricted packages
+ boolean internal = false;
+ if (System.getSecurityManager() != null) {
+ if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
+ internal = true;
+ }
+ }
- // use approprite ClassLoader
try {
- if (classLoader != null) {
- clazz = classLoader.loadClass(className);
- } else {
- clazz = Class.forName(className);
- }
+ if (classLoader != null && !internal) {
+ clazz = classLoader.loadClass(className);
+ } else {
+ clazz = Class.forName(className);
+ }
} catch (Throwable t) {
if(debug) t.printStackTrace();
return null;
diff --git a/jaxp/src/javax/xml/xpath/XPathFactoryFinder.java b/jaxp/src/javax/xml/xpath/XPathFactoryFinder.java
index b22120da26a..797b9556a0a 100644
--- a/jaxp/src/javax/xml/xpath/XPathFactoryFinder.java
+++ b/jaxp/src/javax/xml/xpath/XPathFactoryFinder.java
@@ -48,6 +48,7 @@ import java.util.Properties;
* @since 1.5
*/
class XPathFactoryFinder {
+ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xpath.internal";
private static SecuritySupport ss = new SecuritySupport() ;
/** debug support code. */
@@ -246,18 +247,25 @@ class XPathFactoryFinder {
*/
private Class createClass(String className) {
Class clazz;
-
- // use approprite ClassLoader
- try {
- if (classLoader != null) {
- clazz = classLoader.loadClass(className);
- } else {
- clazz = Class.forName(className);
- }
- } catch (Throwable t) {
- if(debug) t.printStackTrace();
- return null;
+ // make sure we have access to restricted packages
+ boolean internal = false;
+ if (System.getSecurityManager() != null) {
+ if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
+ internal = true;
}
+ }
+
+ // use approprite ClassLoader
+ try {
+ if (classLoader != null && !internal) {
+ clazz = classLoader.loadClass(className);
+ } else {
+ clazz = Class.forName(className);
+ }
+ } catch (Throwable t) {
+ if(debug) t.printStackTrace();
+ return null;
+ }
return clazz;
}
diff --git a/jaxp/src/org/w3c/dom/bootstrap/DOMImplementationRegistry.java b/jaxp/src/org/w3c/dom/bootstrap/DOMImplementationRegistry.java
index c15cff1dc2f..cfeeeea4907 100644
--- a/jaxp/src/org/w3c/dom/bootstrap/DOMImplementationRegistry.java
+++ b/jaxp/src/org/w3c/dom/bootstrap/DOMImplementationRegistry.java
@@ -104,6 +104,8 @@ public final class DOMImplementationRegistry {
*/
private static final String FALLBACK_CLASS =
"com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl";
+ private static final String DEFAULT_PACKAGE =
+ "com.sun.org.apache.xerces.internal.dom";
/**
* Private constructor.
* @param srcs Vector List of DOMImplementationSources
@@ -168,10 +170,15 @@ public final class DOMImplementationRegistry {
StringTokenizer st = new StringTokenizer(p);
while (st.hasMoreTokens()) {
String sourceName = st.nextToken();
- // Use context class loader, falling back to Class.forName
- // if and only if this fails...
+ // make sure we have access to restricted packages
+ boolean internal = false;
+ if (System.getSecurityManager() != null) {
+ if (sourceName != null && sourceName.startsWith(DEFAULT_PACKAGE)) {
+ internal = true;
+ }
+ }
Class sourceClass = null;
- if (classLoader != null) {
+ if (classLoader != null && !internal) {
sourceClass = classLoader.loadClass(sourceName);
} else {
sourceClass = Class.forName(sourceName);
diff --git a/jaxp/src/org/xml/sax/helpers/NewInstance.java b/jaxp/src/org/xml/sax/helpers/NewInstance.java
index 398f8dce8ea..449e62df1d4 100644
--- a/jaxp/src/org/xml/sax/helpers/NewInstance.java
+++ b/jaxp/src/org/xml/sax/helpers/NewInstance.java
@@ -54,9 +54,10 @@ import java.lang.reflect.InvocationTargetException;
* including versions of Java 2.
*
* @author Edwin Goei, David Brownell
+ * @version 2.0.1 (sax2r2)
*/
class NewInstance {
-
+ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
/**
* Creates a new instance of the specified class name
*
@@ -66,8 +67,16 @@ class NewInstance {
throws ClassNotFoundException, IllegalAccessException,
InstantiationException
{
+ // make sure we have access to restricted packages
+ boolean internal = false;
+ if (System.getSecurityManager() != null) {
+ if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
+ internal = true;
+ }
+ }
+
Class driverClass;
- if (classLoader == null) {
+ if (classLoader == null || internal) {
driverClass = Class.forName(className);
} else {
driverClass = classLoader.loadClass(className);
@@ -75,29 +84,4 @@ class NewInstance {
return driverClass.newInstance();
}
- /**
- * Figure out which ClassLoader to use. For JDK 1.2 and later use
- * the context ClassLoader.
- */
- static ClassLoader getClassLoader ()
- {
- Method m = null;
-
- try {
- m = Thread.class.getMethod("getContextClassLoader", (Class[]) null);
- } catch (NoSuchMethodException e) {
- // Assume that we are running JDK 1.1, use the current ClassLoader
- return NewInstance.class.getClassLoader();
- }
-
- try {
- return (ClassLoader) m.invoke(Thread.currentThread(), (Object[]) null);
- } catch (IllegalAccessException e) {
- // assert(false)
- throw new UnknownError(e.getMessage());
- } catch (InvocationTargetException e) {
- // assert(e.getTargetException() instanceof SecurityException)
- throw new UnknownError(e.getMessage());
- }
- }
}
diff --git a/jaxp/src/org/xml/sax/helpers/ParserAdapter.java b/jaxp/src/org/xml/sax/helpers/ParserAdapter.java
index b2f2adc7475..73f10c243d9 100644
--- a/jaxp/src/org/xml/sax/helpers/ParserAdapter.java
+++ b/jaxp/src/org/xml/sax/helpers/ParserAdapter.java
@@ -74,13 +74,14 @@ import org.xml.sax.SAXNotSupportedException;
*
* @since SAX 2.0
* @author David Megginson
+ * @version 2.0.1 (sax2r2)
* @see org.xml.sax.helpers.XMLReaderAdapter
* @see org.xml.sax.XMLReader
* @see org.xml.sax.Parser
*/
public class ParserAdapter implements XMLReader, DocumentHandler
{
-
+ private static SecuritySupport ss = new SecuritySupport();
////////////////////////////////////////////////////////////////////
// Constructors.
@@ -102,7 +103,7 @@ public class ParserAdapter implements XMLReader, DocumentHandler
{
super();
- String driver = System.getProperty("org.xml.sax.parser");
+ String driver = ss.getSystemProperty("org.xml.sax.parser");
try {
setup(ParserFactory.makeParser());
diff --git a/jaxp/src/org/xml/sax/helpers/ParserFactory.java b/jaxp/src/org/xml/sax/helpers/ParserFactory.java
index 8709a3ce9e4..e716be932a8 100644
--- a/jaxp/src/org/xml/sax/helpers/ParserFactory.java
+++ b/jaxp/src/org/xml/sax/helpers/ParserFactory.java
@@ -30,12 +30,6 @@
package org.xml.sax.helpers;
-import java.lang.ClassNotFoundException;
-import java.lang.IllegalAccessException;
-import java.lang.InstantiationException;
-import java.lang.SecurityException;
-import java.lang.ClassCastException;
-
import org.xml.sax.Parser;
@@ -69,9 +63,10 @@ import org.xml.sax.Parser;
* interface.
* @since SAX 1.0
* @author David Megginson
+ * @version 2.0.1 (sax2r2)
*/
public class ParserFactory {
-
+ private static SecuritySupport ss = new SecuritySupport();
/**
* Private null constructor.
@@ -109,7 +104,7 @@ public class ParserFactory {
NullPointerException,
ClassCastException
{
- String className = System.getProperty("org.xml.sax.parser");
+ String className = ss.getSystemProperty("org.xml.sax.parser");
if (className == null) {
throw new NullPointerException("No value for sax.parser property");
} else {
@@ -146,7 +141,7 @@ public class ParserFactory {
ClassCastException
{
return (Parser) NewInstance.newInstance (
- NewInstance.getClassLoader (), className);
+ ss.getContextClassLoader(), className);
}
}
diff --git a/jaxp/src/org/xml/sax/helpers/SecuritySupport.java b/jaxp/src/org/xml/sax/helpers/SecuritySupport.java
new file mode 100644
index 00000000000..cf03afbf618
--- /dev/null
+++ b/jaxp/src/org/xml/sax/helpers/SecuritySupport.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2004, 2006, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.xml.sax.helpers;
+
+import java.io.*;
+import java.security.*;
+
+/**
+ * This class is duplicated for each JAXP subpackage so keep it in sync.
+ * It is package private and therefore is not exposed as part of the JAXP
+ * API.
+ *
+ * Security related methods that only work on J2SE 1.2 and newer.
+ */
+class SecuritySupport {
+
+
+ ClassLoader getContextClassLoader() throws SecurityException{
+ return (ClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ //try {
+ cl = Thread.currentThread().getContextClassLoader();
+ //} catch (SecurityException ex) { }
+
+ if (cl == null)
+ cl = ClassLoader.getSystemClassLoader();
+
+ return cl;
+ }
+ });
+ }
+
+ String getSystemProperty(final String propName) {
+ return (String)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return System.getProperty(propName);
+ }
+ });
+ }
+
+ FileInputStream getFileInputStream(final File file)
+ throws FileNotFoundException
+ {
+ try {
+ return (FileInputStream)
+ AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws FileNotFoundException {
+ return new FileInputStream(file);
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (FileNotFoundException)e.getException();
+ }
+ }
+
+ InputStream getResourceAsStream(final ClassLoader cl,
+ final String name)
+ {
+ return (InputStream)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ InputStream ris;
+ if (cl == null) {
+ ris = Object.class.getResourceAsStream(name);
+ } else {
+ ris = cl.getResourceAsStream(name);
+ }
+ return ris;
+ }
+ });
+ }
+
+ boolean doesFileExist(final File f) {
+ return ((Boolean)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return new Boolean(f.exists());
+ }
+ })).booleanValue();
+ }
+
+}
diff --git a/jaxp/src/org/xml/sax/helpers/XMLReaderFactory.java b/jaxp/src/org/xml/sax/helpers/XMLReaderFactory.java
index 0d5ea4b7539..81ca862b1cf 100644
--- a/jaxp/src/org/xml/sax/helpers/XMLReaderFactory.java
+++ b/jaxp/src/org/xml/sax/helpers/XMLReaderFactory.java
@@ -34,8 +34,6 @@ package org.xml.sax.helpers;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import org.xml.sax.XMLReader;
import org.xml.sax.SAXException;
@@ -85,8 +83,8 @@ final public class XMLReaderFactory
}
private static final String property = "org.xml.sax.driver";
+ private static SecuritySupport ss = new SecuritySupport();
- private static String _clsFromJar = null;
private static boolean _jarread = false;
/**
* Attempt to create an XMLReader from system defaults.
@@ -134,43 +132,45 @@ final public class XMLReaderFactory
throws SAXException
{
String className = null;
- ClassLoader loader = NewInstance.getClassLoader ();
+ ClassLoader cl = ss.getContextClassLoader();
// 1. try the JVM-instance-wide system property
- try { className = System.getProperty (property); }
- catch (RuntimeException e) { /* normally fails for applets */ }
+ try {
+ className = ss.getSystemProperty(property);
+ }
+ catch (RuntimeException e) { /* continue searching */ }
// 2. if that fails, try META-INF/services/
if (className == null) {
if (!_jarread) {
- final ClassLoader loader1 = loader;
_jarread = true;
- _clsFromJar = (String)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- String clsName = null;
- try {
- String service = "META-INF/services/" + property;
- InputStream in;
- BufferedReader reader;
- if (loader1 == null)
- in = ClassLoader.getSystemResourceAsStream (service);
- else
- in = loader1.getResourceAsStream (service);
+ String service = "META-INF/services/" + property;
+ InputStream in;
+ BufferedReader reader;
- if (in != null) {
- reader = new BufferedReader (
- new InputStreamReader (in, "UTF8"));
- clsName = reader.readLine ();
- in.close ();
- }
- } catch (Exception e) {
+ try {
+ if (cl != null) {
+ in = ss.getResourceAsStream(cl, service);
+
+ // If no provider found then try the current ClassLoader
+ if (in == null) {
+ cl = null;
+ in = ss.getResourceAsStream(cl, service);
}
- return clsName;
+ } else {
+ // No Context ClassLoader, try the current ClassLoader
+ in = ss.getResourceAsStream(cl, service);
}
- });
+
+ if (in != null) {
+ reader = new BufferedReader (
+ new InputStreamReader (in, "UTF8"));
+ className = reader.readLine ();
+ in.close ();
+ }
+ } catch (Exception e) {
+ }
}
- className = _clsFromJar;
}
// 3. Distro-specific fallback
@@ -187,7 +187,7 @@ final public class XMLReaderFactory
// do we know the XMLReader implementation class yet?
if (className != null)
- return loadClass (loader, className);
+ return loadClass (cl, className);
// 4. panic -- adapt any SAX1 parser
try {
@@ -217,7 +217,7 @@ final public class XMLReaderFactory
public static XMLReader createXMLReader (String className)
throws SAXException
{
- return loadClass (NewInstance.getClassLoader (), className);
+ return loadClass (ss.getContextClassLoader(), className);
}
private static XMLReader loadClass (ClassLoader loader, String className)
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 50c6a136c6e..a5716c58186 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -206,3 +206,5 @@ c88bb21560ccf1a9e6d2a2ba08ed2045a002676f jdk8-b81
d8d8032d02d77fbf5f9b3bb8df73663f42fd4dd0 jdk8-b82
a1dcc0d83da1e07f3ada60ef110dd105d95d3554 jdk8-b83
5773e3fc83803f392234ba54c3a437ba176f1ead jdk8-b84
+8c0b6bccfe474576d6b30d1582c4329029330150 jdk8-b85
+a5e7c2f093c9996ab3419db1565094a07b059e9c jdk8-b86
diff --git a/jaxws/makefiles/BuildJaxws.gmk b/jaxws/makefiles/BuildJaxws.gmk
index 348cba90780..c70086e073b 100644
--- a/jaxws/makefiles/BuildJaxws.gmk
+++ b/jaxws/makefiles/BuildJaxws.gmk
@@ -55,7 +55,8 @@ $(eval $(call SetupJavaCompilation,BUILD_JAXWS,\
BIN:=$(JAXWS_OUTPUTDIR)/jaxws_classes,\
COPY:=.xsd,\
COPY_FILES:=$(JAXWS_TOPDIR)/src/share/jaxws_classes/com/sun/tools/internal/xjc/runtime/JAXBContextFactory.java \
- $(JAXWS_TOPDIR)/src/share/jaxws_classes/com/sun/tools/internal/xjc/runtime/ZeroOneBooleanAdapter.java,\
+ $(JAXWS_TOPDIR)/src/share/jaxws_classes/com/sun/tools/internal/xjc/runtime/ZeroOneBooleanAdapter.java \
+ $(JAXWS_TOPDIR)/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/jaxws-tubes-default.xml,\
ADD_JAVAC_FLAGS=-cp $(OUTPUT_ROOT)/jaxp/dist/lib/classes.jar))
$(JAXWS_OUTPUTDIR)/jaxws_classes/META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin: \
@@ -98,7 +99,7 @@ TARGET_PROP_FILES += $(patsubst $(JAXWS_TOPDIR)/src/share/jaf_classes/%,\
$(eval $(call SetupArchive,ARCHIVE_JAXWS,$(BUILD_JAXWS) $(BUILD_JAF) $(TARGET_PROP_FILES),\
SRCS:=$(JAXWS_OUTPUTDIR)/jaxws_classes $(JAXWS_OUTPUTDIR)/jaf_classes,\
- SUFFIXES:=.class .properties .xsd .java \
+ SUFFIXES:=.class .properties .xsd .xml .java \
com.sun.mirror.apt.AnnotationProcessorFactory \
com.sun.tools.internal.xjc.Plugin,\
JAR:=$(JAXWS_OUTPUTDIR)/dist/lib/classes.jar))
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/EnvelopeStyle.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/EnvelopeStyle.java
similarity index 93%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/EnvelopeStyle.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/EnvelopeStyle.java
index 5fb538bf60e..b56816d88b7 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/EnvelopeStyle.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/EnvelopeStyle.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -23,7 +23,7 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws;
+package com.oracle.webservices.internal.api;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -47,7 +47,7 @@ import javax.xml.ws.spi.WebServiceFeatureAnnotation;
*
* @author shih-chang.chen@oracle.com
*/
-@WebServiceFeatureAnnotation(id="", bean=com.sun.xml.internal.org.jvnet.ws.EnvelopeStyleFeature.class)
+@WebServiceFeatureAnnotation(id="", bean=com.oracle.webservices.internal.api.EnvelopeStyleFeature.class)
@Retention(RetentionPolicy.RUNTIME)
public @interface EnvelopeStyle {
@@ -70,7 +70,7 @@ public @interface EnvelopeStyle {
* SOAP1.2. For JAX-WS, this is mapped from:
* javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING
*/
- SOAP12(SOAPBinding.SOAP11HTTP_BINDING),
+ SOAP12(SOAPBinding.SOAP12HTTP_BINDING),
/**
* The raw XML. For JAX-WS, this is mapped from:
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/EnvelopeStyleFeature.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/EnvelopeStyleFeature.java
similarity index 93%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/EnvelopeStyleFeature.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/EnvelopeStyleFeature.java
index 8e39ef357eb..07aa92d6bd6 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/EnvelopeStyleFeature.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/EnvelopeStyleFeature.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -23,7 +23,7 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws;
+package com.oracle.webservices.internal.api;
import javax.xml.ws.WebServiceFeature;
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/Databinding.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/Databinding.java
similarity index 62%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/Databinding.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/Databinding.java
index f1e1c50dfd8..5f015061119 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/Databinding.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/Databinding.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -23,21 +23,19 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws.databinding;
+package com.oracle.webservices.internal.api.databinding;
-import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import javax.xml.namespace.QName;
-import javax.xml.transform.Result;
import javax.xml.transform.Source;
-import javax.xml.ws.Holder;
import javax.xml.ws.WebServiceFeature;
-import com.sun.xml.internal.org.jvnet.ws.message.MessageContext;
import org.xml.sax.EntityResolver;
+import com.oracle.webservices.internal.api.message.MessageContext;
+
/**
* {@code Databinding} is the entry point for all the WebService Databinding
* functionality. Primarily, a Databinding is to serialize/deserialize an
@@ -64,7 +62,7 @@ import org.xml.sax.EntityResolver;
*
*
*
- * @see com.sun.xml.internal.org.jvnet.ws.databinding.DatabindingFactory
+ * @see com.oracle.webservices.internal.api.databinding.DatabindingFactory
*
* @author shih-chang.chen@oracle.com
*/
@@ -94,7 +92,7 @@ public interface Databinding {
* Deserializes a response XML(SOAP) message to a JavaCallInfo instance
* representing the return value or exception of a JAVA method call.
*
- * @param soap The response message
+ * @param message The response message
* @param call The JavaCallInfo instance to be updated
*
* @return The JavaCallInfo updated with the return value or exception of a
@@ -123,11 +121,19 @@ public interface Databinding {
*/
MessageContext serializeResponse(JavaCallInfo call);
+ /**
+ * Gets the MessageContextFactory
+ *
+ * @return The MessageContextFactory
+ */
+//Wait for WLS/src1212 - wls.jaxrpc wrapper
+// MessageContextFactory getMessageContextFactory();
+
/**
* {@code Databinding.Builder}, created from the DatabindingFactory, is used to
* configure how a Databinding instance is to be built from this builder.
*
- * @see com.sun.xml.internal.org.jvnet.ws.databinding.DatabindingFactory
+ * @see com.oracle.webservices.internal.api.databinding.DatabindingFactory
* @author shih-chang.chen@oracle.com
*/
public interface Builder {
@@ -160,6 +166,8 @@ public interface Databinding {
Builder portName(QName portName);
/**
+ * @deprecated - no replacement - this was never implemented
+ *
* Sets the WSDL URL where the WSDL can be read from
*
* @param wsdlURL The wsdlURL to set
@@ -169,6 +177,8 @@ public interface Databinding {
Builder wsdlURL(URL wsdlURL);
/**
+ * @deprecated - no replacement - this was never implemented
+ *
* Sets the WSDL Source where the WSDL can be read from
*
* @param wsdlSource The wsdlSource to set
@@ -178,9 +188,11 @@ public interface Databinding {
Builder wsdlSource(Source wsdlSource);
/**
- * Sets the EntityResolver for reading the WSDL
+ * @deprecated - no replacement - this was never implemented
*
- * @param wsdlURL The wsdlURL to set
+ * Sets the {@link EntityResolver} for reading the WSDL
+ *
+ * @param entityResolver The {@link EntityResolver} to set
*
* @return this Builder instance
*/
@@ -230,95 +242,6 @@ public interface Databinding {
*
* @return WSDLGenerator The WSDLGenerator
*/
- WSDLGenerator createWSDLGenerator();
- }
-
- /**
- * WSDLGenerator is used to generate the WSDL representation of the service
- * endpoint interface of the parent Databinding object.
- */
- public interface WSDLGenerator {
-
- /**
- * Sets the inlineSchema boolean. When the inlineSchema is true, the
- * generated schema documents are embedded within the type element of
- * the generated WSDL. When the inlineSchema is false, the generated
- * schema documents are generated as standalone schema documents and
- * imported into the generated WSDL.
- *
- * @param inline the inlineSchema boolean.
- * @return
- */
- WSDLGenerator inlineSchema(boolean inline);
-
- /**
- * Sets A property of the WSDLGenerator
- *
- * @param name The name of the property
- * @param value The value of the property
- *
- * @return this WSDLGenerator instance
- */
- WSDLGenerator property(String name, Object value);
-
- /**
- * Generates the WSDL using the wsdlResolver to output the generated
- * documents.
- *
- * @param wsdlResolver The WSDLResolver
- */
- void generate(WSDLResolver wsdlResolver);
-
- /**
- * Generates the WSDL into the file directory
- *
- * @param outputDir The output file directory
- * @param name The file name of the main WSDL document
- */
- void generate(File outputDir, String name);
-
- /**
- * WSDLResolver is used by WSDLGenerator while generating WSDL and its associated
- * documents. It is used to control what documents need to be generated and what
- * documents need to be picked from metadata. If endpont's document metadata
- * already contains some documents, their systemids may be used for wsdl:import,
- * and schema:import. The suggested filenames are relative urls(for e.g: EchoSchema1.xsd)
- * The Result object systemids are also relative urls(for e.g: AbsWsdl.wsdl).
- *
- * @author Jitendra Kotamraju
- */
- public interface WSDLResolver {
- /**
- * Create a Result object into which concrete WSDL is to be generated.
- *
- * @return Result for the concrete WSDL
- */
- public Result getWSDL(String suggestedFilename);
-
- /**
- * Create a Result object into which abstract WSDL is to be generated. If the the
- * abstract WSDL is already in metadata, it is not generated.
- *
- * Update filename if the suggested filename need to be changed in wsdl:import.
- * This needs to be done if the metadata contains abstract WSDL, and that systemid
- * needs to be reflected in concrete WSDL's wsdl:import
- *
- * @return null if abstract WSDL need not be generated
- */
- public Result getAbstractWSDL(Holder filename);
-
- /**
- * Create a Result object into which schema doc is to be generated. Typically if
- * there is a schema doc for namespace in metadata, then it is not generated.
- *
- * Update filename if the suggested filename need to be changed in xsd:import. This
- * needs to be done if the metadata contains the document, and that systemid
- * needs to be reflected in some other document's xsd:import
- *
- * @return null if schema need not be generated
- */
- public Result getSchemaOutput(String namespace, Holder filename);
-
- }
+ com.oracle.webservices.internal.api.databinding.WSDLGenerator createWSDLGenerator();
}
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/DatabindingFactory.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/DatabindingFactory.java
similarity index 89%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/DatabindingFactory.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/DatabindingFactory.java
index ebfa6862e02..6b2a3e11b30 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/DatabindingFactory.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/DatabindingFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -23,7 +23,7 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws.databinding;
+package com.oracle.webservices.internal.api.databinding;
import java.util.Map;
@@ -44,7 +44,7 @@ import java.util.Map;
*
*
*
- * @see com.sun.xml.internal.org.jvnet.ws.databinding.Databinding
+ * @see com.oracle.webservices.internal.api.databinding.Databinding
*
* @author shih-chang.chen@oracle.com
*/
@@ -91,10 +91,15 @@ public abstract class DatabindingFactory {
static public DatabindingFactory newInstance() {
try {
Class> cls = Class.forName(ImplClass);
- return (DatabindingFactory) cls.newInstance();
+ return convertIfNecessary(cls);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
+
+ @SuppressWarnings("deprecation")
+ private static DatabindingFactory convertIfNecessary(Class> cls) throws InstantiationException, IllegalAccessException {
+ return (DatabindingFactory) cls.newInstance();
+ }
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/DatabindingMode.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/DatabindingMode.java
similarity index 85%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/DatabindingMode.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/DatabindingMode.java
index 46d4a9634b0..af18221fc59 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/DatabindingMode.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/DatabindingMode.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -23,14 +23,14 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws.databinding;
+package com.oracle.webservices.internal.api.databinding;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.xml.ws.spi.WebServiceFeatureAnnotation;
-@WebServiceFeatureAnnotation(id="", bean=com.sun.xml.internal.org.jvnet.ws.databinding.DatabindingModeFeature.class)
+@WebServiceFeatureAnnotation(id="", bean=com.oracle.webservices.internal.api.databinding.DatabindingModeFeature.class)
@Retention(RetentionPolicy.RUNTIME)
public @interface DatabindingMode {
String value();
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/DatabindingModeFeature.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/DatabindingModeFeature.java
similarity index 95%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/DatabindingModeFeature.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/DatabindingModeFeature.java
index 3bc6491c1db..c4cf116b0e0 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/DatabindingModeFeature.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/DatabindingModeFeature.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -23,7 +23,7 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws.databinding;
+package com.oracle.webservices.internal.api.databinding;
import java.util.HashMap;
import java.util.Map;
diff --git a/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/ExternalMetadataFeature.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/ExternalMetadataFeature.java
new file mode 100644
index 00000000000..d0c0d87a7fb
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/ExternalMetadataFeature.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 1997, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 com.oracle.webservices.internal.api.databinding;
+
+import com.sun.xml.internal.ws.api.databinding.MetadataReader;
+import com.sun.xml.internal.ws.model.ExternalMetadataReader;
+
+import javax.xml.ws.WebServiceFeature;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * WebServiceFeature allowing to define either on server or client side external xml descriptors replacing/supplementing
+ * WS metadata provided by class annotations. This can be useful if those annotations are missing (existing non-WS
+ * components) or if it is necessary to override those.
+ *
+ * @author Miroslav Kos (miroslav.kos at oracle.com)
+ */
+public class ExternalMetadataFeature extends WebServiceFeature {
+
+ private static final String ID = "com.oracle.webservices.internal.api.databinding.ExternalMetadataFeature";
+
+ /**
+ * Enable this feature. Defaults to true.
+ */
+ private boolean enabled = true;
+
+ private List resourceNames;
+ private List files;
+
+ private ExternalMetadataFeature() {
+ }
+
+ public void addResources(String... resourceNames) {
+ if (this.resourceNames == null) {
+ this.resourceNames = new ArrayList();
+ }
+ Collections.addAll(this.resourceNames, resourceNames);
+ }
+
+ public List getResourceNames() { return resourceNames; }
+
+ public void addFiles(File... files) {
+ if (this.files == null) {
+ this.files = new ArrayList();
+ }
+ Collections.addAll(this.files, files);
+ }
+
+ public List getFiles() { return files; }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ private void setEnabled(final boolean x) {
+ enabled = x;
+ }
+
+ @Override
+ public String getID() {
+ return ID;
+ }
+
+ public MetadataReader getMetadataReader(ClassLoader classLoader, boolean disableSecureXmlProcessing) {
+ return enabled ? new ExternalMetadataReader(files, resourceNames, classLoader, true, disableSecureXmlProcessing) : null;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ExternalMetadataFeature that = (ExternalMetadataFeature) o;
+
+ if (enabled != that.enabled) return false;
+ if (files != null ? !files.equals(that.files) : that.files != null) return false;
+ if (resourceNames != null ? !resourceNames.equals(that.resourceNames) : that.resourceNames != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = (enabled ? 1 : 0);
+ result = 31 * result + (resourceNames != null ? resourceNames.hashCode() : 0);
+ result = 31 * result + (files != null ? files.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + getID() +
+ ", enabled=" + enabled +
+ ", resourceNames=" + resourceNames +
+ ", files=" + files +
+ ']';
+ }
+
+ public static Builder builder() {
+ return new Builder(new ExternalMetadataFeature());
+ }
+
+ public final static class Builder {
+ final private ExternalMetadataFeature o;
+
+ Builder(final ExternalMetadataFeature x) {
+ o = x;
+ }
+
+ public ExternalMetadataFeature build() {
+ return o;
+ }
+
+ public Builder addResources(String... res) {
+ o.addResources(res);
+ return this;
+ }
+
+ public Builder addFiles(File... files) {
+ o.addFiles(files);
+ return this;
+ }
+
+ public Builder setEnabled(boolean enabled) {
+ o.setEnabled(enabled);
+ return this;
+ }
+
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/JavaCallInfo.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/JavaCallInfo.java
similarity index 96%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/JavaCallInfo.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/JavaCallInfo.java
index 221958b650d..db9a9f2f5f2 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/databinding/JavaCallInfo.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/JavaCallInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -23,7 +23,7 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws.databinding;
+package com.oracle.webservices.internal.api.databinding;
import java.lang.reflect.Method;
diff --git a/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/WSDLGenerator.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/WSDLGenerator.java
new file mode 100644
index 00000000000..5bda62b8674
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/WSDLGenerator.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2012, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 com.oracle.webservices.internal.api.databinding;
+
+import java.io.File;
+
+/**
+ * WSDLGenerator is used to generate the WSDL representation of the service
+ * endpoint interface of the parent Databinding object.
+ */
+public interface WSDLGenerator {
+
+ /**
+ * Sets the inlineSchema boolean. When the inlineSchema is true, the
+ * generated schema documents are embedded within the type element of
+ * the generated WSDL. When the inlineSchema is false, the generated
+ * schema documents are generated as standalone schema documents and
+ * imported into the generated WSDL.
+ *
+ * @param inline the inlineSchema boolean.
+ * @return
+ */
+ WSDLGenerator inlineSchema(boolean inline);
+
+ /**
+ * Sets A property of the WSDLGenerator
+ *
+ * @param name The name of the property
+ * @param value The value of the property
+ *
+ * @return this WSDLGenerator instance
+ */
+ WSDLGenerator property(String name, Object value);
+
+ /**
+ * Generates the WSDL using the wsdlResolver to output the generated
+ * documents.
+ *
+ * @param wsdlResolver The WSDLResolver
+ */
+ void generate(com.oracle.webservices.internal.api.databinding.WSDLResolver wsdlResolver);
+
+ /**
+ * Generates the WSDL into the file directory
+ *
+ * @param outputDir The output file directory
+ * @param name The file name of the main WSDL document
+ */
+ void generate(File outputDir, String name);
+}
diff --git a/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/WSDLResolver.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/WSDLResolver.java
new file mode 100644
index 00000000000..fba41f73d90
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/WSDLResolver.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2012, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 com.oracle.webservices.internal.api.databinding;
+
+import javax.xml.transform.Result;
+import javax.xml.ws.Holder;
+
+/**
+ * WSDLResolver is used by WSDLGenerator while generating WSDL and its associated
+ * documents. It is used to control what documents need to be generated and what
+ * documents need to be picked from metadata. If endpont's document metadata
+ * already contains some documents, their systemids may be used for wsdl:import,
+ * and schema:import. The suggested filenames are relative urls(for e.g: EchoSchema1.xsd)
+ * The Result object systemids are also relative urls(for e.g: AbsWsdl.wsdl).
+ *
+ * @author Jitendra Kotamraju
+ */
+public interface WSDLResolver {
+ /**
+ * Create a Result object into which concrete WSDL is to be generated.
+ *
+ * @return Result for the concrete WSDL
+ */
+ public Result getWSDL(String suggestedFilename);
+
+ /**
+ * Create a Result object into which abstract WSDL is to be generated. If the the
+ * abstract WSDL is already in metadata, it is not generated.
+ *
+ * Update filename if the suggested filename need to be changed in wsdl:import.
+ * This needs to be done if the metadata contains abstract WSDL, and that systemid
+ * needs to be reflected in concrete WSDL's wsdl:import
+ *
+ * @return null if abstract WSDL need not be generated
+ */
+ public Result getAbstractWSDL(Holder filename);
+
+ /**
+ * Create a Result object into which schema doc is to be generated. Typically if
+ * there is a schema doc for namespace in metadata, then it is not generated.
+ *
+ * Update filename if the suggested filename need to be changed in xsd:import. This
+ * needs to be done if the metadata contains the document, and that systemid
+ * needs to be reflected in some other document's xsd:import
+ *
+ * @return null if schema need not be generated
+ */
+ public Result getSchemaOutput(String namespace, Holder filename);
+
+}
diff --git a/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/BaseDistributedPropertySet.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/BaseDistributedPropertySet.java
new file mode 100644
index 00000000000..ab53f0574c1
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/BaseDistributedPropertySet.java
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 1997, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 com.oracle.webservices.internal.api.message;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.istack.internal.Nullable;
+import com.sun.xml.internal.ws.api.message.Packet;
+import com.sun.xml.internal.ws.client.RequestContext;
+import com.sun.xml.internal.ws.client.ResponseContext;
+
+import javax.xml.ws.WebServiceContext;
+
+import java.util.AbstractMap;
+import java.util.Map.Entry;
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * {@link PropertySet} that combines properties exposed from multiple
+ * {@link PropertySet}s into one.
+ *
+ *
+ * This implementation allows one {@link PropertySet} to assemble
+ * all properties exposed from other "satellite" {@link PropertySet}s.
+ * (A satellite may itself be a {@link DistributedPropertySet}, so
+ * in general this can form a tree.)
+ *
+ *
+ * This is useful for JAX-WS because the properties we expose to the application
+ * are contributed by different pieces, and therefore we'd like each of them
+ * to have a separate {@link PropertySet} implementation that backs up
+ * the properties. For example, this allows FastInfoset to expose its
+ * set of properties to {@link RequestContext} by using a strongly-typed fields.
+ *
+ *
+ * This is also useful for a client-side transport to expose a bunch of properties
+ * into {@link ResponseContext}. It simply needs to create a {@link PropertySet}
+ * object with methods for each property it wants to expose, and then add that
+ * {@link PropertySet} to {@link Packet}. This allows property values to be
+ * lazily computed (when actually asked by users), thus improving the performance
+ * of the typical case where property values are not asked.
+ *
+ *
+ * A similar benefit applies on the server-side, for a transport to expose
+ * a bunch of properties to {@link WebServiceContext}.
+ *
+ *
+ * To achieve these benefits, access to {@link DistributedPropertySet} is slower
+ * compared to {@link PropertySet} (such as get/set), while adding a satellite
+ * object is relatively fast.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public abstract class BaseDistributedPropertySet extends BasePropertySet implements DistributedPropertySet {
+
+ /**
+ * All {@link PropertySet}s that are bundled into this {@link PropertySet}.
+ */
+ private final Map, PropertySet> satellites
+ = new IdentityHashMap, PropertySet>();
+
+ private final Map viewthis;
+
+ public BaseDistributedPropertySet() {
+ this.viewthis = super.createView();
+ }
+
+ @Override
+ public void addSatellite(@NotNull PropertySet satellite) {
+ addSatellite(satellite.getClass(), satellite);
+ }
+
+ @Override
+ public void addSatellite(@NotNull Class extends com.oracle.webservices.internal.api.message.PropertySet> keyClass, @NotNull PropertySet satellite) {
+ satellites.put(keyClass, satellite);
+ }
+
+ @Override
+ public void removeSatellite(PropertySet satellite) {
+ satellites.remove(satellite.getClass());
+ }
+
+ public void copySatelliteInto(@NotNull DistributedPropertySet r) {
+ for (Map.Entry, PropertySet> entry : satellites.entrySet()) {
+ r.addSatellite(entry.getKey(), entry.getValue());
+ }
+ }
+
+ @Override
+ public void copySatelliteInto(MessageContext r) {
+ copySatelliteInto((DistributedPropertySet)r);
+ }
+
+ @Override
+ public @Nullable T getSatellite(Class satelliteClass) {
+ T satellite = (T) satellites.get(satelliteClass);
+ if (satellite != null) {
+ return satellite;
+ }
+
+ for (PropertySet child : satellites.values()) {
+ if (satelliteClass.isInstance(child)) {
+ return satelliteClass.cast(child);
+ }
+
+ if (DistributedPropertySet.class.isInstance(child)) {
+ satellite = DistributedPropertySet.class.cast(child).getSatellite(satelliteClass);
+ if (satellite != null) {
+ return satellite;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Map, com.oracle.webservices.internal.api.message.PropertySet> getSatellites() {
+ return satellites;
+ }
+
+ @Override
+ public Object get(Object key) {
+ // check satellites
+ for (PropertySet child : satellites.values()) {
+ if (child.supports(key)) {
+ return child.get(key);
+ }
+ }
+
+ // otherwise it must be the master
+ return super.get(key);
+ }
+
+ @Override
+ public Object put(String key, Object value) {
+ // check satellites
+ for (PropertySet child : satellites.values()) {
+ if(child.supports(key)) {
+ return child.put(key,value);
+ }
+ }
+
+ // otherwise it must be the master
+ return super.put(key,value);
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ if (viewthis.containsKey(key))
+ return true;
+ for (PropertySet child : satellites.values()) {
+ if (child.containsKey(key)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean supports(Object key) {
+ // check satellites
+ for (PropertySet child : satellites.values()) {
+ if (child.supports(key)) {
+ return true;
+ }
+ }
+
+ return super.supports(key);
+ }
+
+ @Override
+ public Object remove(Object key) {
+ // check satellites
+ for (PropertySet child : satellites.values()) {
+ if (child.supports(key)) {
+ return child.remove(key);
+ }
+ }
+
+ return super.remove(key);
+ }
+
+ @Override
+ protected void createEntrySet(Set> core) {
+ super.createEntrySet(core);
+ for (PropertySet child : satellites.values()) {
+ ((BasePropertySet) child).createEntrySet(core);
+ }
+ }
+
+ protected Map asMapLocal() {
+ return viewthis;
+ }
+
+ protected boolean supportsLocal(Object key) {
+ return super.supports(key);
+ }
+
+ class DistributedMapView extends AbstractMap {
+ @Override
+ public Object get(Object key) {
+ for (PropertySet child : satellites.values()) {
+ if (child.supports(key)) {
+ return child.get(key);
+ }
+ }
+
+ return viewthis.get(key);
+ }
+
+ @Override
+ public int size() {
+ int size = viewthis.size();
+ for (PropertySet child : satellites.values()) {
+ size += child.asMap().size();
+ }
+ return size;
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ if (viewthis.containsKey(key))
+ return true;
+ for (PropertySet child : satellites.values()) {
+ if (child.containsKey(key))
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public Set> entrySet() {
+ Set> entries = new HashSet>();
+ for (PropertySet child : satellites.values()) {
+ for (Entry entry : child.asMap().entrySet()) {
+ // the code below is here to avoid entries.addAll(child.asMap().entrySet()); which works differently on JDK6/7
+ // see DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS
+ entries.add(new SimpleImmutableEntry(entry.getKey(), entry.getValue()));
+ }
+ }
+ for (Entry entry : viewthis.entrySet()) {
+ // the code below is here to avoid entries.addAll(child.asMap().entrySet()); which works differently on JDK6/7
+ // see DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS
+ entries.add(new SimpleImmutableEntry(entry.getKey(), entry.getValue()));
+ }
+
+ return entries;
+ }
+
+ @Override
+ public Object put(String key, Object value) {
+ for (PropertySet child : satellites.values()) {
+ if (child.supports(key)) {
+ return child.put(key, value);
+ }
+ }
+
+ return viewthis.put(key, value);
+ }
+
+ @Override
+ public void clear() {
+ satellites.clear();
+ viewthis.clear();
+ }
+
+ @Override
+ public Object remove(Object key) {
+ for (PropertySet child : satellites.values()) {
+ if (child.supports(key)) {
+ return child.remove(key);
+ }
+ }
+
+ return viewthis.remove(key);
+ }
+ }
+
+ @Override
+ protected Map createView() {
+ return new DistributedMapView();
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/BasePropertySet.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/BasePropertySet.java
new file mode 100644
index 00000000000..4c3ca54ef62
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/BasePropertySet.java
@@ -0,0 +1,548 @@
+/*
+ * Copyright (c) 1997, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 com.oracle.webservices.internal.api.message;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.istack.internal.Nullable;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.AbstractMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+
+/**
+ * A set of "properties" that can be accessed via strongly-typed fields
+ * as well as reflexibly through the property name.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+@SuppressWarnings("SuspiciousMethodCalls")
+public abstract class BasePropertySet implements PropertySet {
+
+ /**
+ * Creates a new instance of TypedMap.
+ */
+ protected BasePropertySet() {
+ }
+
+ private Map mapView;
+
+ /**
+ * Represents the list of strongly-typed known properties
+ * (keyed by property names.)
+ *
+ *
+ * Just giving it an alias to make the use of this class more fool-proof.
+ */
+ protected static class PropertyMap extends HashMap {
+
+ // the entries are often being iterated through so performance can be improved
+ // by their caching instead of iterating through the original (immutable) map each time
+ transient PropertyMapEntry[] cachedEntries = null;
+
+ PropertyMapEntry[] getPropertyMapEntries() {
+ if (cachedEntries == null) {
+ cachedEntries = createPropertyMapEntries();
+ }
+ return cachedEntries;
+ }
+
+ private PropertyMapEntry[] createPropertyMapEntries() {
+ final PropertyMapEntry[] modelEntries = new PropertyMapEntry[size()];
+ int i = 0;
+ for (final Entry e : entrySet()) {
+ modelEntries[i++] = new PropertyMapEntry(e.getKey(), e.getValue());
+ }
+ return modelEntries;
+ }
+
+ }
+
+ /**
+ * PropertyMapEntry represents a Map.Entry in the PropertyMap with more efficient access.
+ */
+ static public class PropertyMapEntry {
+ public PropertyMapEntry(String k, Accessor v) {
+ key = k; value = v;
+ }
+ String key;
+ Accessor value;
+ }
+
+ /**
+ * Map representing the Fields and Methods annotated with {@link PropertySet.Property}.
+ * Model of {@link PropertySet} class.
+ *
+ *
+ * At the end of the derivation chain this method just needs to be implemented
+ * as:
+ *
+ *
+ */
+ protected abstract PropertyMap getPropertyMap();
+
+ /**
+ * This method parses a class for fields and methods with {@link PropertySet.Property}.
+ */
+ protected static PropertyMap parse(final Class clazz) {
+ // make all relevant fields and methods accessible.
+ // this allows runtime to skip the security check, so they runs faster.
+ return AccessController.doPrivileged(new PrivilegedAction() {
+ @Override
+ public PropertyMap run() {
+ PropertyMap props = new PropertyMap();
+ for (Class c=clazz; c!=null; c=c.getSuperclass()) {
+ for (Field f : c.getDeclaredFields()) {
+ Property cp = f.getAnnotation(Property.class);
+ if(cp!=null) {
+ for(String value : cp.value()) {
+ props.put(value, new FieldAccessor(f, value));
+ }
+ }
+ }
+ for (Method m : c.getDeclaredMethods()) {
+ Property cp = m.getAnnotation(Property.class);
+ if(cp!=null) {
+ String name = m.getName();
+ assert name.startsWith("get") || name.startsWith("is");
+
+ String setName = name.startsWith("is") ? "set"+name.substring(2) : // isFoo -> setFoo
+ 's' +name.substring(1); // getFoo -> setFoo
+ Method setter;
+ try {
+ setter = clazz.getMethod(setName,m.getReturnType());
+ } catch (NoSuchMethodException e) {
+ setter = null; // no setter
+ }
+ for(String value : cp.value()) {
+ props.put(value, new MethodAccessor(m, setter, value));
+ }
+ }
+ }
+ }
+
+ return props;
+ }
+ });
+ }
+
+ /**
+ * Represents a typed property defined on a {@link PropertySet}.
+ */
+ protected interface Accessor {
+ String getName();
+ boolean hasValue(PropertySet props);
+ Object get(PropertySet props);
+ void set(PropertySet props, Object value);
+ }
+
+ static final class FieldAccessor implements Accessor {
+ /**
+ * Field with the annotation.
+ */
+ private final Field f;
+
+ /**
+ * One of the values in {@link Property} annotation on {@link #f}.
+ */
+ private final String name;
+
+ protected FieldAccessor(Field f, String name) {
+ this.f = f;
+ f.setAccessible(true);
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean hasValue(PropertySet props) {
+ return get(props)!=null;
+ }
+
+ @Override
+ public Object get(PropertySet props) {
+ try {
+ return f.get(props);
+ } catch (IllegalAccessException e) {
+ throw new AssertionError();
+ }
+ }
+
+ @Override
+ public void set(PropertySet props, Object value) {
+ try {
+ f.set(props,value);
+ } catch (IllegalAccessException e) {
+ throw new AssertionError();
+ }
+ }
+ }
+
+ static final class MethodAccessor implements Accessor {
+ /**
+ * Getter method.
+ */
+ private final @NotNull Method getter;
+ /**
+ * Setter method.
+ * Some property is read-only.
+ */
+ private final @Nullable Method setter;
+
+ /**
+ * One of the values in {@link Property} annotation on {@link #getter}.
+ */
+ private final String name;
+
+ protected MethodAccessor(Method getter, Method setter, String value) {
+ this.getter = getter;
+ this.setter = setter;
+ this.name = value;
+ getter.setAccessible(true);
+ if (setter!=null) {
+ setter.setAccessible(true);
+ }
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean hasValue(PropertySet props) {
+ return get(props)!=null;
+ }
+
+ @Override
+ public Object get(PropertySet props) {
+ try {
+ return getter.invoke(props);
+ } catch (IllegalAccessException e) {
+ throw new AssertionError();
+ } catch (InvocationTargetException e) {
+ handle(e);
+ return 0; // never reach here
+ }
+ }
+
+ @Override
+ public void set(PropertySet props, Object value) {
+ if(setter==null) {
+ throw new ReadOnlyPropertyException(getName());
+ }
+ try {
+ setter.invoke(props,value);
+ } catch (IllegalAccessException e) {
+ throw new AssertionError();
+ } catch (InvocationTargetException e) {
+ handle(e);
+ }
+ }
+
+ /**
+ * Since we don't expect the getter/setter to throw a checked exception,
+ * it should be possible to make the exception propagation transparent.
+ * That's what we are trying to do here.
+ */
+ private Exception handle(InvocationTargetException e) {
+ Throwable t = e.getTargetException();
+ if (t instanceof Error) {
+ throw (Error)t;
+ }
+ if (t instanceof RuntimeException) {
+ throw (RuntimeException)t;
+ }
+ throw new Error(e);
+ }
+ }
+
+
+ /**
+ * Class allowing to work with PropertySet object as with a Map; it doesn't only allow to read properties from
+ * the map but also to modify the map in a way it is in sync with original strongly typed fields. It also allows
+ * (if necessary) to store additional properties those can't be found in strongly typed fields.
+ *
+ * @see com.sun.xml.internal.ws.api.PropertySet#asMap() method
+ */
+ final class MapView extends HashMap {
+
+ // flag if it should allow store also different properties
+ // than the from strongly typed fields
+ boolean extensible;
+
+ MapView(boolean extensible) {
+ super(getPropertyMap().getPropertyMapEntries().length);
+ this.extensible = extensible;
+ initialize();
+ }
+
+ public void initialize() {
+ // iterate (cached) array instead of map to speed things up ...
+ PropertyMapEntry[] entries = getPropertyMap().getPropertyMapEntries();
+ for (PropertyMapEntry entry : entries) {
+ super.put(entry.key, entry.value);
+ }
+ }
+
+ @Override
+ public Object get(Object key) {
+ Object o = super.get(key);
+ if (o instanceof Accessor) {
+ return ((Accessor) o).get(BasePropertySet.this);
+ } else {
+ return o;
+ }
+ }
+
+ @Override
+ public Set> entrySet() {
+ Set> entries = new HashSet>();
+ for (String key : keySet()) {
+ entries.add(new SimpleImmutableEntry(key, get(key)));
+ }
+ return entries;
+ }
+
+ @Override
+ public Object put(String key, Object value) {
+
+ Object o = super.get(key);
+ if (o != null && o instanceof Accessor) {
+
+ Object oldValue = ((Accessor) o).get(BasePropertySet.this);
+ ((Accessor) o).set(BasePropertySet.this, value);
+ return oldValue;
+
+ } else {
+
+ if (extensible) {
+ return super.put(key, value);
+ } else {
+ throw new IllegalStateException("Unknown property [" + key + "] for PropertySet [" +
+ BasePropertySet.this.getClass().getName() + "]");
+ }
+ }
+ }
+
+ @Override
+ public void clear() {
+ for (String key : keySet()) {
+ remove(key);
+ }
+ }
+
+ @Override
+ public Object remove(Object key) {
+ Object o;
+ o = super.get(key);
+ if (o instanceof Accessor) {
+ ((Accessor)o).set(BasePropertySet.this, null);
+ }
+ return super.remove(key);
+ }
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ Accessor sp = getPropertyMap().get(key);
+ if (sp != null) {
+ return sp.get(this) != null;
+ }
+ return false;
+ }
+
+ /**
+ * Gets the name of the property.
+ *
+ * @param key
+ * This field is typed as {@link Object} to follow the {@link Map#get(Object)}
+ * convention, but if anything but {@link String} is passed, this method
+ * just returns null.
+ */
+ @Override
+ public Object get(Object key) {
+ Accessor sp = getPropertyMap().get(key);
+ if (sp != null) {
+ return sp.get(this);
+ }
+ throw new IllegalArgumentException("Undefined property "+key);
+ }
+
+ /**
+ * Sets a property.
+ *
+ *
Implementation Note
+ * This method is slow. Code inside JAX-WS should define strongly-typed
+ * fields in this class and access them directly, instead of using this.
+ *
+ * @throws ReadOnlyPropertyException
+ * if the given key is an alias of a strongly-typed field,
+ * and if the name object given is not assignable to the field.
+ *
+ * @see Property
+ */
+ @Override
+ public Object put(String key, Object value) {
+ Accessor sp = getPropertyMap().get(key);
+ if(sp!=null) {
+ Object old = sp.get(this);
+ sp.set(this,value);
+ return old;
+ } else {
+ throw new IllegalArgumentException("Undefined property "+key);
+ }
+ }
+
+ /**
+ * Checks if this {@link PropertySet} supports a property of the given name.
+ */
+ @Override
+ public boolean supports(Object key) {
+ return getPropertyMap().containsKey(key);
+ }
+
+ @Override
+ public Object remove(Object key) {
+ Accessor sp = getPropertyMap().get(key);
+ if(sp!=null) {
+ Object old = sp.get(this);
+ sp.set(this,null);
+ return old;
+ } else {
+ throw new IllegalArgumentException("Undefined property "+key);
+ }
+ }
+
+ /**
+ * Creates a {@link Map} view of this {@link PropertySet}.
+ *
+ *
+ * This map is partially live, in the sense that values you set to it
+ * will be reflected to {@link PropertySet}.
+ *
+ *
+ * However, this map may not pick up changes made
+ * to {@link PropertySet} after the view is created.
+ *
+ * @deprecated use newer implementation {@link PropertySet#asMap()} which produces
+ * readwrite {@link Map}
+ *
+ * @return
+ * always non-null valid instance.
+ */
+ @Deprecated
+ @Override
+ public final Map createMapView() {
+ final Set> core = new HashSet>();
+ createEntrySet(core);
+
+ return new AbstractMap() {
+ @Override
+ public Set> entrySet() {
+ return core;
+ }
+ };
+ }
+
+ /**
+ * Creates a modifiable {@link Map} view of this {@link PropertySet}.
+ *
+ * Changes done on this {@link Map} or on {@link PropertySet} object work in both directions - values made to
+ * {@link Map} are reflected to {@link PropertySet} and changes done using getters/setters on {@link PropertySet}
+ * object are automatically reflected in this {@link Map}.
+ *
+ * If necessary, it also can hold other values (not present on {@link PropertySet}) -
+ * {@see PropertySet#mapAllowsAdditionalProperties}
+ *
+ * @return always non-null valid instance.
+ */
+ @Override
+ public Map asMap() {
+ if (mapView == null) {
+ mapView = createView();
+ }
+ return mapView;
+ }
+
+ protected Map createView() {
+ return new MapView(mapAllowsAdditionalProperties());
+ }
+
+ /**
+ * Used when constructing the {@link MapView} for this object - it controls if the {@link MapView} servers only to
+ * access strongly typed values or allows also different values
+ *
+ * @return true if {@link Map} should allow also properties not defined as strongly typed fields
+ */
+ protected boolean mapAllowsAdditionalProperties() {
+ return false;
+ }
+
+ protected void createEntrySet(Set> core) {
+ for (final Entry e : getPropertyMap().entrySet()) {
+ core.add(new Entry() {
+ @Override
+ public String getKey() {
+ return e.getKey();
+ }
+
+ @Override
+ public Object getValue() {
+ return e.getValue().get(BasePropertySet.this);
+ }
+
+ @Override
+ public Object setValue(Object value) {
+ Accessor acc = e.getValue();
+ Object old = acc.get(BasePropertySet.this);
+ acc.set(BasePropertySet.this,value);
+ return old;
+ }
+ });
+ }
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/ContentType.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/ContentType.java
similarity index 71%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/ContentType.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/ContentType.java
index 635705aa90c..afdb887f9b9 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/ContentType.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/ContentType.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -23,7 +23,10 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws.message;
+package com.oracle.webservices.internal.api.message;
+
+//TODO Do we want to remove this implementation dependency?
+import com.sun.xml.internal.ws.encoding.ContentTypeImpl;
/**
* A Content-Type transport header that will be returned by {@link MessageContext#write(java.io.OutputStream)}.
@@ -56,4 +59,20 @@ public interface ContentType {
* a similar functionality, we'll define a real abstraction.
*/
public String getAcceptHeader();
+
+ static public class Builder {
+ private String contentType;
+ private String soapAction;
+ private String accept;
+ private String charset;
+
+ public Builder contentType(String s) {contentType = s; return this; }
+ public Builder soapAction (String s) {soapAction = s; return this; }
+ public Builder accept (String s) {accept = s; return this; }
+ public Builder charset (String s) {charset = s; return this; }
+ public ContentType build() {
+ //TODO Do we want to remove this implementation dependency?
+ return new ContentTypeImpl(contentType, soapAction, accept, charset);
+ }
+ }
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/DistributedPropertySet.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/DistributedPropertySet.java
similarity index 73%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/DistributedPropertySet.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/DistributedPropertySet.java
index c44c7da93ea..60566d92e3d 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/DistributedPropertySet.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/DistributedPropertySet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -23,7 +23,9 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws.message;
+package com.oracle.webservices.internal.api.message;
+
+import java.util.Map;
import com.sun.istack.internal.Nullable;
@@ -63,15 +65,17 @@ import com.sun.istack.internal.Nullable;
*
* @author Kohsuke Kawaguchi
*/
-public interface DistributedPropertySet extends com.sun.xml.internal.org.jvnet.ws.message.PropertySet {
+public interface DistributedPropertySet extends com.oracle.webservices.internal.api.message.PropertySet {
- public @Nullable T getSatellite(Class satelliteClass);
+ public @Nullable T getSatellite(Class satelliteClass);
- public void addSatellite(com.sun.xml.internal.org.jvnet.ws.message.PropertySet satellite);
+ public Map, com.oracle.webservices.internal.api.message.PropertySet> getSatellites();
- public void addSatellite(Class keyClass, com.sun.xml.internal.org.jvnet.ws.message.PropertySet satellite);
+ public void addSatellite(com.oracle.webservices.internal.api.message.PropertySet satellite);
- public void removeSatellite(com.sun.xml.internal.org.jvnet.ws.message.PropertySet satellite);
+ public void addSatellite(Class extends com.oracle.webservices.internal.api.message.PropertySet> keyClass, com.oracle.webservices.internal.api.message.PropertySet satellite);
- public void copySatelliteInto(com.sun.xml.internal.org.jvnet.ws.message.MessageContext r);
+ public void removeSatellite(com.oracle.webservices.internal.api.message.PropertySet satellite);
+
+ public void copySatelliteInto(com.oracle.webservices.internal.api.message.MessageContext r);
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/MessageContext.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/MessageContext.java
similarity index 75%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/MessageContext.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/MessageContext.java
index 067145528d5..f918f387ad2 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/MessageContext.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/MessageContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -23,7 +23,7 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws.message;
+package com.oracle.webservices.internal.api.message;
import java.io.IOException;
import java.io.OutputStream;
@@ -54,36 +54,15 @@ public interface MessageContext extends DistributedPropertySet {
*
* @return The SOAPMessage
*/
+ SOAPMessage getAsSOAPMessage() throws SOAPException;
+
+ /**
+ * Gets the SAAJ SOAPMessage representation of the SOAP message.
+ * @deprecated use getAsSOAPMessage
+ * @return The SOAPMessage
+ */
SOAPMessage getSOAPMessage() throws SOAPException;
- /**
- * Adds the {@link PropertySet}
- *
- * @param satellite the PropertySet
- */
- void addSatellite(PropertySet satellite);
-
- /**
- * Removes the {@link PropertySet}
- *
- * @param satellite the PropertySet
- */
- void removeSatellite(PropertySet satellite);
-
- /**
- * Copies all the {@link PropertySet} of this MessageContext into the other MessageContext
- *
- * @param otherMessageContext the MessageContext
- */
- void copySatelliteInto(MessageContext otherMessageContext);
-
- /**
- * Gets the {@link PropertySet}
- *
- * @param satellite the PropertySet type
- */
- T getSatellite(Class satelliteClass);
-
/**
* Writes the XML infoset portion of this MessageContext
* (from <soap:Envelope> to </soap:Envelope>).
@@ -99,8 +78,7 @@ public interface MessageContext extends DistributedPropertySet {
* @throws IOException
* if a {@link OutputStream} throws {@link IOException}.
*/
- //TODO chen: wait for DISI
-// ContentType writeTo( OutputStream out ) throws IOException;
+ ContentType writeTo( OutputStream out ) throws IOException;
/**
* The version of {@link #writeTo(OutputStream)}
@@ -110,6 +88,14 @@ public interface MessageContext extends DistributedPropertySet {
* TODO: for the convenience of implementation, write
* an adapter that wraps {@link WritableByteChannel} to {@link OutputStream}.
*/
- //TODO chen: wait for DISI
-// ContentType writeTo( WritableByteChannel buffer );
+// ContentType writeTo( WritableByteChannel buffer );
+
+ /**
+ * Gets the Content-type of this message. For an out-bound message that this getContentType()
+ * method returns a null, the Content-Type can be determined only by calling the writeTo
+ * method to write the MessageContext to an OutputStream.
+ *
+ * @return The MIME content type of this message
+ */
+ ContentType getContentType();
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/MessageContextFactory.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/MessageContextFactory.java
similarity index 87%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/MessageContextFactory.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/MessageContextFactory.java
index de131291188..c2fbad56171 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/MessageContextFactory.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/MessageContextFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -23,103 +23,28 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws.message;
+package com.oracle.webservices.internal.api.message;
import java.io.IOException;
import java.io.InputStream;
+import com.oracle.webservices.internal.api.EnvelopeStyle;
import com.sun.xml.internal.ws.api.SOAPVersion; // TODO leaking RI APIs
-import com.sun.xml.internal.ws.api.message.Message;
-import com.sun.xml.internal.ws.api.message.Messages;
-import com.sun.xml.internal.ws.api.message.Packet;
import com.sun.xml.internal.ws.util.ServiceFinder;
-//import java.io.InputStream;
+import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.ws.WebServiceFeature;
-import com.sun.xml.internal.org.jvnet.ws.EnvelopeStyle;
-import com.sun.xml.internal.org.jvnet.ws.message.MessageContext;
-
public abstract class MessageContextFactory
{
private static final MessageContextFactory DEFAULT = new com.sun.xml.internal.ws.api.message.MessageContextFactory(new WebServiceFeature[0]);
- /**
- * @deprecated
- */
- public abstract MessageContext doCreate();
-
- /**
- * @deprecated
- */
- public abstract MessageContext doCreate(SOAPMessage m);
- //public abstract MessageContext doCreate(InputStream x);
-
- /**
- * @deprecated
- */
- public abstract MessageContext doCreate(Source x, SOAPVersion soapVersion);
-
- /**
- * @deprecated
- */
- public static MessageContext create(final ClassLoader... classLoader) {
- return serviceFinder(classLoader,
- new Creator() {
- public MessageContext create(final MessageContextFactory f) {
- return f.doCreate();
- }
- });
- }
-
- /**
- * @deprecated
- */
- public static MessageContext create(final SOAPMessage m, final ClassLoader... classLoader) {
- return serviceFinder(classLoader,
- new Creator() {
- public MessageContext create(final MessageContextFactory f) {
- return f.doCreate(m);
- }
- });
- }
-
- /**
- * @deprecated
- */
- public static MessageContext create(final Source m, final SOAPVersion v, final ClassLoader... classLoader) {
- return serviceFinder(classLoader,
- new Creator() {
- public MessageContext create(final MessageContextFactory f) {
- return f.doCreate(m, v);
- }
- });
- }
-
- /**
- * @deprecated
- */
- private static MessageContext serviceFinder(final ClassLoader[] classLoader, final Creator creator) {
- final ClassLoader cl = classLoader.length == 0 ? null : classLoader[0];
- for (MessageContextFactory factory : ServiceFinder.find(MessageContextFactory.class, cl)) {
- final MessageContext messageContext = creator.create(factory);
- if (messageContext != null)
- return messageContext;
- }
- return creator.create(DEFAULT);
- }
-
- /**
- * @deprecated
- */
- private static interface Creator {
- public MessageContext create(MessageContextFactory f);
- }
-
protected abstract MessageContextFactory newFactory(WebServiceFeature ... f);
+ public abstract MessageContext createContext();
+
public abstract MessageContext createContext(SOAPMessage m);
public abstract MessageContext createContext(Source m);
@@ -128,6 +53,12 @@ public abstract class MessageContextFactory
public abstract MessageContext createContext(InputStream in, String contentType) throws IOException;
+ /**
+ * @deprecated http://java.net/jira/browse/JAX_WS-1077
+ */
+ @Deprecated
+ public abstract MessageContext createContext(InputStream in, MimeHeaders headers) throws IOException;
+
static public MessageContextFactory createFactory(WebServiceFeature ... f) {
return createFactory(null, f);
}
@@ -139,4 +70,61 @@ public abstract class MessageContextFactory
}
return new com.sun.xml.internal.ws.api.message.MessageContextFactory(f);
}
+
+ @Deprecated
+ public abstract MessageContext doCreate();
+
+ @Deprecated
+ public abstract MessageContext doCreate(SOAPMessage m);
+
+ //public abstract MessageContext doCreate(InputStream x);
+
+ @Deprecated
+ public abstract MessageContext doCreate(Source x, SOAPVersion soapVersion);
+
+ @Deprecated
+ public static MessageContext create(final ClassLoader... classLoader) {
+ return serviceFinder(classLoader,
+ new Creator() {
+ public MessageContext create(final MessageContextFactory f) {
+ return f.doCreate();
+ }
+ });
+ }
+
+ @Deprecated
+ public static MessageContext create(final SOAPMessage m, final ClassLoader... classLoader) {
+ return serviceFinder(classLoader,
+ new Creator() {
+ public MessageContext create(final MessageContextFactory f) {
+ return f.doCreate(m);
+ }
+ });
+ }
+
+ @Deprecated
+ public static MessageContext create(final Source m, final SOAPVersion v, final ClassLoader... classLoader) {
+ return serviceFinder(classLoader,
+ new Creator() {
+ public MessageContext create(final MessageContextFactory f) {
+ return f.doCreate(m, v);
+ }
+ });
+ }
+
+ @Deprecated
+ private static MessageContext serviceFinder(final ClassLoader[] classLoader, final Creator creator) {
+ final ClassLoader cl = classLoader.length == 0 ? null : classLoader[0];
+ for (MessageContextFactory factory : ServiceFinder.find(MessageContextFactory.class, cl)) {
+ final MessageContext messageContext = creator.create(factory);
+ if (messageContext != null)
+ return messageContext;
+ }
+ return creator.create(DEFAULT);
+ }
+
+ @Deprecated
+ private static interface Creator {
+ public MessageContext create(MessageContextFactory f);
+ }
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/PropertySet.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/PropertySet.java
similarity index 79%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/PropertySet.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/PropertySet.java
index 179aaec9a86..64c14bfaf4b 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/ws/message/PropertySet.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/PropertySet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -23,7 +23,7 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.ws.message;
+package com.oracle.webservices.internal.api.message;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
@@ -109,8 +109,26 @@ public interface PropertySet {
* However, this map may not pick up changes made
* to {@link PropertySet} after the view is created.
*
+ * @deprecated use newer implementation {@link com.sun.xml.internal.ws.api.PropertySet#asMap()} which produces
+ * readwrite {@link Map}
+ *
* @return
* always non-null valid instance.
*/
+ @Deprecated
public Map createMapView();
+
+ /**
+ * Creates a modifiable {@link Map} view of this {@link PropertySet}.
+ *
+ * Changes done on this {@link Map} or on {@link PropertySet} object work in both directions - values made to
+ * {@link Map} are reflected to {@link PropertySet} and changes done using getters/setters on {@link PropertySet}
+ * object are automatically reflected in this {@link Map}.
+ *
+ * If necessary, it also can hold other values (not present on {@link PropertySet}) -
+ * {@see PropertySet#mapAllowsAdditionalProperties}
+ *
+ * @return always non-null valid instance.
+ */
+ public Map asMap();
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/ReadOnlyPropertyException.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/ReadOnlyPropertyException.java
similarity index 91%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/ReadOnlyPropertyException.java
rename to jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/ReadOnlyPropertyException.java
index e15eccb5eb0..5cf99e2f159 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/ReadOnlyPropertyException.java
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/message/ReadOnlyPropertyException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -23,9 +23,7 @@
* questions.
*/
-package com.sun.xml.internal.ws.util;
-
-import com.sun.xml.internal.ws.api.PropertySet;
+package com.oracle.webservices.internal.api.message;
/**
* Used to indicate that {@link PropertySet#put(String, Object)} failed
diff --git a/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/impl/encoding/StreamDecoderImpl.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/impl/encoding/StreamDecoderImpl.java
new file mode 100644
index 00000000000..28b3502cfdb
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/impl/encoding/StreamDecoderImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1997, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 com.oracle.webservices.internal.impl.encoding;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLStreamReader;
+
+import com.oracle.webservices.internal.impl.internalspi.encoding.StreamDecoder;
+
+import com.sun.xml.internal.ws.api.SOAPVersion;
+import com.sun.xml.internal.ws.api.message.AttachmentSet;
+import com.sun.xml.internal.ws.api.message.Message;
+import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
+import com.sun.xml.internal.ws.encoding.StreamSOAPCodec;
+import com.sun.xml.internal.ws.streaming.TidyXMLStreamReader;
+
+public class StreamDecoderImpl implements StreamDecoder {
+
+ @Override
+ public Message decode(InputStream in, String charset,
+ AttachmentSet att, SOAPVersion soapVersion) throws IOException {
+ XMLStreamReader reader = XMLStreamReaderFactory.create(null, in, charset, true);
+ reader = new TidyXMLStreamReader(reader, in);
+ return StreamSOAPCodec.decode(soapVersion, reader, att);
+ }
+
+}
diff --git a/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/impl/internalspi/encoding/StreamDecoder.java b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/impl/internalspi/encoding/StreamDecoder.java
new file mode 100644
index 00000000000..a04ba43d948
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/impl/internalspi/encoding/StreamDecoder.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1997, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 com.oracle.webservices.internal.impl.internalspi.encoding;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import com.sun.xml.internal.ws.api.SOAPVersion;
+import com.sun.xml.internal.ws.api.message.AttachmentSet;
+import com.sun.xml.internal.ws.api.message.Message;
+
+/**
+ * Decodes SOAPEnvelope read from an InputStream into a Message instance.
+ * This SPI allows for other implementations instead of the default, which is based on XMLStreamReader.
+ *
+ * @since 2.2.9
+ */
+public interface StreamDecoder {
+ Message decode(
+ InputStream in, String charset,
+ AttachmentSet att, SOAPVersion soapVersion) throws IOException;
+}
diff --git a/jaxws/src/share/jaxws_classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/ExistingAnnotationsType.java b/jaxws/src/share/jaxws_classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/ExistingAnnotationsType.java
new file mode 100644
index 00000000000..58cb4715a85
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/ExistingAnnotationsType.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2012, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 com.oracle.xmlns.internal.webservices.jaxws_databinding;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * This file was generated by JAXB-RI v2.2.6 and afterwards modified
+ * to implement appropriate Annotation
+ *
+ *
Java class for existing-annotations-type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ */
+@XmlType(name = "existing-annotations-type")
+@XmlEnum
+public enum ExistingAnnotationsType {
+
+ @XmlEnumValue("merge")
+ MERGE("merge"),
+ @XmlEnumValue("ignore")
+ IGNORE("ignore");
+ private final String value;
+
+ ExistingAnnotationsType(String v) {
+ value = v;
+ }
+
+ public String value() {
+ return value;
+ }
+
+ public static ExistingAnnotationsType fromValue(String v) {
+ for (ExistingAnnotationsType c: ExistingAnnotationsType.values()) {
+ if (c.value.equals(v)) {
+ return c;
+ }
+ }
+ throw new IllegalArgumentException(v);
+ }
+
+}
diff --git a/jaxws/src/share/jaxws_classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/JavaMethod.java b/jaxws/src/share/jaxws_classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/JavaMethod.java
new file mode 100644
index 00000000000..e2a1bdeecc6
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/JavaMethod.java
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2012, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 com.oracle.xmlns.internal.webservices.jaxws_databinding;
+import org.w3c.dom.Element;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlElementRefs;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * This file was generated by JAXB-RI v2.2.6 and afterwards modified
+ * to implement appropriate Annotation
+ *
+ *
Java class for anonymous complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *