This commit is contained in:
Lana Steuck 2013-04-30 22:43:02 -07:00
commit 1e981ec895
253 changed files with 4806 additions and 5227 deletions

View File

@ -207,3 +207,4 @@ e41d716405b209d3eddef8bd4240cec2bd34dcca jdk8-b81
bcebd3fdefc91abb9d7fa0c5af6211b3f8720da6 jdk8-b83 bcebd3fdefc91abb9d7fa0c5af6211b3f8720da6 jdk8-b83
d7ad0dfaa41151bd3a9ae46725b0aec3730a9cd0 jdk8-b84 d7ad0dfaa41151bd3a9ae46725b0aec3730a9cd0 jdk8-b84
1872c12529090e1c1dbf567f02ad7ae6231b8f0c jdk8-b85 1872c12529090e1c1dbf567f02ad7ae6231b8f0c jdk8-b85
da9a4c9312816451884aa6db6f18be51a07bff13 jdk8-b86

View File

@ -207,3 +207,4 @@ fd1a5574cf68af24bfd52decc37ac6361afb278a jdk8-b78
466685ba01bfb7bc1e1ac61490fd8c0f3cc18763 jdk8-b83 466685ba01bfb7bc1e1ac61490fd8c0f3cc18763 jdk8-b83
01f631f89fa392b4e484d0812c40ea8f9d2353aa jdk8-b84 01f631f89fa392b4e484d0812c40ea8f9d2353aa jdk8-b84
7fc358f5943676b82f1dccd3152b1ac07d92e38b jdk8-b85 7fc358f5943676b82f1dccd3152b1ac07d92e38b jdk8-b85
df9b5240f0a76c91cfe1a5b39da4d08df56e05be jdk8-b86

View File

@ -207,3 +207,4 @@ e41fb1aa0329767b2737303c994e38bede1baa07 jdk8-b79
a45bb25a67c7517b45f00c9682e317f46fecbba9 jdk8-b83 a45bb25a67c7517b45f00c9682e317f46fecbba9 jdk8-b83
928f8b888deb785cbd7bbd5f951cd6880f11f14e jdk8-b84 928f8b888deb785cbd7bbd5f951cd6880f11f14e jdk8-b84
9583a6431596bac1959d2d8828f5ea217843dd12 jdk8-b85 9583a6431596bac1959d2d8828f5ea217843dd12 jdk8-b85
44a8ce4a759f2668ff434661a93ff462ea472478 jdk8-b86

View File

@ -333,3 +333,4 @@ a947f40fb536e5b9e0aa210cf26abb430f80887a hs25-b26
42fe530cd478744a4d12a0cbf803f0fc804bab1a jdk8-b85 42fe530cd478744a4d12a0cbf803f0fc804bab1a jdk8-b85
09b0d3e9ba6cdf7da07d4010d2d1df14596f6864 hs25-b27 09b0d3e9ba6cdf7da07d4010d2d1df14596f6864 hs25-b27
6d88a566d369f6a1f86912cad7d0912686b2fda1 hs25-b28 6d88a566d369f6a1f86912cad7d0912686b2fda1 hs25-b28
86db4847f195c0ecceea646431f1ff22d56282e8 jdk8-b86

View File

@ -207,3 +207,4 @@ d5a58291f09a5081eaf22c2a6ab2f9ced4b78882 jdk8-b82
a46d69a1a8ec9652a48114823535372e1c980799 jdk8-b83 a46d69a1a8ec9652a48114823535372e1c980799 jdk8-b83
f5f40094ffcc1230e2a5f76ea4c968645369be6c jdk8-b84 f5f40094ffcc1230e2a5f76ea4c968645369be6c jdk8-b84
41b50e2c5ea3f4aa1af729e1deb1678cb3e1ef9c jdk8-b85 41b50e2c5ea3f4aa1af729e1deb1678cb3e1ef9c jdk8-b85
ca71ec37b2efc9c3f0971ebabb3a6eb1213d76de jdk8-b86

View File

@ -63,6 +63,7 @@ import com.sun.org.apache.bcel.internal.util.SyntheticRepository;
import com.sun.org.apache.bcel.internal.util.ClassVector; import com.sun.org.apache.bcel.internal.util.ClassVector;
import com.sun.org.apache.bcel.internal.util.ClassQueue; import com.sun.org.apache.bcel.internal.util.ClassQueue;
import com.sun.org.apache.bcel.internal.generic.Type; import com.sun.org.apache.bcel.internal.generic.Type;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.*; import java.io.*;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@ -77,6 +78,7 @@ import java.util.StringTokenizer;
* class file. Those interested in programatically generating classes * class file. Those interested in programatically generating classes
* should see the <a href="../generic/ClassGen.html">ClassGen</a> class. * should see the <a href="../generic/ClassGen.html">ClassGen</a> class.
* @version $Id: JavaClass.java,v 1.4 2007-07-19 04:34:42 ofung Exp $
* @see com.sun.org.apache.bcel.internal.generic.ClassGen * @see com.sun.org.apache.bcel.internal.generic.ClassGen
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/ */
@ -451,9 +453,9 @@ public class JavaClass extends AccessFlags implements Cloneable, Node {
String debug = null, sep = null; String debug = null, sep = null;
try { try {
debug = System.getProperty("JavaClass.debug"); debug = SecuritySupport.getSystemProperty("JavaClass.debug");
// Get path separator either / or \ usually // Get path separator either / or \ usually
sep = System.getProperty("file.separator"); sep = SecuritySupport.getSystemProperty("file.separator");
} }
catch (SecurityException e) { catch (SecurityException e) {
// falls through // falls through

View File

@ -82,6 +82,7 @@ import com.sun.org.apache.bcel.internal.Constants;
* method in the Method's frame will jump to the appropiate method in * method in the Method's frame will jump to the appropiate method in
* the Code frame. * the Code frame.
* *
* @version $Id: Class2HTML.java,v 1.3 2007-07-19 04:34:52 ofung Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/ */
public class Class2HTML implements Constants public class Class2HTML implements Constants
@ -137,7 +138,7 @@ public class Class2HTML implements Constants
ClassParser parser=null; ClassParser parser=null;
JavaClass java_class=null; JavaClass java_class=null;
String zip_file = null; String zip_file = null;
char sep = System.getProperty("file.separator").toCharArray()[0]; char sep = SecuritySupport.getSystemProperty("file.separator").toCharArray()[0];
String dir = "." + sep; // Where to store HTML files String dir = "." + sep; // Where to store HTML files
try { try {

View File

@ -66,6 +66,7 @@ import java.io.*;
* Responsible for loading (class) files from the CLASSPATH. Inspired by * Responsible for loading (class) files from the CLASSPATH. Inspired by
* sun.tools.ClassPath. * sun.tools.ClassPath.
* *
* @version $Id: ClassPath.java,v 1.4 2007-07-19 04:34:52 ofung Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/ */
public class ClassPath implements Serializable { public class ClassPath implements Serializable {
@ -83,7 +84,7 @@ public class ClassPath implements Serializable {
ArrayList vec = new ArrayList(); ArrayList vec = new ArrayList();
for(StringTokenizer tok=new StringTokenizer(class_path, for(StringTokenizer tok=new StringTokenizer(class_path,
System.getProperty("path.separator")); SecuritySupport.getSystemProperty("path.separator"));
tok.hasMoreTokens();) tok.hasMoreTokens();)
{ {
String path = tok.nextToken(); String path = tok.nextToken();
@ -92,7 +93,7 @@ public class ClassPath implements Serializable {
File file = new File(path); File file = new File(path);
try { try {
if(file.exists()) { if(SecuritySupport.getFileExists(file)) {
if(file.isDirectory()) if(file.isDirectory())
vec.add(new Dir(path)); vec.add(new Dir(path));
else else
@ -143,8 +144,9 @@ public class ClassPath implements Serializable {
String name = tok.nextToken(); String name = tok.nextToken();
File file = new File(name); File file = new File(name);
if(file.exists()) if(SecuritySupport.getFileExists(file)) {
list.add(name); list.add(name);
}
} }
} }
} }
@ -159,9 +161,9 @@ public class ClassPath implements Serializable {
String class_path, boot_path, ext_path; String class_path, boot_path, ext_path;
try { try {
class_path = System.getProperty("java.class.path"); class_path = SecuritySupport.getSystemProperty("java.class.path");
boot_path = System.getProperty("sun.boot.class.path"); boot_path = SecuritySupport.getSystemProperty("sun.boot.class.path");
ext_path = System.getProperty("java.ext.dirs"); ext_path = SecuritySupport.getSystemProperty("java.ext.dirs");
} }
catch (SecurityException e) { catch (SecurityException e) {
return ""; return "";
@ -176,8 +178,8 @@ public class ClassPath implements Serializable {
getPathComponents(ext_path, dirs); getPathComponents(ext_path, dirs);
for(Iterator e = dirs.iterator(); e.hasNext(); ) { for(Iterator e = dirs.iterator(); e.hasNext(); ) {
File ext_dir = new File((String)e.next()); File ext_dir = new File((String)e.next());
String[] extensions = ext_dir.list(new FilenameFilter() { String[] extensions = SecuritySupport.getFileList(ext_dir, new FilenameFilter() {
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
name = name.toLowerCase(); name = name.toLowerCase();
return name.endsWith(".zip") || name.endsWith(".jar"); return name.endsWith(".zip") || name.endsWith(".jar");
@ -342,7 +344,7 @@ public class ClassPath implements Serializable {
final File file = new File(dir + File.separatorChar + final File file = new File(dir + File.separatorChar +
name.replace('.', File.separatorChar) + suffix); name.replace('.', File.separatorChar) + suffix);
return file.exists()? new ClassFile() { return SecuritySupport.getFileExists(file)? new ClassFile() {
public InputStream getInputStream() throws IOException { return new FileInputStream(file); } public InputStream getInputStream() throws IOException { return new FileInputStream(file); }
public String getPath() { try { public String getPath() { try {

View File

@ -72,6 +72,7 @@ import java.lang.reflect.*;
* <pre>java com.sun.org.apache.bcel.internal.util.JavaWrapper -Dbcel.classloader=foo.MyLoader &lt;real.class.name&gt; [arguments]</pre> * <pre>java com.sun.org.apache.bcel.internal.util.JavaWrapper -Dbcel.classloader=foo.MyLoader &lt;real.class.name&gt; [arguments]</pre>
* </p> * </p>
* *
* @version $Id: JavaWrapper.java,v 1.3 2007-07-19 04:34:52 ofung Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see ClassLoader * @see ClassLoader
*/ */
@ -79,7 +80,7 @@ public class JavaWrapper {
private java.lang.ClassLoader loader; private java.lang.ClassLoader loader;
private static java.lang.ClassLoader getClassLoader() { private static java.lang.ClassLoader getClassLoader() {
String s = System.getProperty("bcel.classloader"); String s = SecuritySupport.getSystemProperty("bcel.classloader");
if((s == null) || "".equals(s)) if((s == null) || "".equals(s))
s = "com.sun.org.apache.bcel.internal.util.ClassLoader"; s = "com.sun.org.apache.bcel.internal.util.ClassLoader";

View File

@ -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<ListResourceBundle>() {
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() {
}
}

View File

@ -22,68 +22,72 @@
*/ */
package com.sun.org.apache.xalan.internal.res; package com.sun.org.apache.xalan.internal.res;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import com.sun.org.apache.xpath.internal.res.XPATHMessages; import com.sun.org.apache.xpath.internal.res.XPATHMessages;
/** /**
* Sets things up for issuing error messages. This class is misnamed, and * Sets things up for issuing error messages. This class is misnamed, and should
* should be called XalanMessages, or some such. * be called XalanMessages, or some such.
*
* @xsl.usage internal * @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 = * Creates a message from the specified key and replacement arguments,
"com.sun.org.apache.xalan.internal.res.XSLTErrorResources"; * localized to the given locale.
*
/** * @param msgKey The key for the message text.
* Creates a message from the specified key and replacement * @param args The arguments to be used as replacement text in the message
* arguments, localized to the given locale. * created.
* *
* @param msgKey The key for the message text. * @return The formatted message string.
* @param args The arguments to be used as replacement text */
* in the message created. public static String createMessage(String msgKey, Object args[]) //throws Exception
*
* @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)
{ {
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 * Creates a message from the specified key and replacement arguments,
* arguments, localized to the given locale. * localized to the given locale.
* *
* @param msgKey The key for the message text. * @param msgKey The key for the message text.
* @param args The arguments to be used as replacement text * @param args The arguments to be used as replacement text in the message
* in the message created. * created.
* *
* @return The formatted warning string. * @return The formatted warning string.
*/ */
public static final String createWarning(String msgKey, Object args[]) //throws Exception public static String createWarning(String msgKey, Object args[]) //throws Exception
{
if (XSLTBundle == null)
XSLTBundle = loadResourceBundle(XSLT_ERROR_RESOURCES);
if (XSLTBundle != null)
{ {
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.";
}
} }

View File

@ -1448,68 +1448,4 @@ public class XSLTErrorResources extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN "; 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;
}
}

View File

@ -1448,68 +1448,4 @@ public class XSLTErrorResources_de extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN "; 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;
}
}

View File

@ -1448,68 +1448,4 @@ public class XSLTErrorResources_es extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN "; 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;
}
}

View File

@ -1448,68 +1448,4 @@ public class XSLTErrorResources_fr extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN "; 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;
}
}

View File

@ -1448,68 +1448,4 @@ public class XSLTErrorResources_it extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN "; 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;
}
}

View File

@ -1448,68 +1448,4 @@ public class XSLTErrorResources_ja extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN "; 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;
}
}

View File

@ -1448,68 +1448,4 @@ public class XSLTErrorResources_ko extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN "; 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;
}
}

View File

@ -1449,68 +1449,5 @@ public class XSLTErrorResources_pt_BR extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

View File

@ -1448,68 +1448,4 @@ public class XSLTErrorResources_sv extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN "; 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;
}
}

View File

@ -1448,68 +1448,4 @@ public class XSLTErrorResources_zh_CN extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN "; 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;
}
}

View File

@ -1448,68 +1448,4 @@ public class XSLTErrorResources_zh_TW extends ListResourceBundle
public static final String QUERY_HEADER = "PATTERN "; 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;
}
}

View File

@ -54,6 +54,8 @@ public class ObjectFactory {
// //
// Constants // 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 // name of default properties file to look for in JDK's jre/lib directory
private static final String DEFAULT_PROPERTIES_FILENAME = 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. //class. Restrict the access to the package classes as specified in java.security policy.
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
try{ try{
if (security != null){ if (security != null){
if (className.startsWith(XALAN_INTERNAL) ||
className.startsWith(XERCES_INTERNAL)) {
cl = null;
} else {
final int lastDot = className.lastIndexOf("."); final int lastDot = className.lastIndexOf(".");
String packageName = className; String packageName = className;
if (lastDot != -1) packageName = className.substring(0, lastDot); if (lastDot != -1) packageName = className.substring(0, lastDot);
security.checkPackageAccess(packageName); security.checkPackageAccess(packageName);
} }
}
}catch(SecurityException e){ }catch(SecurityException e){
throw e; throw e;
} }

View File

@ -32,10 +32,14 @@ import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.PrivilegedActionException; import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction; 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. * This class is duplicated for each subpackage so keep it in sync. It is
* It is package private and therefore is not exposed as part of any API. * package private and therefore is not exposed as part of any API.
* *
* @xerces.internal * @xerces.internal
*/ */
@ -51,39 +55,39 @@ public final class SecuritySupport {
} }
static ClassLoader getContextClassLoader() { static ClassLoader getContextClassLoader() {
return (ClassLoader) return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() { public Object run() {
ClassLoader cl = null; ClassLoader cl = null;
try { try {
cl = Thread.currentThread().getContextClassLoader(); cl = Thread.currentThread().getContextClassLoader();
} catch (SecurityException ex) { } } catch (SecurityException ex) {
}
return cl; return cl;
} }
}); });
} }
static ClassLoader getSystemClassLoader() { static ClassLoader getSystemClassLoader() {
return (ClassLoader) return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() { public Object run() {
ClassLoader cl = null; ClassLoader cl = null;
try { try {
cl = ClassLoader.getSystemClassLoader(); cl = ClassLoader.getSystemClassLoader();
} catch (SecurityException ex) {} } catch (SecurityException ex) {
}
return cl; return cl;
} }
}); });
} }
static ClassLoader getParentClassLoader(final ClassLoader cl) { static ClassLoader getParentClassLoader(final ClassLoader cl) {
return (ClassLoader) return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() { public Object run() {
ClassLoader parent = null; ClassLoader parent = null;
try { try {
parent = cl.getParent(); parent = cl.getParent();
} catch (SecurityException ex) {} } catch (SecurityException ex) {
}
// eliminate loops in case of the boot // eliminate loops in case of the boot
// ClassLoader returning itself as a parent // ClassLoader returning itself as a parent
@ -93,20 +97,25 @@ public final class SecuritySupport {
} }
public static String getSystemProperty(final String propName) { public static String getSystemProperty(final String propName) {
return (String) return (String) AccessController.doPrivileged(new PrivilegedAction() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() { public Object run() {
return System.getProperty(propName); 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) static FileInputStream getFileInputStream(final File file)
throws FileNotFoundException throws FileNotFoundException {
{
try { try {
return (FileInputStream) return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws FileNotFoundException { public Object run() throws FileNotFoundException {
return new FileInputStream(file); return new FileInputStream(file);
} }
@ -115,9 +124,10 @@ public final class SecuritySupport {
throw (FileNotFoundException)e.getException(); throw (FileNotFoundException)e.getException();
} }
} }
/** /**
* Return resource using the same classloader for the ObjectFactory by default * Return resource using the same classloader for the ObjectFactory by
* or bootclassloader when Security Manager is in place * default or bootclassloader when Security Manager is in place
*/ */
public static InputStream getResourceAsStream(final String name) { public static InputStream getResourceAsStream(final String name) {
if (System.getSecurityManager()!=null) { if (System.getSecurityManager()!=null) {
@ -128,10 +138,8 @@ public final class SecuritySupport {
} }
public static InputStream getResourceAsStream(final ClassLoader cl, public static InputStream getResourceAsStream(final ClassLoader cl,
final String name) final String name) {
{ return (InputStream) AccessController.doPrivileged(new PrivilegedAction() {
return (InputStream)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() { public Object run() {
InputStream ris; InputStream ris;
if (cl == null) { if (cl == null) {
@ -144,9 +152,40 @@ public final class SecuritySupport {
}); });
} }
static boolean getFileExists(final File f) { /**
return ((Boolean) * Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
AccessController.doPrivileged(new PrivilegedAction() { * @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<ListResourceBundle>() {
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() { public Object run() {
return f.exists() ? Boolean.TRUE : Boolean.FALSE; return f.exists() ? Boolean.TRUE : Boolean.FALSE;
} }
@ -154,13 +193,14 @@ public final class SecuritySupport {
} }
static long getLastModified(final File f) { static long getLastModified(final File f) {
return ((Long) return ((Long) AccessController.doPrivileged(new PrivilegedAction() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() { public Object run() {
return new Long(f.lastModified()); return new Long(f.lastModified());
} }
})).longValue(); })).longValue();
} }
private SecuritySupport () {}
private SecuritySupport() {
}
} }

View File

@ -23,6 +23,7 @@
package com.sun.org.apache.xalan.internal.xslt; 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.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
@ -574,7 +575,7 @@ public class EnvironmentCheck
// Grab java version for later use // Grab java version for later use
try try
{ {
String javaVersion = System.getProperty("java.version"); String javaVersion = SecuritySupport.getSystemProperty("java.version");
h.put("java.version", javaVersion); h.put("java.version", javaVersion);
} }
@ -593,7 +594,7 @@ public class EnvironmentCheck
{ {
// This is present in all JVM's // 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); h.put("java.class.path", cp);
@ -603,7 +604,7 @@ public class EnvironmentCheck
h.put(FOUNDCLASSES + "java.class.path", classpathJars); h.put(FOUNDCLASSES + "java.class.path", classpathJars);
// Also check for JDK 1.2+ type classpaths // 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) if (null != othercp)
{ {
@ -617,7 +618,7 @@ public class EnvironmentCheck
//@todo NOTE: We don't actually search java.ext.dirs for //@todo NOTE: We don't actually search java.ext.dirs for
// *.jar files therein! This should be updated // *.jar files therein! This should be updated
othercp = System.getProperty("java.ext.dirs"); othercp = SecuritySupport.getSystemProperty("java.ext.dirs");
if (null != othercp) if (null != othercp)
{ {

View File

@ -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.res.XSLTErrorResources;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory; 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.ConfigurationError;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
//J2SE does not support Xalan interpretive //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 diagnosticsWriter = new PrintWriter(System.err, true);
java.io.PrintWriter dumpWriter = diagnosticsWriter; java.io.PrintWriter dumpWriter = diagnosticsWriter;
ResourceBundle resbundle = ResourceBundle resbundle =
(XSLMessages.loadResourceBundle( (SecuritySupport.getResourceBundle(
com.sun.org.apache.xml.internal.utils.res.XResourceBundle.ERROR_RESOURCES)); com.sun.org.apache.xml.internal.utils.res.XResourceBundle.ERROR_RESOURCES));
String flavor = "s2s"; String flavor = "s2s";

View File

@ -410,7 +410,7 @@ public class Parser implements Constants, ContentHandler {
} }
} }
catch (TypeCheckError e) { 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) { catch (IOException e) {
if (_xsltc.debug()) e.printStackTrace(); if (_xsltc.debug()) e.printStackTrace();
reportError(ERROR,new ErrorMsg(e)); reportError(ERROR,new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
} }
catch (SAXException e) { catch (SAXException e) {
Throwable ex = e.getException(); Throwable ex = e.getException();
@ -438,15 +438,15 @@ public class Parser implements Constants, ContentHandler {
e.printStackTrace(); e.printStackTrace();
if (ex != null) ex.printStackTrace(); if (ex != null) ex.printStackTrace();
} }
reportError(ERROR, new ErrorMsg(e)); reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
} }
catch (CompilerException e) { catch (CompilerException e) {
if (_xsltc.debug()) e.printStackTrace(); if (_xsltc.debug()) e.printStackTrace();
reportError(ERROR, new ErrorMsg(e)); reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
} }
catch (Exception e) { catch (Exception e) {
if (_xsltc.debug()) e.printStackTrace(); if (_xsltc.debug()) e.printStackTrace();
reportError(ERROR, new ErrorMsg(e)); reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
} }
return null; return null;
} }

View File

@ -41,10 +41,12 @@ import java.util.jar.JarOutputStream;
import java.util.jar.Manifest; import java.util.jar.Manifest;
import com.sun.org.apache.bcel.internal.classfile.JavaClass; 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.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util; 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.xml.internal.dtm.DTM;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
@ -278,7 +280,7 @@ public final class XSLTC {
return compile(input, _className); return compile(input, _className);
} }
catch (IOException e) { catch (IOException e) {
_parser.reportError(Constants.FATAL, new ErrorMsg(e)); _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
return false; return false;
} }
} }
@ -297,7 +299,7 @@ public final class XSLTC {
return compile(input, name); return compile(input, name);
} }
catch (IOException e) { catch (IOException e) {
_parser.reportError(Constants.FATAL, new ErrorMsg(e)); _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
return false; return false;
} }
} }
@ -382,11 +384,11 @@ public final class XSLTC {
} }
catch (Exception e) { catch (Exception e) {
/*if (_debug)*/ e.printStackTrace(); /*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) { catch (Error e) {
if (_debug) e.printStackTrace(); if (_debug) e.printStackTrace();
_parser.reportError(Constants.FATAL, new ErrorMsg(e)); _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
} }
finally { finally {
_reader = null; // reset this here to be sure it is not re-used _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) { public boolean setDestDirectory(String dstDirName) {
final File dir = new File(dstDirName); final File dir = new File(dstDirName);
if (dir.exists() || dir.mkdirs()) { if (SecuritySupport.getFileExists(dir) || dir.mkdirs()) {
_destDir = dir; _destDir = dir;
return true; return true;
} }
@ -767,7 +769,7 @@ public final class XSLTC {
String parentDir = outFile.getParent(); String parentDir = outFile.getParent();
if (parentDir != null) { if (parentDir != null) {
File parentFile = new File(parentDir); File parentFile = new File(parentDir);
if (!parentFile.exists()) if (!SecuritySupport.getFileExists(parentFile))
parentFile.mkdirs(); parentFile.mkdirs();
} }
} }

View File

@ -997,7 +997,12 @@ public class ErrorMessages extends ListResourceBundle {
"kilobytes. This is usually caused by templates in a stylesheet " + "kilobytes. This is usually caused by templates in a stylesheet " +
"that are very large. Try restructuring your stylesheet to use " + "that are very large. Try restructuring your stylesheet to use " +
"smaller templates." "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."}
}; };

View File

@ -23,6 +23,7 @@
package com.sun.org.apache.xalan.internal.xsltc.compiler.util; 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.text.MessageFormat;
import java.util.Locale; import java.util.Locale;
import java.util.ResourceBundle; import java.util.ResourceBundle;
@ -46,6 +47,8 @@ public final class ErrorMsg {
Object[] _params = null; Object[] _params = null;
private boolean _isWarningError; private boolean _isWarningError;
Throwable _cause;
// Compiler error messages // Compiler error messages
public static final String MULTIPLE_STYLESHEET_ERR = "MULTIPLE_STYLESHEET_ERR"; public static final String MULTIPLE_STYLESHEET_ERR = "MULTIPLE_STYLESHEET_ERR";
public static final String TEMPLATE_REDEF_ERR = "TEMPLATE_REDEF_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 = public static final String OUTLINE_ERR_METHOD_TOO_BIG =
"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. // All error messages are localized and are stored in resource bundles.
// This array and the following 4 strings are read from that bundle. // This array and the following 4 strings are read from that bundle.
private static ResourceBundle _bundle; private static ResourceBundle _bundle;
@ -175,7 +180,7 @@ public final class ErrorMsg {
public final static String RUNTIME_ERROR_KEY = "RUNTIME_ERROR_KEY"; public final static String RUNTIME_ERROR_KEY = "RUNTIME_ERROR_KEY";
static { static {
_bundle = ResourceBundle.getBundle( _bundle = SecuritySupport.getResourceBundle(
"com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMessages", "com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMessages",
Locale.getDefault()); Locale.getDefault());
} }
@ -185,10 +190,11 @@ public final class ErrorMsg {
_line = 0; _line = 0;
} }
public ErrorMsg(Throwable e) { public ErrorMsg(String code, Throwable e) {
_code = null; _code = code;
_message = e.getMessage(); _message = e.getMessage();
_line = 0; _line = 0;
_cause = e;
} }
public ErrorMsg(String message, int line) { public ErrorMsg(String message, int line) {
@ -240,6 +246,10 @@ public final class ErrorMsg {
_params[1] = param2; _params[1] = param2;
} }
public Throwable getCause() {
return _cause;
}
private String getFileName(SyntaxTreeNode node) { private String getFileName(SyntaxTreeNode node) {
Stylesheet stylesheet = node.getStylesheet(); Stylesheet stylesheet = node.getStylesheet();
if (stylesheet != null) if (stylesheet != null)

View File

@ -26,6 +26,7 @@ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import com.sun.org.apache.bcel.internal.generic.Type; 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.xalan.internal.xsltc.compiler.Constants;
import com.sun.org.apache.xml.internal.utils.XML11Char; import com.sun.org.apache.xml.internal.utils.XML11Char;
@ -37,7 +38,7 @@ public final class Util {
private static char filesep; private static char filesep;
static { static {
String temp = System.getProperty("file.separator", "/"); String temp = SecuritySupport.getSystemProperty("file.separator", "/");
filesep = temp.charAt(0); filesep = temp.charAt(0);
} }

View File

@ -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.xalan.internal.xsltc.runtime.AbstractTranslet;
import com.sun.org.apache.xml.internal.utils.StringComparable; 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.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
/** /**
* Base class for sort records containing application specific sort keys * Base class for sort records containing application specific sort keys
@ -112,7 +113,7 @@ public abstract class NodeSortRecord {
try { try {
// -- W. Eliot Kimber (eliot@isogen.com) // -- W. Eliot Kimber (eliot@isogen.com)
colFactClassname = 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) { catch (SecurityException e) {
// If we can't read the propery, just use default collator // If we can't read the propery, just use default collator

View File

@ -23,6 +23,7 @@
package com.sun.org.apache.xalan.internal.xsltc.runtime; 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.DecimalFormat;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
import java.text.FieldPosition; import java.text.FieldPosition;
@ -1583,7 +1584,7 @@ public final class BasisLibrary {
static { static {
String resource = "com.sun.org.apache.xalan.internal.xsltc.runtime.ErrorMessages"; String resource = "com.sun.org.apache.xalan.internal.xsltc.runtime.ErrorMessages";
m_bundle = ResourceBundle.getBundle(resource); m_bundle = SecuritySupport.getResourceBundle(resource);
} }
/** /**

View File

@ -23,6 +23,7 @@
package com.sun.org.apache.xalan.internal.xsltc.runtime.output; 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.BufferedWriter;
import java.io.IOException; import java.io.IOException;
import java.io.Writer; import java.io.Writer;
@ -36,7 +37,7 @@ class WriterOutputBuffer implements OutputBuffer {
static { static {
// Set a larger buffer size for Solaris // 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")) { if (osName.equalsIgnoreCase("solaris")) {
BUFFER_SIZE = 32 * KB; BUFFER_SIZE = 32 * KB;
} }

View File

@ -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.AbstractTranslet;
import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable; 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.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
/** /**
* @author Morten Jorgensen * @author Morten Jorgensen
@ -52,6 +53,8 @@ import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
*/ */
public final class TemplatesImpl implements Templates, Serializable { public final class TemplatesImpl implements Templates, Serializable {
static final long serialVersionUID = 673094361519270707L; 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 * Name of the superclass of all translets. This is needed to
* determine which, among all classes comprising a translet, * determine which, among all classes comprising a translet,
@ -186,6 +189,15 @@ public final class TemplatesImpl implements Templates, Serializable {
private void readObject(ObjectInputStream is) private void readObject(ObjectInputStream is)
throws IOException, ClassNotFoundException 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(); is.defaultReadObject();
if (is.readBoolean()) { if (is.readBoolean()) {
_uriResolver = (URIResolver) is.readObject(); _uriResolver = (URIResolver) is.readObject();

View File

@ -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.xsltc.dom.XSLTCDTMManager;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory; 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.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import org.xml.sax.XMLFilter; import org.xml.sax.XMLFilter;
@ -881,8 +881,14 @@ public class TransformerFactoryImpl
// Check that the transformation went well before returning // Check that the transformation went well before returning
if (bytecodes == null) { if (bytecodes == null) {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR); Vector errs = xsltc.getErrors();
TransformerConfigurationException exc = new TransformerConfigurationException(err.toString()); 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 // Pass compiler errors to the error listener
if (_errorListener != null) { if (_errorListener != null) {
@ -1229,7 +1235,7 @@ public class TransformerFactoryImpl
// Find the parent directory of the translet. // Find the parent directory of the translet.
String transletParentDir = transletFile.getParent(); String transletParentDir = transletFile.getParent();
if (transletParentDir == null) if (transletParentDir == null)
transletParentDir = System.getProperty("user.dir"); transletParentDir = SecuritySupport.getSystemProperty("user.dir");
File transletParentFile = new File(transletParentDir); File transletParentFile = new File(transletParentDir);

View File

@ -20,10 +20,10 @@
package com.sun.org.apache.xerces.internal.dom; package com.sun.org.apache.xerces.internal.dom;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale; import java.util.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
/** /**
* Used to format DOM error messages, using the system locale. * Used to format DOM error messages, using the system locale.
@ -31,6 +31,7 @@ import java.util.PropertyResourceBundle;
* @xerces.internal * @xerces.internal
* *
* @author Sandy Gao, IBM * @author Sandy Gao, IBM
* @version $Id: DOMMessageFormatter.java,v 1.6 2010-11-01 04:39:38 joehw Exp $
*/ */
public class DOMMessageFormatter { public class DOMMessageFormatter {
public static final String DOM_DOMAIN = "http://www.w3.org/dom/DOMTR"; public static final String DOM_DOMAIN = "http://www.w3.org/dom/DOMTR";
@ -122,13 +123,13 @@ public class DOMMessageFormatter {
*/ */
public static void init(){ public static void init(){
if (locale != null) { if (locale != null) {
domResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages", locale); domResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages", locale);
serResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages", locale); serResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages", locale);
xmlResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale); xmlResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
}else{ }else{
domResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages"); domResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages");
serResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages"); serResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages");
xmlResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages"); xmlResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
} }
} }

View File

@ -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.XNIException;
import com.sun.org.apache.xerces.internal.xni.parser.*; 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.impl.Constants;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.xml.internal.stream.Entity; import com.sun.xml.internal.stream.Entity;
import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.Augmentations;
@ -1727,7 +1728,7 @@ protected static final String PARSER_SETTINGS =
// get the user.dir property // get the user.dir property
String userDir = ""; String userDir = "";
try { try {
userDir = System.getProperty("user.dir"); userDir = SecuritySupport.getSystemProperty("user.dir");
} }
catch (SecurityException se) { catch (SecurityException se) {
} }

View File

@ -20,6 +20,7 @@
package com.sun.org.apache.xerces.internal.impl.dv; 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.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import java.util.MissingResourceException; import java.util.MissingResourceException;
@ -34,6 +35,7 @@ import java.util.MissingResourceException;
* *
* @author Sandy Gao, IBM * @author Sandy Gao, IBM
* *
* @version $Id: DatatypeException.java,v 1.6 2010-11-01 04:39:43 joehw Exp $
*/ */
public class DatatypeException extends Exception { public class DatatypeException extends Exception {
@ -84,7 +86,7 @@ public class DatatypeException extends Exception {
*/ */
public String getMessage() { public String getMessage() {
ResourceBundle resourceBundle = null; 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) if (resourceBundle == null)
throw new MissingResourceException("Property file not found!", "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", key); throw new MissingResourceException("Property file not found!", "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", key);

View File

@ -20,12 +20,11 @@
package com.sun.org.apache.xerces.internal.impl.msg; 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.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; 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 * 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 * @xerces.internal
* *
* @author Eric Ye, IBM * @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 { public class XMLMessageFormatter implements MessageFormatter {
@ -72,12 +71,12 @@ public class XMLMessageFormatter implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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 // format message

View File

@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter; 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 * 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 * @xerces.internal
* *
* @author Eric Ye, IBM * @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 { public class XMLMessageFormatter_de implements MessageFormatter {
@ -72,12 +73,12 @@ public class XMLMessageFormatter_de implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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 // format message

View File

@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter; 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 * 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 * @xerces.internal
* *
* @author Eric Ye, IBM * @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 { public class XMLMessageFormatter_es implements MessageFormatter {
@ -72,12 +73,12 @@ public class XMLMessageFormatter_es implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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 // format message

View File

@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter; 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 * 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 * @xerces.internal
* *
* @author Eric Ye, IBM * @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 { public class XMLMessageFormatter_fr implements MessageFormatter {
@ -72,12 +73,12 @@ public class XMLMessageFormatter_fr implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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 // format message

View File

@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter; 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 * 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 * @xerces.internal
* *
* @author Eric Ye, IBM * @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 { public class XMLMessageFormatter_it implements MessageFormatter {
@ -72,12 +73,12 @@ public class XMLMessageFormatter_it implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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 // format message

View File

@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter; 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 * 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 * @xerces.internal
* *
* @author Eric Ye, IBM * @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 { public class XMLMessageFormatter_ja implements MessageFormatter {
@ -72,12 +73,12 @@ public class XMLMessageFormatter_ja implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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 // format message

View File

@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter; 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 * 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 * @xerces.internal
* *
* @author Eric Ye, IBM * @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 { public class XMLMessageFormatter_ko implements MessageFormatter {
@ -72,12 +73,12 @@ public class XMLMessageFormatter_ko implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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 // format message

View File

@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter; 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 * 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 * @xerces.internal
* *
* @author Eric Ye, IBM * @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 { public class XMLMessageFormatter_pt_BR implements MessageFormatter {
@ -72,12 +73,12 @@ public class XMLMessageFormatter_pt_BR implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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 // format message

View File

@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter; 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 * 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 * @xerces.internal
* *
* @author Eric Ye, IBM * @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 { public class XMLMessageFormatter_sv implements MessageFormatter {
@ -72,12 +73,12 @@ public class XMLMessageFormatter_sv implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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 // format message

View File

@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter; 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 * 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 * @xerces.internal
* *
* @author Eric Ye, IBM * @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 { public class XMLMessageFormatter_zh_CN implements MessageFormatter {
@ -72,12 +73,12 @@ public class XMLMessageFormatter_zh_CN implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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 // format message

View File

@ -26,6 +26,7 @@ import java.util.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter; 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 * 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 * @xerces.internal
* *
* @author Eric Ye, IBM * @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 { public class XMLMessageFormatter_zh_TW implements MessageFormatter {
@ -72,12 +73,12 @@ public class XMLMessageFormatter_zh_TW implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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 // format message

View File

@ -20,6 +20,7 @@
package com.sun.org.apache.xerces.internal.impl.xpath.regex; 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.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
@ -95,10 +96,10 @@ class RegexParser {
public void setLocale(Locale locale) { public void setLocale(Locale locale) {
try { try {
if (locale != null) { 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 { 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) { catch (MissingResourceException mre) {

View File

@ -20,11 +20,11 @@
package com.sun.org.apache.xerces.internal.impl.xs; 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.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; 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 * @xerces.internal
* *
* @author Elena Litani, IBM * @author Elena Litani, IBM
* @version $Id: XSMessageFormatter.java,v 1.6 2010-11-01 04:39:55 joehw Exp $
*/ */
public class XSMessageFormatter implements MessageFormatter { public class XSMessageFormatter implements MessageFormatter {
/** /**
@ -66,12 +67,12 @@ public class XSMessageFormatter implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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); String msg = fResourceBundle.getString(key);

View File

@ -20,15 +20,16 @@
package com.sun.org.apache.xerces.internal.jaxp.validation; 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.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
/** /**
* <p>Used to format JAXP Validation API error messages using a specified locale.</p> * <p>Used to format JAXP Validation API error messages using a specified locale.</p>
* *
* @author Michael Glavassevich, IBM * @author Michael Glavassevich, IBM
* @version $Id: JAXPValidationMessageFormatter.java,v 1.5 2010-11-01 04:40:08 joehw Exp $
*/ */
final class JAXPValidationMessageFormatter { final class JAXPValidationMessageFormatter {
@ -54,11 +55,11 @@ final class JAXPValidationMessageFormatter {
ResourceBundle resourceBundle = null; ResourceBundle resourceBundle = null;
if (locale != null) { if (locale != null) {
resourceBundle = 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 { else {
resourceBundle = 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 // format message

View File

@ -20,15 +20,16 @@
package com.sun.org.apache.xerces.internal.util; package com.sun.org.apache.xerces.internal.util;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale; import java.util.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle; import java.util.ResourceBundle;
/** /**
* <p>Used to format JAXP 1.3 Datatype API error messages using a specified locale.</p> * <p>Used to format JAXP 1.3 Datatype API error messages using a specified locale.</p>
* *
* @author Neeraj Bajaj, Sun Microsystems * @author Neeraj Bajaj, Sun Microsystems
* @version $Id: DatatypeMessageFormatter.java,v 1.6 2010-11-01 04:40:14 joehw Exp $
*/ */
public class DatatypeMessageFormatter { public class DatatypeMessageFormatter {
@ -56,11 +57,11 @@ public class DatatypeMessageFormatter {
ResourceBundle resourceBundle = null; ResourceBundle resourceBundle = null;
if (locale != null) { if (locale != null) {
resourceBundle = resourceBundle =
PropertyResourceBundle.getBundle(BASE_NAME, locale); SecuritySupport.getResourceBundle(BASE_NAME, locale);
} }
else { else {
resourceBundle = resourceBundle =
PropertyResourceBundle.getBundle(BASE_NAME); SecuritySupport.getResourceBundle(BASE_NAME);
} }
// format message // format message

View File

@ -19,16 +19,17 @@
*/ */
package com.sun.org.apache.xerces.internal.util; package com.sun.org.apache.xerces.internal.util;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale; import java.util.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
/** /**
* Used to format SAX error messages using a specified locale. * Used to format SAX error messages using a specified locale.
* *
* @author Michael Glavassevich, IBM * @author Michael Glavassevich, IBM
* *
* @version $Id: SAXMessageFormatter.java,v 1.6 2010-11-01 04:40:14 joehw Exp $
*/ */
public class SAXMessageFormatter { public class SAXMessageFormatter {
@ -54,11 +55,11 @@ public class SAXMessageFormatter {
ResourceBundle resourceBundle = null; ResourceBundle resourceBundle = null;
if (locale != null) { if (locale != null) {
resourceBundle = 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 { else {
resourceBundle = 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 // format message

View File

@ -61,6 +61,8 @@
package com.sun.org.apache.xerces.internal.util; package com.sun.org.apache.xerces.internal.util;
import com.sun.org.apache.xerces.internal.impl.Constants; 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 * 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 * 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 * @author Neil Graham, IBM
* *
* @version $Id: SecurityManager.java,v 1.5 2010-11-01 04:40:14 joehw Exp $
*/ */
public final class SecurityManager { public final class SecurityManager {
@ -176,41 +179,48 @@ public final class SecurityManager {
private void readSystemProperties(){ private void readSystemProperties(){
//TODO: also read SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT //TODO: also read SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT
try { try {
String value = System.getProperty(Constants.ENTITY_EXPANSION_LIMIT); String value = getSystemProperty(Constants.ENTITY_EXPANSION_LIMIT);
if(value != null && !value.equals("")){ if(value != null && !value.equals("")){
entityExpansionLimit = Integer.parseInt(value); entityExpansionLimit = Integer.parseInt(value);
if (entityExpansionLimit < 0) if (entityExpansionLimit < 0)
entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
} }
else else
entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
}catch(Exception ex){} }catch(Exception ex){}
try { try {
String value = System.getProperty(Constants.MAX_OCCUR_LIMIT); String value = getSystemProperty(Constants.MAX_OCCUR_LIMIT);
if(value != null && !value.equals("")){ if(value != null && !value.equals("")){
maxOccurLimit = Integer.parseInt(value); maxOccurLimit = Integer.parseInt(value);
if (maxOccurLimit < 0) if (maxOccurLimit < 0)
maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
} }
else else
maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
}catch(Exception ex){} }catch(Exception ex){}
try { try {
String value = System.getProperty(Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT); String value = getSystemProperty(Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT);
if(value != null && !value.equals("")){ if(value != null && !value.equals("")){
fElementAttributeLimit = Integer.parseInt(value); fElementAttributeLimit = Integer.parseInt(value);
if ( fElementAttributeLimit < 0) if ( fElementAttributeLimit < 0)
fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
} }
else else
fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
}catch(Exception ex){} }catch(Exception ex){}
} }
private String getSystemProperty(final String propName) {
return AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty(propName);
}
});
}
} // class SecurityManager } // class SecurityManager

View File

@ -48,6 +48,7 @@ public final class ObjectFactory {
// //
// Constants // 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 // name of default properties file to look for in JDK's jre/lib directory
private static final String DEFAULT_PROPERTIES_FILENAME = "xerces.properties"; 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 //restrict the access to package as speicified in java.security policy
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) { if (security != null) {
final int lastDot = className.lastIndexOf("."); if (className.startsWith(DEFAULT_INTERNAL_CLASSES)) {
String packageName = className; cl = null;
if (lastDot != -1) packageName = className.substring(0, lastDot); } else {
security.checkPackageAccess(packageName); final int lastDot = className.lastIndexOf(".");
String packageName = className;
if (lastDot != -1) packageName = className.substring(0, lastDot);
security.checkPackageAccess(packageName);
}
} }
Class providerClass; Class providerClass;
if (cl == null) { if (cl == null) {

View File

@ -29,6 +29,10 @@ import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.PrivilegedActionException; import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction; 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. * 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<ResourceBundle>() {
public ResourceBundle run() {
try {
return PropertyResourceBundle.getBundle(bundle, locale);
} catch (MissingResourceException e) {
try {
return PropertyResourceBundle.getBundle(bundle, new Locale("en", "US"));
} catch (MissingResourceException e2) {
throw new MissingResourceException(
"Could not load any resource bundle by " + bundle, bundle, "");
}
}
}
});
}
static boolean getFileExists(final File f) { static boolean getFileExists(final File f) {
return ((Boolean) return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() { AccessController.doPrivileged(new PrivilegedAction() {

View File

@ -20,11 +20,11 @@
package com.sun.org.apache.xerces.internal.xinclude; 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.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
// TODO: fix error messages in XIncludeMessages.properties // TODO: fix error messages in XIncludeMessages.properties
/** /**
@ -32,6 +32,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* *
* @author Peter McCracken, IBM * @author Peter McCracken, IBM
* *
* @version $Id: XIncludeMessageFormatter.java,v 1.7 2010-11-01 04:40:18 joehw Exp $
*/ */
public class XIncludeMessageFormatter implements MessageFormatter { public class XIncludeMessageFormatter implements MessageFormatter {
@ -61,12 +62,12 @@ public class XIncludeMessageFormatter implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { 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 // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) 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); String msg = fResourceBundle.getString(key);

View File

@ -24,6 +24,7 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter; 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 * XPointerMessageFormatter provides error messages for the XPointer Framework
@ -31,6 +32,7 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
* *
* @xerces.internal * @xerces.internal
* *
* @version $Id: XPointerMessageFormatter.java,v 1.5 2010-11-01 04:40:26 joehw Exp $
*/ */
class XPointerMessageFormatter implements MessageFormatter { class XPointerMessageFormatter implements MessageFormatter {
@ -64,14 +66,14 @@ class XPointerMessageFormatter implements MessageFormatter {
if (fResourceBundle == null || locale != fLocale) { if (fResourceBundle == null || locale != fLocale) {
if (locale != null) { if (locale != null) {
fResourceBundle = PropertyResourceBundle.getBundle( fResourceBundle = SecuritySupport.getResourceBundle(
"com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages", locale); "com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages", locale);
// memorize the most-recent locale // memorize the most-recent locale
fLocale = locale; fLocale = locale;
} }
if (fResourceBundle == null) if (fResourceBundle == null)
fResourceBundle = PropertyResourceBundle fResourceBundle = SecuritySupport.getResourceBundle(
.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages"); "com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages");
} }
String msg = fResourceBundle.getString(key); String msg = fResourceBundle.getString(key);

View File

@ -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.PrefixResolver;
import com.sun.org.apache.xml.internal.utils.XMLStringFactory; 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.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
/** /**
* A DTMManager instance can be used to create DTM and * A DTMManager instance can be used to create DTM and
@ -383,7 +384,7 @@ public abstract class DTMManager
{ {
try try
{ {
debug = System.getProperty("dtm.debug") != null; debug = SecuritySupport.getSystemProperty("dtm.debug") != null;
} }
catch (SecurityException ex){} catch (SecurityException ex){}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -453,67 +450,4 @@ public class XMLErrorResources extends ListResourceBundle
return contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -443,67 +440,4 @@ public class XMLErrorResources_ca extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -443,67 +440,4 @@ public class XMLErrorResources_cs extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -453,67 +450,4 @@ public class XMLErrorResources_de extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -453,67 +450,4 @@ public class XMLErrorResources_es extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -453,67 +450,4 @@ public class XMLErrorResources_fr extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -453,67 +450,4 @@ public class XMLErrorResources_it extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -453,67 +450,4 @@ public class XMLErrorResources_ja extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -453,67 +450,4 @@ public class XMLErrorResources_ko extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -25,9 +25,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -463,67 +460,4 @@ public class XMLErrorResources_pt_BR extends ListResourceBundle
return msgCopy; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -443,67 +440,4 @@ public class XMLErrorResources_sk extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -452,68 +449,4 @@ public class XMLErrorResources_sv extends ListResourceBundle
protected Object[][] getContents() { protected Object[][] getContents() {
return _contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -443,67 +440,4 @@ public class XMLErrorResources_tr extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -453,67 +450,4 @@ public class XMLErrorResources_zh_CN extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -24,9 +24,6 @@ package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -453,67 +450,4 @@ public class XMLErrorResources_zh_TW extends ListResourceBundle
return _contents; 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;
}
} }

View File

@ -22,10 +22,9 @@
*/ */
package com.sun.org.apache.xml.internal.res; package com.sun.org.apache.xml.internal.res;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale; import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* A utility class for issuing XML error messages. * A utility class for issuing XML error messages.
@ -82,8 +81,9 @@ public class XMLMessages
*/ */
public static final String createXMLMessage(String msgKey, Object args[]) public static final String createXMLMessage(String msgKey, Object args[])
{ {
if (XMLBundle == null) if (XMLBundle == null) {
XMLBundle = loadResourceBundle(XML_ERROR_RESOURCES); XMLBundle = SecuritySupport.getResourceBundle(XML_ERROR_RESOURCES);
}
if (XMLBundle != null) if (XMLBundle != null)
{ {
@ -156,61 +156,4 @@ public class XMLMessages
return fmsg; 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;
}
} }

View File

@ -24,6 +24,7 @@
package com.sun.org.apache.xml.internal.resolver; package com.sun.org.apache.xml.internal.resolver;
import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl; 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.IOException;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.InputStream; import java.io.InputStream;
@ -821,7 +822,7 @@ public class Catalog {
// tack on a basename because URLs point to files not dirs // tack on a basename because URLs point to files not dirs
catalogCwd = FileURL.makeURL("basename"); catalogCwd = FileURL.makeURL("basename");
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
String userdir = System.getProperty("user.dir"); String userdir = SecuritySupport.getSystemProperty("user.dir");
userdir.replace('\\', '/'); userdir.replace('\\', '/');
catalogManager.debug.message(1, "Malformed URL on cwd", userdir); catalogManager.debug.message(1, "Malformed URL on cwd", userdir);
catalogCwd = null; catalogCwd = null;
@ -1717,7 +1718,7 @@ public class Catalog {
protected String resolveLocalSystem(String systemId) protected String resolveLocalSystem(String systemId)
throws MalformedURLException, IOException { throws MalformedURLException, IOException {
String osname = System.getProperty("os.name"); String osname = SecuritySupport.getSystemProperty("os.name");
boolean windows = (osname.indexOf("Windows") >= 0); boolean windows = (osname.indexOf("Windows") >= 0);
Enumeration en = catalogEntries.elements(); Enumeration en = catalogEntries.elements();
while (en.hasMoreElements()) { while (en.hasMoreElements()) {

View File

@ -23,6 +23,7 @@
package com.sun.org.apache.xml.internal.resolver; package com.sun.org.apache.xml.internal.resolver;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
@ -142,8 +143,8 @@ public class CatalogManager {
/** Flag to ignore missing property files and/or properties */ /** Flag to ignore missing property files and/or properties */
private boolean ignoreMissingProperties private boolean ignoreMissingProperties
= (System.getProperty(pIgnoreMissing) != null = (SecuritySupport.getSystemProperty(pIgnoreMissing) != null
|| System.getProperty(pFiles) != null); || SecuritySupport.getSystemProperty(pFiles) != null);
/** Holds the resources after they are loaded from the file. */ /** Holds the resources after they are loaded from the file. */
private ResourceBundle resources; private ResourceBundle resources;
@ -338,7 +339,7 @@ public class CatalogManager {
private int queryVerbosity () { private int queryVerbosity () {
String defaultVerbStr = Integer.toString(defaultVerbosity); String defaultVerbStr = Integer.toString(defaultVerbosity);
String verbStr = System.getProperty(pVerbosity); String verbStr = SecuritySupport.getSystemProperty(pVerbosity);
if (verbStr == null) { if (verbStr == null) {
if (resources==null) readProperties(); if (resources==null) readProperties();
@ -473,7 +474,7 @@ public class CatalogManager {
* @return A semicolon delimited list of catlog file URIs * @return A semicolon delimited list of catlog file URIs
*/ */
private String queryCatalogFiles () { private String queryCatalogFiles () {
String catalogList = System.getProperty(pFiles); String catalogList = SecuritySupport.getSystemProperty(pFiles);
fromPropertiesFile = false; fromPropertiesFile = false;
if (catalogList == null) { if (catalogList == null) {
@ -558,7 +559,7 @@ public class CatalogManager {
* defaultPreferSetting. * defaultPreferSetting.
*/ */
private boolean queryPreferPublic () { private boolean queryPreferPublic () {
String prefer = System.getProperty(pPrefer); String prefer = SecuritySupport.getSystemProperty(pPrefer);
if (prefer == null) { if (prefer == null) {
if (resources==null) readProperties(); if (resources==null) readProperties();
@ -617,7 +618,7 @@ public class CatalogManager {
* defaultUseStaticCatalog. * defaultUseStaticCatalog.
*/ */
private boolean queryUseStaticCatalog () { private boolean queryUseStaticCatalog () {
String staticCatalog = System.getProperty(pStatic); String staticCatalog = SecuritySupport.getSystemProperty(pStatic);
if (staticCatalog == null) { if (staticCatalog == null) {
if (resources==null) readProperties(); if (resources==null) readProperties();
@ -748,7 +749,7 @@ public class CatalogManager {
* defaultOasisXMLCatalogPI. * defaultOasisXMLCatalogPI.
*/ */
public boolean queryAllowOasisXMLCatalogPI () { public boolean queryAllowOasisXMLCatalogPI () {
String allow = System.getProperty(pAllowPI); String allow = SecuritySupport.getSystemProperty(pAllowPI);
if (allow == null) { if (allow == null) {
if (resources==null) readProperties(); if (resources==null) readProperties();
@ -804,7 +805,7 @@ public class CatalogManager {
* *
*/ */
public String queryCatalogClassName () { public String queryCatalogClassName () {
String className = System.getProperty(pClassname); String className = SecuritySupport.getSystemProperty(pClassname);
if (className == null) { if (className == null) {
if (resources==null) readProperties(); if (resources==null) readProperties();

View File

@ -33,6 +33,7 @@ import java.net.URLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;
import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl; 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.SAXCatalogReader;
import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader; import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader; import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
@ -524,7 +525,7 @@ public class Resolver extends Catalog {
*/ */
private Vector resolveAllLocalSystem(String systemId) { private Vector resolveAllLocalSystem(String systemId) {
Vector map = new Vector(); Vector map = new Vector();
String osname = System.getProperty("os.name"); String osname = SecuritySupport.getSystemProperty("os.name");
boolean windows = (osname.indexOf("Windows") >= 0); boolean windows = (osname.indexOf("Windows") >= 0);
Enumeration en = catalogEntries.elements(); Enumeration en = catalogEntries.elements();
while (en.hasMoreElements()) { while (en.hasMoreElements()) {
@ -552,7 +553,7 @@ public class Resolver extends Catalog {
*/ */
private Vector resolveLocalSystemReverse(String systemId) { private Vector resolveLocalSystemReverse(String systemId) {
Vector map = new Vector(); Vector map = new Vector();
String osname = System.getProperty("os.name"); String osname = SecuritySupport.getSystemProperty("os.name");
boolean windows = (osname.indexOf("Windows") >= 0); boolean windows = (osname.indexOf("Windows") >= 0);
Enumeration en = catalogEntries.elements(); Enumeration en = catalogEntries.elements();
while (en.hasMoreElements()) { while (en.hasMoreElements()) {

View File

@ -22,6 +22,7 @@
package com.sun.org.apache.xml.internal.serialize; 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.ObjectFactory;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.Writer; import java.io.Writer;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -64,7 +65,7 @@ public abstract class SerializerFactory
factory = new SerializerFactoryImpl( Method.TEXT ); factory = new SerializerFactoryImpl( Method.TEXT );
registerSerializerFactory( factory ); registerSerializerFactory( factory );
list = System.getProperty( FactoriesProperty ); list = SecuritySupport.getSystemProperty( FactoriesProperty );
if ( list != null ) { if ( list != null ) {
token = new StringTokenizer( list, " ;,:" ); token = new StringTokenizer( list, " ;,:" );
while ( token.hasMoreTokens() ) { while ( token.hasMoreTokens() ) {

View File

@ -219,7 +219,7 @@ public final class Encodings extends Object
// Get the default system character encoding. This may be // Get the default system character encoding. This may be
// incorrect if they passed in a writer, but right now there // incorrect if they passed in a writer, but right now there
// seems to be no way to get the encoding from a writer. // 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) if (null != encoding)
{ {
@ -313,7 +313,7 @@ public final class Encodings extends Object
try try
{ {
urlString = System.getProperty(ENCODINGS_PROP, ""); urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
} }
catch (SecurityException e) catch (SecurityException e)
{ {

View File

@ -22,6 +22,7 @@
*/ */
package com.sun.org.apache.xml.internal.serializer; package com.sun.org.apache.xml.internal.serializer;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -471,7 +472,7 @@ public final class OutputPropertiesFactory
String value = null; String value = null;
try try
{ {
value = System.getProperty(key); value = SecuritySupport.getSystemProperty(key);
} }
catch (SecurityException se) catch (SecurityException se)
{ {
@ -484,7 +485,7 @@ public final class OutputPropertiesFactory
String newValue = null; String newValue = null;
try try
{ {
newValue = System.getProperty(newKey); newValue = SecuritySupport.getSystemProperty(newKey);
} }
catch (SecurityException se) catch (SecurityException se)
{ {

View File

@ -22,6 +22,7 @@
*/ */
package com.sun.org.apache.xml.internal.serializer; package com.sun.org.apache.xml.internal.serializer;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -140,7 +141,7 @@ abstract public class ToStream extends SerializerBase
* extension attribute xalan:line-separator. * extension attribute xalan:line-separator.
*/ */
protected char[] m_lineSep = 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. * True if the the system line separator is to be used.

View File

@ -22,6 +22,7 @@
*/ */
package com.sun.org.apache.xml.internal.serializer; package com.sun.org.apache.xml.internal.serializer;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.File; import java.io.File;
import com.sun.org.apache.xml.internal.serializer.utils.AttList; import com.sun.org.apache.xml.internal.serializer.utils.AttList;
@ -104,7 +105,7 @@ public final class TreeWalker
else { else {
try { try {
// Bug see Bugzilla 26741 // 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 catch (SecurityException se) {// user.dir not accessible from applet
} }
@ -115,7 +116,7 @@ public final class TreeWalker
m_contentHandler.setDocumentLocator(m_locator); m_contentHandler.setDocumentLocator(m_locator);
try { try {
// Bug see Bugzilla 26741 // 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 catch (SecurityException se){// user.dir not accessible from applet

View File

@ -22,6 +22,7 @@
*/ */
package com.sun.org.apache.xml.internal.serializer.utils; 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.ListResourceBundle;
import java.util.Locale; import java.util.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
@ -87,9 +88,6 @@ import java.util.ResourceBundle;
* can have the Message strings translated in an alternate language * can have the Message strings translated in an alternate language
* in a errorResourceClass with a language suffix. * 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 * This class is not a public API, it is only public because it is
* used in com.sun.org.apache.xml.internal.serializer. * used in com.sun.org.apache.xml.internal.serializer.
@ -126,18 +124,6 @@ public final class Messages
m_resourceBundleName = resourceBundle; 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. * Get the Locale object that is being used.
@ -150,16 +136,6 @@ public final class Messages
return m_locale; 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 * Creates a message from the specified key and replacement
* arguments, localized to the given locale. * arguments, localized to the given locale.
@ -174,7 +150,7 @@ public final class Messages
public final String createMessage(String msgKey, Object args[]) public final String createMessage(String msgKey, Object args[])
{ {
if (m_resourceBundle == null) if (m_resourceBundle == null)
m_resourceBundle = loadResourceBundle(m_resourceBundleName); m_resourceBundle = SecuritySupport.getResourceBundle(m_resourceBundleName);
if (m_resourceBundle != null) if (m_resourceBundle != null)
{ {
@ -293,76 +269,4 @@ public final class Messages
return fmsg; 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;
}
} }

View File

@ -22,6 +22,7 @@
*/ */
package com.sun.org.apache.xml.internal.utils; package com.sun.org.apache.xml.internal.utils;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.File; import java.io.File;
import org.w3c.dom.Comment; import org.w3c.dom.Comment;
@ -93,7 +94,7 @@ public class TreeWalker
else { else {
try { try {
// Bug see Bugzilla 26741 // 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 catch (SecurityException se) {// user.dir not accessible from applet
} }
@ -112,7 +113,7 @@ public class TreeWalker
m_contentHandler.setDocumentLocator(m_locator); m_contentHandler.setDocumentLocator(m_locator);
try { try {
// Bug see Bugzilla 26741 // 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 catch (SecurityException se){// user.dir not accessible from applet
} }
@ -131,7 +132,7 @@ public class TreeWalker
m_contentHandler.setDocumentLocator(m_locator); m_contentHandler.setDocumentLocator(m_locator);
try { try {
// Bug see Bugzilla 26741 // 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 catch (SecurityException se){// user.dir not accessible from applet

View File

@ -22,6 +22,8 @@
*/ */
package com.sun.org.apache.xml.internal.utils.res; package com.sun.org.apache.xml.internal.utils.res;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale; import java.util.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
@ -29,114 +31,45 @@ import java.util.ResourceBundle;
/** /**
* The default (english) resource bundle. * The default (english) resource bundle.
*
* @xsl.usage internal * @xsl.usage internal
*/ */
public class XResourceBundle extends ListResourceBundle public class XResourceBundle extends ListResourceBundle {
{
/** Error resource constants */ /**
public static final String ERROR_RESOURCES = * Error resource constants
"com.sun.org.apache.xalan.internal.res.XSLTErrorResources", XSLT_RESOURCE = */
"com.sun.org.apache.xml.internal.utils.res.XResourceBundle", LANG_BUNDLE_NAME = public static final String ERROR_RESOURCES =
"com.sun.org.apache.xml.internal.utils.res.XResources", MULT_ORDER = "com.sun.org.apache.xalan.internal.res.XSLTErrorResources", XSLT_RESOURCE =
"multiplierOrder", MULT_PRECEDES = "precedes", MULT_FOLLOWS = "com.sun.org.apache.xml.internal.utils.res.XResourceBundle", LANG_BUNDLE_NAME =
"follows", LANG_ORIENTATION = "orientation", LANG_RIGHTTOLEFT = "com.sun.org.apache.xml.internal.utils.res.XResources", MULT_ORDER =
"rightToLeft", LANG_LEFTTORIGHT = "leftToRight", LANG_NUMBERING = "multiplierOrder", MULT_PRECEDES = "precedes", MULT_FOLLOWS =
"numbering", LANG_ADDITIVE = "additive", LANG_MULT_ADD = "follows", LANG_ORIENTATION = "orientation", LANG_RIGHTTOLEFT =
"multiplicative-additive", LANG_MULTIPLIER = "rightToLeft", LANG_LEFTTORIGHT = "leftToRight", LANG_NUMBERING =
"multiplier", LANG_MULTIPLIER_CHAR = "numbering", LANG_ADDITIVE = "additive", LANG_MULT_ADD =
"multiplierChar", LANG_NUMBERGROUPS = "numberGroups", LANG_NUM_TABLES = "multiplicative-additive", LANG_MULTIPLIER =
"tables", LANG_ALPHABET = "alphabet", LANG_TRAD_ALPHABET = "tradAlphabet"; "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); /**
* Get the association list.
//System.out.println("resource " + className + suffix); *
try * @return The association list.
{ */
public Object[][] getContents() {
// first try with the given locale return new Object[][]{
String resourceName = className + suffix; {"ui_language", "en"}, {"help_language", "en"}, {"language", "en"},
return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale); {"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" },
};
}
} }

View File

@ -102,7 +102,7 @@ public class FuncSystemProperty extends FunctionOneArg
try try
{ {
result = System.getProperty(propName); result = SecuritySupport.getSystemProperty(propName);
if (null == result) if (null == result)
{ {
@ -124,7 +124,7 @@ public class FuncSystemProperty extends FunctionOneArg
{ {
try try
{ {
result = System.getProperty(fullName); result = SecuritySupport.getSystemProperty(fullName);
if (null == result) if (null == result)
{ {
@ -165,12 +165,11 @@ public class FuncSystemProperty extends FunctionOneArg
* should already be fully qualified as path/filename * should already be fully qualified as path/filename
* @param target The target property bag the file will be placed into. * @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 try
{ {
// Use SecuritySupport class to provide priveleged access to property file // Use SecuritySupport class to provide priveleged access to property file
InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(), InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
file); file);

View File

@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res; package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */ /** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

View File

@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res; package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */ /** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

View File

@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res; package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */ /** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

View File

@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res; package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */ /** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

View File

@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res; package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */ /** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

View File

@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res; package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */ /** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

View File

@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res; package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */ /** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

View File

@ -24,9 +24,6 @@
package com.sun.org.apache.xpath.internal.res; package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -940,68 +937,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */ /** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

View File

@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res; package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */ /** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

View File

@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res; package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */ /** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

View File

@ -23,9 +23,6 @@
package com.sun.org.apache.xpath.internal.res; package com.sun.org.apache.xpath.internal.res;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Set up error messages. * Set up error messages.
@ -939,68 +936,4 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
/** Field QUERY_HEADER */ /** Field QUERY_HEADER */
public static final String QUERY_HEADER = "PATTERN "; 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;
}
} }

Some files were not shown because too many files have changed in this diff Show More