diff options
Diffstat (limited to 'java/openjdk6/files/icedtea/security/20130416')
30 files changed, 0 insertions, 20444 deletions
diff --git a/java/openjdk6/files/icedtea/security/20130416/6657673-factory_finder.patch b/java/openjdk6/files/icedtea/security/20130416/6657673-factory_finder.patch deleted file mode 100644 index 5d96ca4ef3d7..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/6657673-factory_finder.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- /dev/null 2013-04-25 14:56:29.000000000 -0400 -+++ jaxp/patches/jaxp_src/6657673-factory_finder.patch 2013-04-25 14:58:33.000000000 -0400 -@@ -0,0 +1,51 @@ -+--- src/javax/xml/parsers/FactoryFinder.java 2013-04-22 12:42:32.138748378 -0400 -++++ src/javax/xml/parsers/FactoryFinder.java 2013-04-22 12:41:36.033419998 -0400 -+@@ -44,7 +44,7 @@ -+ * @author Santiago.PericasGeertsen@sun.com -+ */ -+ class FactoryFinder { -+- -++ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal"; -+ /** -+ * Internal debug flag. -+ */ -+@@ -140,6 +140,14 @@ -+ static Object newInstance(String className, ClassLoader cl, boolean doFallback) -+ throws ConfigurationError -+ { -++ // make sure we have access to restricted packages -++ if (System.getSecurityManager() != null) { -++ if (className != null && className.startsWith(DEFAULT_PACKAGE)) { -++ cl = null; -++ useBSClsLoader = true; -++ } -++ } -++ -+ try { -+ Class providerClass = getProviderClass(className, cl, doFallback); -+ Object instance = providerClass.newInstance(); -+--- src/javax/xml/transform/FactoryFinder.java 2013-04-22 12:42:32.230748906 -0400 -++++ src/javax/xml/transform/FactoryFinder.java 2013-04-22 12:41:41.268451218 -0400 -+@@ -44,6 +44,7 @@ -+ * @author Santiago.PericasGeertsen@sun.com -+ */ -+ class FactoryFinder { -++ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xalan.internal."; -+ -+ /** -+ * Internal debug flag. -+@@ -140,6 +141,14 @@ -+ static Object newInstance(String className, ClassLoader cl, boolean doFallback) -+ throws ConfigurationError -+ { -++ // make sure we have access to restricted packages -++ if (System.getSecurityManager() != null) { -++ if (className != null && className.startsWith(DEFAULT_PACKAGE)) { -++ cl = null; -++ useBSClsLoader = true; -++ } -++ } -++ -+ try { -+ Class providerClass = getProviderClass(className, cl, doFallback); -+ Object instance = providerClass.newInstance(); diff --git a/java/openjdk6/files/icedtea/security/20130416/6657673-fixup.patch b/java/openjdk6/files/icedtea/security/20130416/6657673-fixup.patch deleted file mode 100644 index 570678055380..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/6657673-fixup.patch +++ /dev/null @@ -1,228 +0,0 @@ ---- /dev/null 2013-04-25 14:48:41.000000000 -0400 -+++ jaxp/patches/jaxp_src/6657673-fixup.patch 2013-04-25 14:51:50.000000000 -0400 -@@ -0,0 +1,225 @@ -+--- src/com/sun/org/apache/xml/internal/serializer/CharInfo.java -++++ src/com/sun/org/apache/xml/internal/serializer/CharInfo.java -+@@ -36,6 +36,8 @@ -+ -+ import javax.xml.transform.TransformerException; -+ -++import com.sun.org.apache.xalan.internal.utils.ObjectFactory; -++ -+ import com.sun.org.apache.xml.internal.serializer.utils.MsgKey; -+ import com.sun.org.apache.xml.internal.serializer.utils.SystemIDResolver; -+ import com.sun.org.apache.xml.internal.serializer.utils.Utils; -+--- /dev/null -++++ src/com/sun/org/apache/xml/internal/serializer/ObjectFactory.java -+@@ -0,0 +1,200 @@ -++/* -++ * reserved comment block -++ * DO NOT REMOVE OR ALTER! -++ */ -++/* -++ * Copyright 2001-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. -++ */ -++/* -++ * $Id: ObjectFactory.java,v 1.2.4.1 2005/09/15 08:15:20 suresh_emailid Exp $ -++ */ -++ -++package com.sun.org.apache.xml.internal.serializer; -++ -++import java.io.BufferedReader; -++import java.io.File; -++import java.io.FileInputStream; -++import java.io.IOException; -++import java.io.InputStream; -++import java.io.InputStreamReader; -++import java.util.Properties; -++ -++/** -++ * This class is duplicated for each JAXP subpackage so keep it in sync. -++ * It is package private and therefore is not exposed as part of the JAXP -++ * API. -++ * <p> -++ * This code is designed to implement the JAXP 1.1 spec pluggability -++ * feature and is designed to run on JDK version 1.1 and -++ * later, and to compile on JDK 1.2 and onward. -++ * The code also runs both as part of an unbundled jar file and -++ * when bundled as part of the JDK. -++ * <p> -++ * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code> -++ * class and modified to be used as a general utility for creating objects -++ * dynamically. -++ * -++ * @xsl.usage internal -++ */ -++class ObjectFactory { -++ -++ // -++ // Constants -++ // -++ -++ // name of default properties file to look for in JDK's jre/lib directory -++ private static final String DEFAULT_PROPERTIES_FILENAME = -++ "xalan.properties"; -++ -++ private static final String SERVICES_PATH = "META-INF/services/"; -++ -++ /** Set to true for debugging */ -++ private static final boolean DEBUG = false; -++ -++ /** cache the contents of the xalan.properties file. -++ * Until an attempt has been made to read this file, this will -++ * be null; if the file does not exist or we encounter some other error -++ * during the read, this will be empty. -++ */ -++ private static Properties fXalanProperties = null; -++ -++ /*** -++ * Cache the time stamp of the xalan.properties file so -++ * that we know if it's been modified and can invalidate -++ * the cache when necessary. -++ */ -++ private static long fLastModified = -1; -++ -++ /** -++ * Create an instance of a class using the specified ClassLoader -++ */ -++ static Object newInstance(String className, ClassLoader cl, -++ boolean doFallback) -++ throws ConfigurationError -++ { -++ // assert(className != null); -++ try{ -++ Class providerClass = findProviderClass(className, cl, doFallback); -++ Object instance = providerClass.newInstance(); -++ return instance; -++ } catch (ClassNotFoundException x) { -++ throw new ConfigurationError( -++ "Provider " + className + " not found", x); -++ } catch (Exception x) { -++ throw new ConfigurationError( -++ "Provider " + className + " could not be instantiated: " + x, -++ x); -++ } -++ } -++ -++ /** -++ * Find a Class using the specified ClassLoader -++ */ -++ static Class findProviderClass(String className, ClassLoader cl, -++ boolean doFallback) -++ throws ClassNotFoundException, ConfigurationError -++ { -++ //throw security exception if the calling thread is not allowed to access the -++ //class. Restrict the access to the package classes as specified in java.security policy. -++ SecurityManager security = System.getSecurityManager(); -++ try{ -++ if (security != null){ -++ final int lastDot = className.lastIndexOf("."); -++ String packageName = className; -++ if (lastDot != -1) packageName = className.substring(0, lastDot); -++ security.checkPackageAccess(packageName); -++ } -++ }catch(SecurityException e){ -++ throw e; -++ } -++ -++ Class providerClass; -++ if (cl == null) { -++ // XXX Use the bootstrap ClassLoader. There is no way to -++ // load a class using the bootstrap ClassLoader that works -++ // in both JDK 1.1 and Java 2. However, this should still -++ // work b/c the following should be true: -++ // -++ // (cl == null) iff current ClassLoader == null -++ // -++ // Thus Class.forName(String) will use the current -++ // ClassLoader which will be the bootstrap ClassLoader. -++ providerClass = Class.forName(className); -++ } else { -++ try { -++ providerClass = cl.loadClass(className); -++ } catch (ClassNotFoundException x) { -++ if (doFallback) { -++ // Fall back to current classloader -++ ClassLoader current = ObjectFactory.class.getClassLoader(); -++ if (current == null) { -++ providerClass = Class.forName(className); -++ } else if (cl != current) { -++ cl = current; -++ providerClass = cl.loadClass(className); -++ } else { -++ throw x; -++ } -++ } else { -++ throw x; -++ } -++ } -++ } -++ -++ return providerClass; -++ } -++ -++ // -++ // Classes -++ // -++ -++ /** -++ * A configuration error. -++ */ -++ static class ConfigurationError -++ extends Error { -++ static final long serialVersionUID = 8859254254255146542L; -++ // -++ // Data -++ // -++ -++ /** Exception. */ -++ private Exception exception; -++ -++ // -++ // Constructors -++ // -++ -++ /** -++ * Construct a new instance with the specified detail string and -++ * exception. -++ */ -++ ConfigurationError(String msg, Exception x) { -++ super(msg); -++ this.exception = x; -++ } // <init>(String,Exception) -++ -++ // -++ // Public methods -++ // -++ -++ /** Returns the exception associated to this error. */ -++ Exception getException() { -++ return exception; -++ } // getException():Exception -++ -++ } // class ConfigurationError -++ -++} // class ObjectFactory -+--- src/com/sun/org/apache/xml/internal/serializer/SerializerFactory.java -++++ src/com/sun/org/apache/xml/internal/serializer/SerializerFactory.java -+@@ -126,7 +126,7 @@ -+ -+ -+ -+- ClassLoader loader = ObjectFactory.findClassLoader(); -++ ClassLoader loader = com.sun.org.apache.xalan.internal.utils.ObjectFactory.findClassLoader(); -+ -+ Class cls = ObjectFactory.findProviderClass(className, loader, true); -+ diff --git a/java/openjdk6/files/icedtea/security/20130416/6657673.patch b/java/openjdk6/files/icedtea/security/20130416/6657673.patch deleted file mode 100644 index c2a57be334bd..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/6657673.patch +++ /dev/null @@ -1,9381 +0,0 @@ ---- /dev/null 2013-04-25 14:33:00.000000000 -0400 -+++ jaxp/patches/jaxp_src/6657673.patch 2013-04-25 14:43:01.000000000 -0400 -@@ -0,0 +1,9198 @@ -+--- src/com/sun/org/apache/bcel/internal/classfile/JavaClass.java 2013-04-16 14:28:09.232148559 +0100 -++++ src/com/sun/org/apache/bcel/internal/classfile/JavaClass.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -63,6 +63,7 @@ -+ 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.generic.Type; -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ -+ import java.io.*; -+ import java.util.StringTokenizer; -+@@ -77,6 +78,7 @@ -+ * class file. Those interested in programatically generating classes -+ * 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 -+ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> -+ */ -+@@ -451,9 +453,9 @@ -+ String debug = null, sep = null; -+ -+ try { -+- debug = System.getProperty("JavaClass.debug"); -++ debug = SecuritySupport.getSystemProperty("JavaClass.debug"); -+ // Get path separator either / or \ usually -+- sep = System.getProperty("file.separator"); -++ sep = SecuritySupport.getSystemProperty("file.separator"); -+ } -+ catch (SecurityException e) { -+ // falls through -+--- src/com/sun/org/apache/bcel/internal/util/Class2HTML.java 2013-04-16 14:28:09.312149848 +0100 -++++ src/com/sun/org/apache/bcel/internal/util/Class2HTML.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -82,6 +82,7 @@ -+ * method in the Method's frame will jump to the appropiate method in -+ * 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> -+ */ -+ public class Class2HTML implements Constants -+@@ -137,7 +138,7 @@ -+ ClassParser parser=null; -+ JavaClass java_class=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 -+ -+ try { -+--- src/com/sun/org/apache/bcel/internal/util/ClassPath.java 2013-04-16 14:28:09.316149912 +0100 -++++ src/com/sun/org/apache/bcel/internal/util/ClassPath.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -66,6 +66,7 @@ -+ * Responsible for loading (class) files from the CLASSPATH. Inspired by -+ * 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> -+ */ -+ public class ClassPath implements Serializable { -+@@ -83,7 +84,7 @@ -+ ArrayList vec = new ArrayList(); -+ -+ for(StringTokenizer tok=new StringTokenizer(class_path, -+- System.getProperty("path.separator")); -++ SecuritySupport.getSystemProperty("path.separator")); -+ tok.hasMoreTokens();) -+ { -+ String path = tok.nextToken(); -+@@ -92,7 +93,7 @@ -+ File file = new File(path); -+ -+ try { -+- if(file.exists()) { -++ if(SecuritySupport.getFileExists(file)) { -+ if(file.isDirectory()) -+ vec.add(new Dir(path)); -+ else -+@@ -143,8 +144,9 @@ -+ String name = tok.nextToken(); -+ File file = new File(name); -+ -+- if(file.exists()) -++ if(SecuritySupport.getFileExists(file)) { -+ list.add(name); -++ } -+ } -+ } -+ } -+@@ -159,9 +161,9 @@ -+ String class_path, boot_path, ext_path; -+ -+ try { -+- class_path = System.getProperty("java.class.path"); -+- boot_path = System.getProperty("sun.boot.class.path"); -+- ext_path = System.getProperty("java.ext.dirs"); -++ class_path = SecuritySupport.getSystemProperty("java.class.path"); -++ boot_path = SecuritySupport.getSystemProperty("sun.boot.class.path"); -++ ext_path = SecuritySupport.getSystemProperty("java.ext.dirs"); -+ } -+ catch (SecurityException e) { -+ return ""; -+@@ -176,8 +178,8 @@ -+ getPathComponents(ext_path, dirs); -+ -+ for(Iterator e = dirs.iterator(); e.hasNext(); ) { -+- File ext_dir = new File((String)e.next()); -+- String[] extensions = ext_dir.list(new FilenameFilter() { -++ File ext_dir = new File((String)e.next()); -++ String[] extensions = SecuritySupport.getFileList(ext_dir, new FilenameFilter() { -+ public boolean accept(File dir, String name) { -+ name = name.toLowerCase(); -+ return name.endsWith(".zip") || name.endsWith(".jar"); -+@@ -342,7 +344,7 @@ -+ final File file = new File(dir + File.separatorChar + -+ 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 String getPath() { try { -+--- src/com/sun/org/apache/bcel/internal/util/JavaWrapper.java 2013-04-16 14:28:09.316149912 +0100 -++++ src/com/sun/org/apache/bcel/internal/util/JavaWrapper.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -72,6 +72,7 @@ -+ * <pre>java com.sun.org.apache.bcel.internal.util.JavaWrapper -Dbcel.classloader=foo.MyLoader <real.class.name> [arguments]</pre> -+ * </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> -+ * @see ClassLoader -+ */ -+@@ -79,7 +80,7 @@ -+ private java.lang.ClassLoader loader; -+ -+ private static java.lang.ClassLoader getClassLoader() { -+- String s = System.getProperty("bcel.classloader"); -++ String s = SecuritySupport.getSystemProperty("bcel.classloader"); -+ -+ if((s == null) || "".equals(s)) -+ s = "com.sun.org.apache.bcel.internal.util.ClassLoader"; -+--- src/com/sun/org/apache/bcel/internal/util/SecuritySupport.java 1970-01-01 01:00:00.000000000 +0100 -++++ src/com/sun/org/apache/bcel/internal/util/SecuritySupport.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -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() { -++ } -++} -+--- src/com/sun/org/apache/xalan/internal/res/XSLMessages.java 2013-04-16 14:28:09.324150042 +0100 -++++ src/com/sun/org/apache/xalan/internal/res/XSLMessages.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -22,68 +22,72 @@ -+ */ -+ package com.sun.org.apache.xalan.internal.res; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import java.util.ListResourceBundle; -+ -+ import com.sun.org.apache.xpath.internal.res.XPATHMessages; -+ -+ /** -+- * Sets things up for issuing error messages. This class is misnamed, and -+- * should be called XalanMessages, or some such. -++ * Sets things up for issuing error messages. This class is misnamed, and should -++ * be called XalanMessages, or some such. -++ * -+ * @xsl.usage internal -+ */ -+-public class XSLMessages extends XPATHMessages -+-{ -++public class XSLMessages extends XPATHMessages { -+ -+- /** The language specific resource object for Xalan messages. */ -+- private static ListResourceBundle XSLTBundle = null; -+- -+- /** The class name of the Xalan error message string table. */ -+- private static final String XSLT_ERROR_RESOURCES = -+- "com.sun.org.apache.xalan.internal.res.XSLTErrorResources"; -+- -+- /** -+- * Creates a message from the specified key and replacement -+- * arguments, localized to the given locale. -+- * -+- * @param msgKey The key for the message text. -+- * @param args The arguments to be used as replacement text -+- * in the message created. -+- * -+- * @return The formatted message string. -+- */ -+- public static final String createMessage(String msgKey, Object args[]) //throws Exception -+- { -+- if (XSLTBundle == null) -+- XSLTBundle = loadResourceBundle(XSLT_ERROR_RESOURCES); -+- -+- if (XSLTBundle != null) -++ /** -++ * 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"; -++ -++ /** -++ * Creates a message from the specified key and replacement arguments, -++ * localized to the given locale. -++ * -++ * @param msgKey The key for the message text. -++ * @param args The arguments to be used as replacement text in the message -++ * created. -++ * -++ * @return The formatted message string. -++ */ -++ public static String createMessage(String msgKey, Object args[]) //throws Exception -+ { -+- return createMsg(XSLTBundle, msgKey, args); -++ if (XSLTBundle == null) { -++ XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES); -++ } -++ -++ if (XSLTBundle != null) { -++ return createMsg(XSLTBundle, msgKey, args); -++ } else { -++ return "Could not load any resource bundles."; -++ } -+ } -+- else -+- return "Could not load any resource bundles."; -+- } -+- -+- /** -+- * Creates a message from the specified key and replacement -+- * arguments, localized to the given locale. -+- * -+- * @param msgKey The key for the message text. -+- * @param args The arguments to be used as replacement text -+- * in the message created. -+- * -+- * @return The formatted warning string. -+- */ -+- public static final String createWarning(String msgKey, Object args[]) //throws Exception -+- { -+- if (XSLTBundle == null) -+- XSLTBundle = loadResourceBundle(XSLT_ERROR_RESOURCES); -+ -+- if (XSLTBundle != null) -++ /** -++ * Creates a message from the specified key and replacement arguments, -++ * localized to the given locale. -++ * -++ * @param msgKey The key for the message text. -++ * @param args The arguments to be used as replacement text in the message -++ * created. -++ * -++ * @return The formatted warning string. -++ */ -++ public static String createWarning(String msgKey, Object args[]) //throws Exception -+ { -+- return createMsg(XSLTBundle, msgKey, args); -++ if (XSLTBundle == null) { -++ XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES); -++ } -++ -++ if (XSLTBundle != null) { -++ return createMsg(XSLTBundle, msgKey, args); -++ } else { -++ return "Could not load any resource bundles."; -++ } -+ } -+- else -+- return "Could not load any resource bundles."; -+- } -+ } -+--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java 2013-04-16 14:28:09.328150105 +0100 -++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -2410,68 +2410,4 @@ -+ public static final String QUERY_HEADER = "MUSTER "; -+ -+ -+- /** -+- * 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; -+- } -+- -+- -+-} -+--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java 2013-04-16 14:28:09.332150170 +0100 -++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -2409,69 +2409,4 @@ -+ * @deprecated */ -+ 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("es", "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; -+- } -+- -+- -+ } -+--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java 2013-04-16 14:28:09.332150170 +0100 -++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -2410,68 +2410,4 @@ -+ 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; -+- } -+- -+- -+-} -+--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java 2013-04-16 14:28:09.336150235 +0100 -++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -2409,69 +2409,4 @@ -+ * @deprecated */ -+ public static final String QUERY_HEADER = "MODELLO "; -+ -+- -+- /** -+- * 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("it", "IT")); -+- } -+- 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; -+- } -+- -+- -+ } -+--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java 2013-04-16 14:28:09.336150235 +0100 -++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -2410,68 +2410,4 @@ -+ 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; -+- } -+- -+- -+-} -+--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java 2013-04-16 14:28:09.324150042 +0100 -++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java 2013-04-16 14:29:26.549394382 +0100 -+@@ -1446,68 +1446,4 @@ -+ 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; -+- } -+- -+- -+-} -+--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java 2013-04-16 14:28:09.340150299 +0100 -++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -2409,69 +2409,4 @@ -+ * @deprecated */ -+ 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("ko", "KR")); -+- } -+- 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; -+- } -+- -+- -+ } -+--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java 2013-04-16 14:28:09.340150299 +0100 -++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -2409,69 +2409,4 @@ -+ * @deprecated */ -+ 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("zh", "CN")); -+- } -+- catch (MissingResourceException e2) -+- { -+- -+- // Now we are really in trouble. -+- // very bad, definitely very bad...not going to get very far -+- throw new MissingResourceException( -+- "\u65e0\u6cd5\u88c5\u5165\u4efb\u4f55\u8d44\u6e90\u5305\u3002", 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; -+- } -+- -+- -+ } -+--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java 2013-04-16 14:28:09.344150364 +0100 -++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -2409,69 +2409,4 @@ -+ * @deprecated */ -+ 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("zh", "TW")); -+- } -+- 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; -+- } -+- -+- -+ } -+--- src/com/sun/org/apache/xalan/internal/utils/ConfigurationError.java 1970-01-01 01:00:00.000000000 +0100 -++++ src/com/sun/org/apache/xalan/internal/utils/ConfigurationError.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -0,0 +1,61 @@ -++/* -++ * reserved comment block -++ * DO NOT REMOVE OR ALTER! -++ */ -++/* -++ * Copyright 2001-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. -++ */ -++/* -++ * $Id: ObjectFactory.java,v 1.2.4.1 2005/09/15 02:39:54 jeffsuttor Exp $ -++ */ -++ -++package com.sun.org.apache.xalan.internal.utils; -++ -++/** -++ * A configuration error. This was an internal class in ObjectFactory previously -++ */ -++public final class ConfigurationError -++ extends Error { -++ -++ // -++ // Data -++ // -++ -++ /** Exception. */ -++ private Exception exception; -++ -++ // -++ // Constructors -++ // -++ -++ /** -++ * Construct a new instance with the specified detail string and -++ * exception. -++ */ -++ ConfigurationError(String msg, Exception x) { -++ super(msg); -++ this.exception = x; -++ } // <init>(String,Exception) -++ -++ // -++ // methods -++ // -++ -++ /** Returns the exception associated to this error. */ -++ public Exception getException() { -++ return exception; -++ } // getException():Exception -++ -++} // class ConfigurationError -+--- src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java 1970-01-01 01:00:00.000000000 +0100 -++++ src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -0,0 +1,659 @@ -++/* -++ * reserved comment block -++ * DO NOT REMOVE OR ALTER! -++ */ -++/* -++ * Copyright 2001-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. -++ */ -++/* -++ * $Id: ObjectFactory.java,v 1.2.4.1 2005/09/15 02:39:54 jeffsuttor Exp $ -++ */ -++ -++package com.sun.org.apache.xalan.internal.utils; -++ -++import java.io.InputStream; -++import java.io.IOException; -++import java.io.File; -++import java.io.FileInputStream; -++ -++import java.util.Properties; -++import java.io.BufferedReader; -++import java.io.InputStreamReader; -++ -++/** -++ * This class is duplicated for each JAXP subpackage so keep it in sync. -++ * It is package private and therefore is not exposed as part of the JAXP -++ * API. -++ * <p> -++ * This code is designed to implement the JAXP 1.1 spec pluggability -++ * feature and is designed to run on JDK version 1.1 and -++ * later, and to compile on JDK 1.2 and onward. -++ * The code also runs both as part of an unbundled jar file and -++ * when bundled as part of the JDK. -++ * <p> -++ * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code> -++ * class and modified to be used as a general utility for creating objects -++ * dynamically. -++ * -++ * @version $Id: ObjectFactory.java,v 1.11 2010-11-01 04:34:25 joehw Exp $ -++ */ -++public class ObjectFactory { -++ -++ // -++ // Constants -++ // -++ private static final String XALAN_INTERNAL = "com.sun.org.apache.xalan.internal"; -++ private static final String XERCES_INTERNAL = "com.sun.org.apache.xerces.internal"; -++ -++ // name of default properties file to look for in JDK's jre/lib directory -++ private static final String DEFAULT_PROPERTIES_FILENAME = -++ "xalan.properties"; -++ -++ private static final String SERVICES_PATH = "META-INF/services/"; -++ -++ /** Set to true for debugging */ -++ private static final boolean DEBUG = false; -++ -++ /** cache the contents of the xalan.properties file. -++ * Until an attempt has been made to read this file, this will -++ * be null; if the file does not exist or we encounter some other error -++ * during the read, this will be empty. -++ */ -++ private static Properties fXalanProperties = null; -++ -++ /*** -++ * Cache the time stamp of the xalan.properties file so -++ * that we know if it's been modified and can invalidate -++ * the cache when necessary. -++ */ -++ private static long fLastModified = -1; -++ -++ // -++ // Public static methods -++ // -++ -++ /** -++ * Finds the implementation Class object in the specified order. The -++ * specified order is the following: -++ * <ol> -++ * <li>query the system property using <code>System.getProperty</code> -++ * <li>read <code>META-INF/services/<i>factoryId</i></code> file -++ * <li>use fallback classname -++ * </ol> -++ * -++ * @return instance of factory, never null -++ * -++ * @param factoryId Name of the factory to find, same as -++ * a property name -++ * @param fallbackClassName Implementation class name, if nothing else -++ * is found. Use null to mean no fallback. -++ * -++ * @exception ObjectFactory.ConfigurationError -++ */ -++ public static Object createObject(String factoryId, String fallbackClassName) -++ throws ConfigurationError { -++ return createObject(factoryId, null, fallbackClassName); -++ } // createObject(String,String):Object -++ -++ /** -++ * Finds the implementation Class object in the specified order. The -++ * specified order is the following: -++ * <ol> -++ * <li>query the system property using <code>System.getProperty</code> -++ * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -++ * <li>read <code>META-INF/services/<i>factoryId</i></code> file -++ * <li>use fallback classname -++ * </ol> -++ * -++ * @return instance of factory, never null -++ * -++ * @param factoryId Name of the factory to find, same as -++ * a property name -++ * @param propertiesFilename The filename in the $java.home/lib directory -++ * of the properties file. If none specified, -++ * ${java.home}/lib/xalan.properties will be used. -++ * @param fallbackClassName Implementation class name, if nothing else -++ * is found. Use null to mean no fallback. -++ * -++ * @exception ObjectFactory.ConfigurationError -++ */ -++ static Object createObject(String factoryId, -++ String propertiesFilename, -++ String fallbackClassName) -++ throws ConfigurationError -++ { -++ Class factoryClass = lookUpFactoryClass(factoryId, -++ propertiesFilename, -++ fallbackClassName); -++ -++ if (factoryClass == null) { -++ throw new ConfigurationError( -++ "Provider for " + factoryId + " cannot be found", null); -++ } -++ -++ try{ -++ Object instance = factoryClass.newInstance(); -++ if (DEBUG) debugPrintln("created new instance of factory " + factoryId); -++ return instance; -++ } catch (Exception x) { -++ throw new ConfigurationError( -++ "Provider for factory " + factoryId -++ + " could not be instantiated: " + x, x); -++ } -++ } // createObject(String,String,String):Object -++ -++ /** -++ * Finds the implementation Class object in the specified order. The -++ * specified order is the following: -++ * <ol> -++ * <li>query the system property using <code>System.getProperty</code> -++ * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -++ * <li>read <code>META-INF/services/<i>factoryId</i></code> file -++ * <li>use fallback classname -++ * </ol> -++ * -++ * @return Class object of factory, never null -++ * -++ * @param factoryId Name of the factory to find, same as -++ * a property name -++ * @param propertiesFilename The filename in the $java.home/lib directory -++ * of the properties file. If none specified, -++ * ${java.home}/lib/xalan.properties will be used. -++ * @param fallbackClassName Implementation class name, if nothing else -++ * is found. Use null to mean no fallback. -++ * -++ * @exception ObjectFactory.ConfigurationError -++ */ -++ public static Class lookUpFactoryClass(String factoryId) -++ throws ConfigurationError -++ { -++ return lookUpFactoryClass(factoryId, null, null); -++ } // lookUpFactoryClass(String):Class -++ -++ /** -++ * Finds the implementation Class object in the specified order. The -++ * specified order is the following: -++ * <ol> -++ * <li>query the system property using <code>System.getProperty</code> -++ * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -++ * <li>read <code>META-INF/services/<i>factoryId</i></code> file -++ * <li>use fallback classname -++ * </ol> -++ * -++ * @return Class object that provides factory service, never null -++ * -++ * @param factoryId Name of the factory to find, same as -++ * a property name -++ * @param propertiesFilename The filename in the $java.home/lib directory -++ * of the properties file. If none specified, -++ * ${java.home}/lib/xalan.properties will be used. -++ * @param fallbackClassName Implementation class name, if nothing else -++ * is found. Use null to mean no fallback. -++ * -++ * @exception ObjectFactory.ConfigurationError -++ */ -++ public static Class lookUpFactoryClass(String factoryId, -++ String propertiesFilename, -++ String fallbackClassName) -++ throws ConfigurationError -++ { -++ String factoryClassName = lookUpFactoryClassName(factoryId, -++ propertiesFilename, -++ fallbackClassName); -++ ClassLoader cl = findClassLoader(); -++ -++ if (factoryClassName == null) { -++ factoryClassName = fallbackClassName; -++ } -++ -++ // assert(className != null); -++ try{ -++ Class providerClass = findProviderClass(factoryClassName, -++ cl, -++ true); -++ if (DEBUG) debugPrintln("created new instance of " + providerClass + -++ " using ClassLoader: " + cl); -++ return providerClass; -++ } catch (ClassNotFoundException x) { -++ throw new ConfigurationError( -++ "Provider " + factoryClassName + " not found", x); -++ } catch (Exception x) { -++ throw new ConfigurationError( -++ "Provider "+factoryClassName+" could not be instantiated: "+x, -++ x); -++ } -++ } // lookUpFactoryClass(String,String,String):Class -++ -++ /** -++ * Finds the name of the required implementation class in the specified -++ * order. The specified order is the following: -++ * <ol> -++ * <li>query the system property using <code>System.getProperty</code> -++ * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -++ * <li>read <code>META-INF/services/<i>factoryId</i></code> file -++ * <li>use fallback classname -++ * </ol> -++ * -++ * @return name of class that provides factory service, never null -++ * -++ * @param factoryId Name of the factory to find, same as -++ * a property name -++ * @param propertiesFilename The filename in the $java.home/lib directory -++ * of the properties file. If none specified, -++ * ${java.home}/lib/xalan.properties will be used. -++ * @param fallbackClassName Implementation class name, if nothing else -++ * is found. Use null to mean no fallback. -++ * -++ * @exception ObjectFactory.ConfigurationError -++ */ -++ static String lookUpFactoryClassName(String factoryId, -++ String propertiesFilename, -++ String fallbackClassName) -++ { -++ // Use the system property first -++ try { -++ String systemProp = SecuritySupport.getSystemProperty(factoryId); -++ if (systemProp != null) { -++ if (DEBUG) debugPrintln("found system property, value=" + systemProp); -++ return systemProp; -++ } -++ } catch (SecurityException se) { -++ // Ignore and continue w/ next location -++ } -++ -++ // Try to read from propertiesFilename, or -++ // $java.home/lib/xalan.properties -++ String factoryClassName = null; -++ // no properties file name specified; use -++ // $JAVA_HOME/lib/xalan.properties: -++ if (propertiesFilename == null) { -++ File propertiesFile = null; -++ boolean propertiesFileExists = false; -++ try { -++ String javah = SecuritySupport.getSystemProperty("java.home"); -++ propertiesFilename = javah + File.separator + -++ "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; -++ propertiesFile = new File(propertiesFilename); -++ propertiesFileExists = SecuritySupport.getFileExists(propertiesFile); -++ } catch (SecurityException e) { -++ // try again... -++ fLastModified = -1; -++ fXalanProperties = null; -++ } -++ -++ synchronized (ObjectFactory.class) { -++ boolean loadProperties = false; -++ FileInputStream fis = null; -++ try { -++ // file existed last time -++ if(fLastModified >= 0) { -++ if(propertiesFileExists && -++ (fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) { -++ loadProperties = true; -++ } else { -++ // file has stopped existing... -++ if(!propertiesFileExists) { -++ fLastModified = -1; -++ fXalanProperties = null; -++ } // else, file wasn't modified! -++ } -++ } else { -++ // file has started to exist: -++ if(propertiesFileExists) { -++ loadProperties = true; -++ fLastModified = SecuritySupport.getLastModified(propertiesFile); -++ } // else, nothing's changed -++ } -++ if(loadProperties) { -++ // must never have attempted to read xalan.properties -++ // before (or it's outdeated) -++ fXalanProperties = new Properties(); -++ fis = SecuritySupport.getFileInputStream(propertiesFile); -++ fXalanProperties.load(fis); -++ } -++ } catch (Exception x) { -++ fXalanProperties = null; -++ fLastModified = -1; -++ // assert(x instanceof FileNotFoundException -++ // || x instanceof SecurityException) -++ // In both cases, ignore and continue w/ next location -++ } -++ finally { -++ // try to close the input stream if one was opened. -++ if (fis != null) { -++ try { -++ fis.close(); -++ } -++ // Ignore the exception. -++ catch (IOException exc) {} -++ } -++ } -++ } -++ if(fXalanProperties != null) { -++ factoryClassName = fXalanProperties.getProperty(factoryId); -++ } -++ } else { -++ FileInputStream fis = null; -++ try { -++ fis = SecuritySupport.getFileInputStream(new File(propertiesFilename)); -++ Properties props = new Properties(); -++ props.load(fis); -++ factoryClassName = props.getProperty(factoryId); -++ } catch (Exception x) { -++ // assert(x instanceof FileNotFoundException -++ // || x instanceof SecurityException) -++ // In both cases, ignore and continue w/ next location -++ } -++ finally { -++ // try to close the input stream if one was opened. -++ if (fis != null) { -++ try { -++ fis.close(); -++ } -++ // Ignore the exception. -++ catch (IOException exc) {} -++ } -++ } -++ } -++ if (factoryClassName != null) { -++ if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value=" -++ + factoryClassName); -++ return factoryClassName; -++ } -++ -++ // Try Jar Service Provider Mechanism -++ return findJarServiceProviderName(factoryId); -++ } // lookUpFactoryClass(String,String):String -++ -++ // -++ // Private static methods -++ // -++ -++ /** Prints a message to standard error if debugging is enabled. */ -++ private static void debugPrintln(String msg) { -++ if (DEBUG) { -++ System.err.println("JAXP: " + msg); -++ } -++ } // debugPrintln(String) -++ -++ /** -++ * Figure out which ClassLoader to use. For JDK 1.2 and later use -++ * the context ClassLoader. -++ */ -++ public static ClassLoader findClassLoader() -++ throws ConfigurationError -++ { -++ if (System.getSecurityManager()!=null) { -++ //this will ensure bootclassloader is used -++ return null; -++ } -++ -++ // Figure out which ClassLoader to use for loading the provider -++ // class. If there is a Context ClassLoader then use it. -++ ClassLoader context = SecuritySupport.getContextClassLoader(); -++ ClassLoader system = SecuritySupport.getSystemClassLoader(); -++ -++ ClassLoader chain = system; -++ while (true) { -++ if (context == chain) { -++ // Assert: we are on JDK 1.1 or we have no Context ClassLoader -++ // or any Context ClassLoader in chain of system classloader -++ // (including extension ClassLoader) so extend to widest -++ // ClassLoader (always look in system ClassLoader if Xalan -++ // is in boot/extension/system classpath and in current -++ // ClassLoader otherwise); normal classloaders delegate -++ // back to system ClassLoader first so this widening doesn't -++ // change the fact that context ClassLoader will be consulted -++ ClassLoader current = ObjectFactory.class.getClassLoader(); -++ -++ chain = system; -++ while (true) { -++ if (current == chain) { -++ // Assert: Current ClassLoader in chain of -++ // boot/extension/system ClassLoaders -++ return system; -++ } -++ if (chain == null) { -++ break; -++ } -++ chain = SecuritySupport.getParentClassLoader(chain); -++ } -++ -++ // Assert: Current ClassLoader not in chain of -++ // boot/extension/system ClassLoaders -++ return current; -++ } -++ -++ if (chain == null) { -++ // boot ClassLoader reached -++ break; -++ } -++ -++ // Check for any extension ClassLoaders in chain up to -++ // boot ClassLoader -++ chain = SecuritySupport.getParentClassLoader(chain); -++ } -++ -++ // Assert: Context ClassLoader not in chain of -++ // boot/extension/system ClassLoaders -++ return context; -++ } // findClassLoader():ClassLoader -++ -++ /** -++ * Create an instance of a class using the same classloader for the ObjectFactory by default -++ * or bootclassloader when Security Manager is in place -++ */ -++ public static Object newInstance(String className, boolean doFallback) -++ throws ConfigurationError -++ { -++ if (System.getSecurityManager()!=null) { -++ return newInstance(className, null, doFallback); -++ } else { -++ return newInstance(className, -++ findClassLoader (), doFallback); -++ } -++ } -++ -++ /** -++ * Create an instance of a class using the specified ClassLoader -++ */ -++ static Object newInstance(String className, ClassLoader cl, -++ boolean doFallback) -++ throws ConfigurationError -++ { -++ // assert(className != null); -++ try{ -++ Class providerClass = findProviderClass(className, cl, doFallback); -++ Object instance = providerClass.newInstance(); -++ if (DEBUG) debugPrintln("created new instance of " + providerClass + -++ " using ClassLoader: " + cl); -++ return instance; -++ } catch (ClassNotFoundException x) { -++ throw new ConfigurationError( -++ "Provider " + className + " not found", x); -++ } catch (Exception x) { -++ throw new ConfigurationError( -++ "Provider " + className + " could not be instantiated: " + x, -++ x); -++ } -++ } -++ -++ /** -++ * Find a Class using the same classloader for the ObjectFactory by default -++ * or bootclassloader when Security Manager is in place -++ */ -++ public static Class findProviderClass(String className, boolean doFallback) -++ throws ClassNotFoundException, ConfigurationError -++ { -++ if (System.getSecurityManager()!=null) { -++ return Class.forName(className); -++ } else { -++ return findProviderClass (className, -++ findClassLoader (), doFallback); -++ } -++ } -++ -++ /** -++ * Find a Class using the specified ClassLoader -++ */ -++ static Class findProviderClass(String className, ClassLoader cl, -++ boolean doFallback) -++ throws ClassNotFoundException, ConfigurationError -++ { -++ //throw security exception if the calling thread is not allowed to access the -++ //class. Restrict the access to the package classes as specified in java.security policy. -++ SecurityManager security = System.getSecurityManager(); -++ try{ -++ if (security != null){ -++ if (className.startsWith(XALAN_INTERNAL) || -++ className.startsWith(XERCES_INTERNAL)) { -++ cl = null; -++ } else { -++ final int lastDot = className.lastIndexOf("."); -++ String packageName = className; -++ if (lastDot != -1) packageName = className.substring(0, lastDot); -++ security.checkPackageAccess(packageName); -++ } -++ } -++ }catch(SecurityException e){ -++ throw e; -++ } -++ -++ Class providerClass; -++ if (cl == null) { -++ // XXX Use the bootstrap ClassLoader. There is no way to -++ // load a class using the bootstrap ClassLoader that works -++ // in both JDK 1.1 and Java 2. However, this should still -++ // work b/c the following should be true: -++ // -++ // (cl == null) iff current ClassLoader == null -++ // -++ // Thus Class.forName(String) will use the current -++ // ClassLoader which will be the bootstrap ClassLoader. -++ providerClass = Class.forName(className); -++ } else { -++ try { -++ providerClass = cl.loadClass(className); -++ } catch (ClassNotFoundException x) { -++ if (doFallback) { -++ // Fall back to current classloader -++ ClassLoader current = ObjectFactory.class.getClassLoader(); -++ if (current == null) { -++ providerClass = Class.forName(className); -++ } else if (cl != current) { -++ cl = current; -++ providerClass = cl.loadClass(className); -++ } else { -++ throw x; -++ } -++ } else { -++ throw x; -++ } -++ } -++ } -++ -++ return providerClass; -++ } -++ -++ /** -++ * Find the name of service provider using Jar Service Provider Mechanism -++ * -++ * @return instance of provider class if found or null -++ */ -++ private static String findJarServiceProviderName(String factoryId) -++ { -++ String serviceId = SERVICES_PATH + factoryId; -++ InputStream is = null; -++ -++ // First try the Context ClassLoader -++ ClassLoader cl = findClassLoader(); -++ -++ is = SecuritySupport.getResourceAsStream(cl, serviceId); -++ -++ // If no provider found then try the current ClassLoader -++ if (is == null) { -++ ClassLoader current = ObjectFactory.class.getClassLoader(); -++ if (cl != current) { -++ cl = current; -++ is = SecuritySupport.getResourceAsStream(cl, serviceId); -++ } -++ } -++ -++ if (is == null) { -++ // No provider found -++ return null; -++ } -++ -++ if (DEBUG) debugPrintln("found jar resource=" + serviceId + -++ " using ClassLoader: " + cl); -++ -++ // Read the service provider name in UTF-8 as specified in -++ // the jar spec. Unfortunately this fails in Microsoft -++ // VJ++, which does not implement the UTF-8 -++ // encoding. Theoretically, we should simply let it fail in -++ // that case, since the JVM is obviously broken if it -++ // doesn't support such a basic standard. But since there -++ // are still some users attempting to use VJ++ for -++ // development, we have dropped in a fallback which makes a -++ // second attempt using the platform's default encoding. In -++ // VJ++ this is apparently ASCII, which is a subset of -++ // UTF-8... and since the strings we'll be reading here are -++ // also primarily limited to the 7-bit ASCII range (at -++ // least, in English versions), this should work well -++ // enough to keep us on the air until we're ready to -++ // officially decommit from VJ++. [Edited comment from -++ // jkesselm] -++ BufferedReader rd; -++ try { -++ rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); -++ } catch (java.io.UnsupportedEncodingException e) { -++ rd = new BufferedReader(new InputStreamReader(is)); -++ } -++ -++ String factoryClassName = null; -++ try { -++ // XXX Does not handle all possible input as specified by the -++ // Jar Service Provider specification -++ factoryClassName = rd.readLine(); -++ } catch (IOException x) { -++ // No provider found -++ return null; -++ } -++ finally { -++ try { -++ // try to close the reader. -++ rd.close(); -++ } -++ // Ignore the exception. -++ catch (IOException exc) {} -++ } -++ -++ if (factoryClassName != null && -++ ! "".equals(factoryClassName)) { -++ if (DEBUG) debugPrintln("found in resource, value=" -++ + factoryClassName); -++ -++ // Note: here we do not want to fall back to the current -++ // ClassLoader because we want to avoid the case where the -++ // resource file was found using one ClassLoader and the -++ // provider class was instantiated using a different one. -++ return factoryClassName; -++ } -++ -++ // No provider found -++ return null; -++ } -++ -++} // class ObjectFactory -+--- src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java 1970-01-01 01:00:00.000000000 +0100 -++++ src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -0,0 +1,206 @@ -++/* -++ * 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. -++ */ -++/* -++ * $Id: SecuritySupport.java,v 1.1.2.1 2005/08/01 02:08:48 jeffsuttor Exp $ -++ */ -++ -++package com.sun.org.apache.xalan.internal.utils; -++ -++import java.io.File; -++import java.io.FileInputStream; -++import java.io.FileNotFoundException; -++import java.io.InputStream; -++ -++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); -++ } -++ }); -++ } -++ -++ public static String getSystemProperty(final String propName, final String def) { -++ return (String) AccessController.doPrivileged(new PrivilegedAction() { -++ public Object run() { -++ return System.getProperty(propName, def); -++ } -++ }); -++ } -++ -++ static FileInputStream getFileInputStream(final File file) -++ throws FileNotFoundException { -++ 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(ObjectFactory.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 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(); -++ } -++ -++ -++ private SecuritySupport() { -++ } -++} -+--- src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java 2013-04-16 14:28:09.344150364 +0100 -++++ src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -22,6 +22,8 @@ -+ */ -+ package com.sun.org.apache.xalan.internal.xslt; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -++ -+ import java.io.File; -+ import java.io.FileWriter; -+ import java.io.PrintWriter; -+@@ -569,7 +571,7 @@ -+ // Grab java version for later use -+ try -+ { -+- String javaVersion = System.getProperty("java.version"); -++ String javaVersion = SecuritySupport.getSystemProperty("java.version"); -+ -+ h.put("java.version", javaVersion); -+ } -+@@ -588,7 +590,7 @@ -+ { -+ -+ // 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); -+ -+@@ -598,7 +600,7 @@ -+ h.put(FOUNDCLASSES + "java.class.path", classpathJars); -+ -+ // Also check for JDK 1.2+ type classpaths -+- String othercp = System.getProperty("sun.boot.class.path"); -++ String othercp = SecuritySupport.getSystemProperty("sun.boot.class.path"); -+ -+ if (null != othercp) -+ { -+@@ -612,7 +614,7 @@ -+ -+ //@todo NOTE: We don't actually search java.ext.dirs for -+ // *.jar files therein! This should be updated -+- othercp = System.getProperty("java.ext.dirs"); -++ othercp = SecuritySupport.getSystemProperty("java.ext.dirs"); -+ -+ if (null != othercp) -+ { -+--- src/com/sun/org/apache/xalan/internal/xslt/Process.java 2013-04-16 14:28:09.348150428 +0100 -++++ src/com/sun/org/apache/xalan/internal/xslt/Process.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -55,6 +55,7 @@ -+ import com.sun.org.apache.xalan.internal.Version; -+ import com.sun.org.apache.xalan.internal.res.XSLMessages; -+ import com.sun.org.apache.xalan.internal.res.XSLTErrorResources; -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ -+ //J2SE does not support Xalan interpretive -+ /* -+@@ -178,7 +179,7 @@ -+ java.io.PrintWriter diagnosticsWriter = new PrintWriter(System.err, true); -+ java.io.PrintWriter dumpWriter = diagnosticsWriter; -+ ResourceBundle resbundle = -+- (XSLMessages.loadResourceBundle( -++ (SecuritySupport.getResourceBundle( -+ com.sun.org.apache.xml.internal.utils.res.XResourceBundle.ERROR_RESOURCES)); -+ String flavor = "s2s"; -+ -+--- src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java 2013-04-16 14:28:09.380150944 +0100 -++++ src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -400,7 +400,7 @@ -+ } -+ } -+ catch (TypeCheckError e) { -+- reportError(ERROR, new ErrorMsg(e)); -++ reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e)); -+ } -+ } -+ -+@@ -420,7 +420,7 @@ -+ } -+ catch (IOException e) { -+ if (_xsltc.debug()) e.printStackTrace(); -+- reportError(ERROR,new ErrorMsg(e)); -++ reportError(ERROR,new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e)); -+ } -+ catch (SAXException e) { -+ Throwable ex = e.getException(); -+@@ -428,15 +428,15 @@ -+ e.printStackTrace(); -+ if (ex != null) ex.printStackTrace(); -+ } -+- reportError(ERROR, new ErrorMsg(e)); -++ reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e)); -+ } -+ catch (CompilerException e) { -+ if (_xsltc.debug()) e.printStackTrace(); -+- reportError(ERROR, new ErrorMsg(e)); -++ reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e)); -+ } -+ catch (Exception e) { -+ if (_xsltc.debug()) e.printStackTrace(); -+- reportError(ERROR, new ErrorMsg(e)); -++ reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e)); -+ } -+ return null; -+ } -+--- src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java 2013-04-16 14:28:09.400151266 +0100 -++++ src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -947,7 +947,12 @@ -+ "Cannot set the feature ''{0}'' on this TransformerFactory."}, -+ -+ {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE, -+- "FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."} -++ "FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}, -++ -++ {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."} -+ }; -+ } -+ } -+--- src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java 2013-04-16 14:28:09.420151588 +0100 -++++ src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -23,6 +23,7 @@ -+ -+ package com.sun.org.apache.xalan.internal.xsltc.compiler.util; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import java.text.MessageFormat; -+ import java.util.Locale; -+ import java.util.ResourceBundle; -+@@ -46,6 +47,8 @@ -+ Object[] _params = null; -+ private boolean _isWarningError; -+ -++ Throwable _cause; -++ -+ // Compiler error messages -+ public static final String MULTIPLE_STYLESHEET_ERR = "MULTIPLE_STYLESHEET_ERR"; -+ public static final String TEMPLATE_REDEF_ERR = "TEMPLATE_REDEF_ERR"; -+@@ -157,6 +160,8 @@ -+ public static final String INVALID_NCNAME_ERR = "INVALID_NCNAME_ERR"; -+ public static final String INVALID_METHOD_IN_OUTPUT = "INVALID_METHOD_IN_OUTPUT"; -+ -++ public static final String DESERIALIZE_TRANSLET_ERR = "DESERIALIZE_TEMPLATES_ERR"; -++ -+ // All error messages are localized and are stored in resource bundles. -+ // This array and the following 4 strings are read from that bundle. -+ private static ResourceBundle _bundle; -+@@ -167,7 +172,7 @@ -+ public final static String RUNTIME_ERROR_KEY = "RUNTIME_ERROR_KEY"; -+ -+ static { -+- _bundle = ResourceBundle.getBundle( -++ _bundle = SecuritySupport.getResourceBundle( -+ "com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMessages", -+ Locale.getDefault()); -+ } -+@@ -177,10 +182,11 @@ -+ _line = 0; -+ } -+ -+- public ErrorMsg(Throwable e) { -+- _code = null; -++ public ErrorMsg(String code, Throwable e) { -++ _code = code; -+ _message = e.getMessage(); -+ _line = 0; -++ _cause = e; -+ } -+ -+ public ErrorMsg(String message, int line) { -+@@ -232,6 +238,10 @@ -+ _params[1] = param2; -+ } -+ -++ public Throwable getCause() { -++ return _cause; -++ } -++ -+ private String getFileName(SyntaxTreeNode node) { -+ Stylesheet stylesheet = node.getStylesheet(); -+ if (stylesheet != null) -+--- src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java 2013-04-16 14:28:09.428151717 +0100 -++++ src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -26,6 +26,7 @@ -+ import java.util.StringTokenizer; -+ -+ import com.sun.org.apache.bcel.internal.generic.Type; -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; -+ import com.sun.org.apache.xml.internal.utils.XML11Char; -+ -+@@ -37,7 +38,7 @@ -+ private static char filesep; -+ -+ static { -+- String temp = System.getProperty("file.separator", "/"); -++ String temp = SecuritySupport.getSystemProperty("file.separator", "/"); -+ filesep = temp.charAt(0); -+ } -+ -+--- src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java 2013-04-16 14:28:09.396151201 +0100 -++++ src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -41,10 +41,12 @@ -+ import java.util.jar.Manifest; -+ -+ import com.sun.org.apache.bcel.internal.classfile.JavaClass; -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; -+ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util; -+ import com.sun.org.apache.xml.internal.dtm.DTM; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import org.xml.sax.InputSource; -+ import org.xml.sax.XMLReader; -+ -+@@ -257,7 +259,7 @@ -+ return compile(input, _className); -+ } -+ catch (IOException e) { -+- _parser.reportError(Constants.FATAL, new ErrorMsg(e)); -++ _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e)); -+ return false; -+ } -+ } -+@@ -276,7 +278,7 @@ -+ return compile(input, name); -+ } -+ catch (IOException e) { -+- _parser.reportError(Constants.FATAL, new ErrorMsg(e)); -++ _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e)); -+ return false; -+ } -+ } -+@@ -361,11 +363,11 @@ -+ } -+ catch (Exception e) { -+ /*if (_debug)*/ e.printStackTrace(); -+- _parser.reportError(Constants.FATAL, new ErrorMsg(e)); -++ _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e)); -+ } -+ catch (Error e) { -+ if (_debug) e.printStackTrace(); -+- _parser.reportError(Constants.FATAL, new ErrorMsg(e)); -++ _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e)); -+ } -+ finally { -+ _reader = null; // reset this here to be sure it is not re-used -+@@ -573,7 +575,7 @@ -+ */ -+ public boolean setDestDirectory(String dstDirName) { -+ final File dir = new File(dstDirName); -+- if (dir.exists() || dir.mkdirs()) { -++ if (SecuritySupport.getFileExists(dir) || dir.mkdirs()) { -+ _destDir = dir; -+ return true; -+ } -+@@ -746,7 +748,7 @@ -+ String parentDir = outFile.getParent(); -+ if (parentDir != null) { -+ File parentFile = new File(parentDir); -+- if (!parentFile.exists()) -++ if (!SecuritySupport.getFileExists(parentFile)) -+ parentFile.mkdirs(); -+ } -+ } -+--- src/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java 2013-04-16 14:28:09.444151975 +0100 -++++ src/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -32,6 +32,7 @@ -+ import com.sun.org.apache.xalan.internal.xsltc.TransletException; -+ import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet; -+ import com.sun.org.apache.xml.internal.utils.StringComparable; -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ -+ /** -+ * Base class for sort records containing application specific sort keys -+@@ -111,7 +112,7 @@ -+ try { -+ // -- W. Eliot Kimber (eliot@isogen.com) -+ colFactClassname = -+- System.getProperty("com.sun.org.apache.xalan.internal.xsltc.COLLATOR_FACTORY"); -++ SecuritySupport.getSystemProperty("com.sun.org.apache.xalan.internal.xsltc.COLLATOR_FACTORY"); -+ } -+ catch (SecurityException e) { -+ // If we can't read the propery, just use default collator -+--- src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java 2013-04-16 14:28:09.448152039 +0100 -++++ src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java 2013-04-16 14:29:26.553394447 +0100 -+@@ -23,6 +23,7 @@ -+ -+ package com.sun.org.apache.xalan.internal.xsltc.runtime; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import java.text.DecimalFormat; -+ import java.text.DecimalFormatSymbols; -+ import java.text.FieldPosition; -+@@ -1518,7 +1519,7 @@ -+ -+ static { -+ String resource = "com.sun.org.apache.xalan.internal.xsltc.runtime.ErrorMessages"; -+- m_bundle = ResourceBundle.getBundle(resource); -++ m_bundle = SecuritySupport.getResourceBundle(resource); -+ } -+ -+ /** -+--- src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java 2013-04-16 14:28:09.456152168 +0100 -++++ src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -23,6 +23,7 @@ -+ -+ package com.sun.org.apache.xalan.internal.xsltc.runtime.output; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import java.io.BufferedWriter; -+ import java.io.IOException; -+ import java.io.Writer; -+@@ -36,7 +37,7 @@ -+ -+ static { -+ // Set a larger buffer size for Solaris -+- final String osName = System.getProperty("os.name"); -++ final String osName = SecuritySupport.getSystemProperty("os.name"); -+ if (osName.equalsIgnoreCase("solaris")) { -+ BUFFER_SIZE = 32 * KB; -+ } -+--- src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java 2013-04-16 14:28:09.460152233 +0100 -++++ src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -42,6 +42,7 @@ -+ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; -+ import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet; -+ import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable; -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ -+ /** -+ * @author Morten Jorgensen -+@@ -51,6 +52,8 @@ -+ */ -+ public final class TemplatesImpl implements Templates, Serializable { -+ static final long serialVersionUID = 673094361519270707L; -++ public final static String DESERIALIZE_TRANSLET = "jdk.xml.enableTemplatesImplDeserialization"; -++ -+ /** -+ * Name of the superclass of all translets. This is needed to -+ * determine which, among all classes comprising a translet, -+@@ -181,6 +184,15 @@ -+ private void readObject(ObjectInputStream is) -+ throws IOException, ClassNotFoundException -+ { -++ SecurityManager security = System.getSecurityManager(); -++ if (security != null){ -++ String temp = SecuritySupport.getSystemProperty(DESERIALIZE_TRANSLET); -++ if (temp == null || !(temp.length()==0 || temp.equalsIgnoreCase("true"))) { -++ ErrorMsg err = new ErrorMsg(ErrorMsg.DESERIALIZE_TRANSLET_ERR); -++ throw new UnsupportedOperationException(err.toString()); -++ } -++ } -++ -+ is.defaultReadObject(); -+ if (is.readBoolean()) { -+ _uriResolver = (URIResolver) is.readObject(); -+--- src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java 2013-04-16 14:28:09.460152233 +0100 -++++ src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -69,7 +69,7 @@ -+ import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC; -+ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; -+ import com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager; -+- -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ -+ import org.xml.sax.InputSource; -+ import org.xml.sax.XMLFilter; -+@@ -839,8 +839,14 @@ -+ // Check that the transformation went well before returning -+ if (bytecodes == null) { -+ -+- ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR); -+- TransformerConfigurationException exc = new TransformerConfigurationException(err.toString()); -++ Vector errs = xsltc.getErrors(); -++ ErrorMsg err = null; -++ if (errs != null) { -++ err = (ErrorMsg)errs.get(errs.size()-1); -++ } else { -++ err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR); -++ } -++ TransformerConfigurationException exc = new TransformerConfigurationException(err.toString(), err.getCause()); -+ -+ // Pass compiler errors to the error listener -+ if (_errorListener != null) { -+@@ -1187,7 +1193,7 @@ -+ // Find the parent directory of the translet. -+ String transletParentDir = transletFile.getParent(); -+ if (transletParentDir == null) -+- transletParentDir = System.getProperty("user.dir"); -++ transletParentDir = SecuritySupport.getSystemProperty("user.dir"); -+ -+ File transletParentFile = new File(transletParentDir); -+ -+--- src/com/sun/org/apache/xerces/internal/dom/DOMMessageFormatter.java 2013-04-16 14:28:09.472152426 +0100 -++++ src/com/sun/org/apache/xerces/internal/dom/DOMMessageFormatter.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -20,10 +20,10 @@ -+ -+ -+ package com.sun.org.apache.xerces.internal.dom; -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import java.util.Locale; -+ import java.util.MissingResourceException; -+ import java.util.ResourceBundle; -+-import java.util.PropertyResourceBundle; -+ -+ /** -+ * Used to format DOM error messages, using the system locale. -+@@ -31,6 +31,7 @@ -+ * @xerces.internal -+ * -+ * @author Sandy Gao, IBM -++ * @version $Id: DOMMessageFormatter.java,v 1.6 2010-11-01 04:39:38 joehw Exp $ -+ */ -+ public class DOMMessageFormatter { -+ public static final String DOM_DOMAIN = "http://www.w3.org/dom/DOMTR"; -+@@ -122,13 +123,13 @@ -+ */ -+ public static void init(){ -+ if (locale != null) { -+- domResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages", locale); -+- serResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages", locale); -+- xmlResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale); -++ domResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages", locale); -++ serResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages", locale); -++ xmlResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale); -+ }else{ -+- domResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages"); -+- serResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages"); -+- xmlResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages"); -++ domResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages"); -++ serResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages"); -++ xmlResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages"); -+ } -+ } -+ -+--- src/com/sun/org/apache/xerces/internal/impl/dv/DatatypeException.java 2013-04-16 14:28:09.532153393 +0100 -++++ src/com/sun/org/apache/xerces/internal/impl/dv/DatatypeException.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -20,6 +20,7 @@ -+ -+ package com.sun.org.apache.xerces.internal.impl.dv; -+ -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import java.util.ResourceBundle; -+ import java.util.PropertyResourceBundle; -+ import java.util.MissingResourceException; -+@@ -34,6 +35,7 @@ -+ * -+ * @author Sandy Gao, IBM -+ * -++ * @version $Id: DatatypeException.java,v 1.6 2010-11-01 04:39:43 joehw Exp $ -+ */ -+ public class DatatypeException extends Exception { -+ -+@@ -84,7 +86,7 @@ -+ */ -+ public String getMessage() { -+ ResourceBundle resourceBundle = null; -+- resourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages"); -++ resourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages"); -+ if (resourceBundle == null) -+ throw new MissingResourceException("Property file not found!", "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", key); -+ -+--- src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter.java 2013-04-16 14:28:09.552153715 +0100 -++++ src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -20,12 +20,11 @@ -+ -+ package com.sun.org.apache.xerces.internal.impl.msg; -+ -++import com.sun.org.apache.xerces.internal.util.MessageFormatter; -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import java.util.Locale; -+ import java.util.MissingResourceException; -+ import java.util.ResourceBundle; -+-import java.util.PropertyResourceBundle; -+- -+-import com.sun.org.apache.xerces.internal.util.MessageFormatter; -+ -+ /** -+ * XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for -+@@ -71,12 +70,12 @@ -+ -+ if (fResourceBundle == null || locale != fLocale) { -+ if (locale != null) { -+- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale); -++ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale); -+ // memorize the most-recent locale -+ fLocale = locale; -+ } -+ if (fResourceBundle == null) -+- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages"); -++ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages"); -+ } -+ -+ // format message -+--- src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java 2013-04-16 14:28:09.504152942 +0100 -++++ src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -52,6 +52,7 @@ -+ import com.sun.org.apache.xerces.internal.xni.XNIException; -+ import com.sun.org.apache.xerces.internal.xni.parser.*; -+ import com.sun.org.apache.xerces.internal.impl.Constants; -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import com.sun.xml.internal.stream.Entity; -+ import com.sun.org.apache.xerces.internal.xni.Augmentations; -+ -+@@ -1811,7 +1812,7 @@ -+ // get the user.dir property -+ String userDir = ""; -+ try { -+- userDir = System.getProperty("user.dir"); -++ userDir = SecuritySupport.getSystemProperty("user.dir"); -+ } -+ catch (SecurityException se) { -+ } -+@@ -2155,9 +2156,6 @@ -+ private static String expandSystemIdStrictOff(String systemId, String baseSystemId) -+ throws URI.MalformedURIException { -+ -+- systemId = escapeNonUSAscii(systemId); -+- baseSystemId = escapeNonUSAscii(baseSystemId); -+- -+ URI systemURI = new URI(systemId, true); -+ // If it's already an absolute one, return it -+ if (systemURI.isAbsoluteURI()) { -+@@ -2623,64 +2621,6 @@ -+ -+ } // fixURI(String):String -+ -+- /** -+- * Escape invalid URI characters. -+- * -+- * Passed a URI that contains invalid characters (like spaces, non-ASCII Unicode characters, and the like), -+- * this function percent encodes the invalid characters per the URI specification (i.e., as a sequence of -+- * %-encoded UTF-8 octets). -+- * -+- * N.B. There are two problems. If the URI contains a '%' character, that might be an indication that -+- * the URI has already been escaped by the author, or it might be an invalid '%'. In the former case, -+- * it's important not to escape it, or we'll wind up with invalid, doubly-escaped '%'s. In the latter, -+- * the URI is broken if we don't encode it. Similarly, a '#' character might be the start of a fragment -+- * identifier or it might be an invalid '#'. -+- * -+- * Given that the former is vastly more likely than the latter in each case (most users are familiar with -+- * the magic status of '%' and '#' and they occur relatively infrequently in filenames, and if the user parses -+- * a proper Java File, we will already have %-escaped the URI), we simply assume that %'s and #'s are legit. -+- * -+- * Very rarely, we may be wrong. If so, tell the user to fix the clearly broken URI. -+- */ -+- protected static String escapeNonUSAscii(String str) { -+- if (str == null) { -+- return str; -+- } -+- -+- // get UTF-8 bytes for the string -+- StringBuffer buffer = new StringBuffer(); -+- byte[] bytes = null; -+- byte b; -+- try { -+- bytes = str.getBytes("UTF-8"); -+- } catch (java.io.UnsupportedEncodingException e) { -+- // should never happen -+- return str; -+- } -+- int len = bytes.length; -+- int ch; -+- -+- // for each byte -+- for (int i = 0; i < len; i++) { -+- b = bytes[i]; -+- // for non-ascii character: make it positive, then escape -+- if (b < 0) { -+- ch = b + 256; -+- buffer.append('%'); -+- buffer.append(gHexChs[ch >> 4]); -+- buffer.append(gHexChs[ch & 0xf]); -+- } -+- else if (b != '%' && b != '#' && gNeedEscaping[b]) { -+- buffer.append('%'); -+- buffer.append(gAfterEscaping1[b]); -+- buffer.append(gAfterEscaping2[b]); -+- } -+- else { -+- buffer.append((char)b); -+- } -+- } -+- return buffer.toString(); -+- } -+ -+ // -+ // Package visible methods -+--- src/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegexParser.java 2013-04-16 14:28:09.560153844 +0100 -++++ src/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegexParser.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -20,6 +20,7 @@ -+ -+ package com.sun.org.apache.xerces.internal.impl.xpath.regex; -+ -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import java.util.Locale; -+ import java.util.MissingResourceException; -+ import java.util.ResourceBundle; -+@@ -94,10 +95,10 @@ -+ public void setLocale(Locale locale) { -+ try { -+ if (locale != null) { -+- this.resources = ResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message", locale); -++ this.resources = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message", locale); -+ } -+ else { -+- this.resources = ResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message"); -++ this.resources = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message"); -+ } -+ } -+ catch (MissingResourceException mre) { -+--- src/com/sun/org/apache/xerces/internal/impl/xs/XSMessageFormatter.java 2013-04-16 14:28:09.572154037 +0100 -++++ src/com/sun/org/apache/xerces/internal/impl/xs/XSMessageFormatter.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -20,11 +20,11 @@ -+ -+ package com.sun.org.apache.xerces.internal.impl.xs; -+ -++import com.sun.org.apache.xerces.internal.util.MessageFormatter; -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import java.util.Locale; -+ import java.util.MissingResourceException; -+ import java.util.ResourceBundle; -+-import java.util.PropertyResourceBundle; -+-import com.sun.org.apache.xerces.internal.util.MessageFormatter; -+ -+ -+ /** -+@@ -34,6 +34,7 @@ -+ * @xerces.internal -+ * -+ * @author Elena Litani, IBM -++ * @version $Id: XSMessageFormatter.java,v 1.6 2010-11-01 04:39:55 joehw Exp $ -+ */ -+ public class XSMessageFormatter implements MessageFormatter { -+ /** -+@@ -66,12 +67,12 @@ -+ -+ if (fResourceBundle == null || locale != fLocale) { -+ if (locale != null) { -+- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", locale); -++ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", locale); -+ // memorize the most-recent locale -+ fLocale = locale; -+ } -+ if (fResourceBundle == null) -+- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages"); -++ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages"); -+ } -+ -+ String msg = fResourceBundle.getString(key); -+--- src/com/sun/org/apache/xerces/internal/jaxp/validation/JAXPValidationMessageFormatter.java 2013-04-16 14:28:09.600154489 +0100 -++++ src/com/sun/org/apache/xerces/internal/jaxp/validation/JAXPValidationMessageFormatter.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -20,15 +20,16 @@ -+ -+ package com.sun.org.apache.xerces.internal.jaxp.validation; -+ -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import java.util.Locale; -+ import java.util.MissingResourceException; -+ import java.util.ResourceBundle; -+-import java.util.PropertyResourceBundle; -+ -+ /** -+ * <p>Used to format JAXP Validation API error messages using a specified locale.</p> -+ * -+ * @author Michael Glavassevich, IBM -++ * @version $Id: JAXPValidationMessageFormatter.java,v 1.5 2010-11-01 04:40:08 joehw Exp $ -+ */ -+ final class JAXPValidationMessageFormatter { -+ -+@@ -54,11 +55,11 @@ -+ ResourceBundle resourceBundle = null; -+ if (locale != null) { -+ resourceBundle = -+- PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages", locale); -++ SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages", locale); -+ } -+ else { -+ resourceBundle = -+- PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages"); -++ SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages"); -+ } -+ -+ // format message -+--- src/com/sun/org/apache/xerces/internal/util/DatatypeMessageFormatter.java 2013-04-16 14:28:09.616154746 +0100 -++++ src/com/sun/org/apache/xerces/internal/util/DatatypeMessageFormatter.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -20,15 +20,16 @@ -+ -+ package com.sun.org.apache.xerces.internal.util; -+ -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import java.util.Locale; -+ import java.util.MissingResourceException; -+-import java.util.PropertyResourceBundle; -+ import java.util.ResourceBundle; -+ -+ /** -+ * <p>Used to format JAXP 1.3 Datatype API error messages using a specified locale.</p> -+ * -+ * @author Neeraj Bajaj, Sun Microsystems -++ * @version $Id: DatatypeMessageFormatter.java,v 1.6 2010-11-01 04:40:14 joehw Exp $ -+ */ -+ public class DatatypeMessageFormatter { -+ -+@@ -56,11 +57,11 @@ -+ ResourceBundle resourceBundle = null; -+ if (locale != null) { -+ resourceBundle = -+- PropertyResourceBundle.getBundle(BASE_NAME, locale); -++ SecuritySupport.getResourceBundle(BASE_NAME, locale); -+ } -+ else { -+ resourceBundle = -+- PropertyResourceBundle.getBundle(BASE_NAME); -++ SecuritySupport.getResourceBundle(BASE_NAME); -+ } -+ -+ // format message -+--- src/com/sun/org/apache/xerces/internal/util/SAXMessageFormatter.java 2013-04-16 14:28:09.620154811 +0100 -++++ src/com/sun/org/apache/xerces/internal/util/SAXMessageFormatter.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -19,16 +19,17 @@ -+ */ -+ package com.sun.org.apache.xerces.internal.util; -+ -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import java.util.Locale; -+ import java.util.MissingResourceException; -+ import java.util.ResourceBundle; -+-import java.util.PropertyResourceBundle; -+ -+ /** -+ * Used to format SAX error messages using a specified locale. -+ * -+ * @author Michael Glavassevich, IBM -+ * -++ * @version $Id: SAXMessageFormatter.java,v 1.6 2010-11-01 04:40:14 joehw Exp $ -+ */ -+ public class SAXMessageFormatter { -+ -+@@ -54,11 +55,11 @@ -+ ResourceBundle resourceBundle = null; -+ if (locale != null) { -+ resourceBundle = -+- PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages", locale); -++ SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages", locale); -+ } -+ else { -+ resourceBundle = -+- PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages"); -++ SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages"); -+ } -+ -+ // format message -+--- src/com/sun/org/apache/xerces/internal/util/SecurityManager.java 2013-04-16 14:28:09.620154811 +0100 -++++ src/com/sun/org/apache/xerces/internal/util/SecurityManager.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -61,6 +61,8 @@ -+ -+ package com.sun.org.apache.xerces.internal.util; -+ import com.sun.org.apache.xerces.internal.impl.Constants; -++import java.security.AccessController; -++import java.security.PrivilegedAction; -+ /** -+ * This class is a container for parser settings that relate to -+ * security, or more specifically, it is intended to be used to prevent denial-of-service -+@@ -77,6 +79,7 @@ -+ * -+ * @author Neil Graham, IBM -+ * -++ * @version $Id: SecurityManager.java,v 1.5 2010-11-01 04:40:14 joehw Exp $ -+ */ -+ public final class SecurityManager { -+ -+@@ -176,41 +179,48 @@ -+ -+ private void readSystemProperties(){ -+ -+- //TODO: also read SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT -+- try { -+- String value = System.getProperty(Constants.ENTITY_EXPANSION_LIMIT); -+- if(value != null && !value.equals("")){ -+- entityExpansionLimit = Integer.parseInt(value); -+- if (entityExpansionLimit < 0) -+- entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; -+- } -+- else -+- entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; -+- }catch(Exception ex){} -+- -+- try { -+- String value = System.getProperty(Constants.MAX_OCCUR_LIMIT); -+- if(value != null && !value.equals("")){ -+- maxOccurLimit = Integer.parseInt(value); -+- if (maxOccurLimit < 0) -+- maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; -+- } -+- else -+- maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; -+- }catch(Exception ex){} -+- -+- try { -+- String value = System.getProperty(Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT); -+- if(value != null && !value.equals("")){ -+- fElementAttributeLimit = Integer.parseInt(value); -+- if ( fElementAttributeLimit < 0) -+- fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; -+- } -+- else -+- fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; -++ //TODO: also read SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT -++ try { -++ String value = getSystemProperty(Constants.ENTITY_EXPANSION_LIMIT); -++ if(value != null && !value.equals("")){ -++ entityExpansionLimit = Integer.parseInt(value); -++ if (entityExpansionLimit < 0) -++ entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; -++ } -++ else -++ entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; -++ }catch(Exception ex){} -++ -++ try { -++ String value = getSystemProperty(Constants.MAX_OCCUR_LIMIT); -++ if(value != null && !value.equals("")){ -++ maxOccurLimit = Integer.parseInt(value); -++ if (maxOccurLimit < 0) -++ maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; -++ } -++ else -++ maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; -++ }catch(Exception ex){} -++ -++ try { -++ String value = getSystemProperty(Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT); -++ if(value != null && !value.equals("")){ -++ fElementAttributeLimit = Integer.parseInt(value); -++ if ( fElementAttributeLimit < 0) -++ fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; -++ } -++ else -++ fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; -+ -+ }catch(Exception ex){} -+ -+ } -+ -++ private String getSystemProperty(final String propName) { -++ return AccessController.doPrivileged(new PrivilegedAction<String>() { -++ public String run() { -++ return System.getProperty(propName); -++ } -++ }); -++ } -+ } // class SecurityManager -+--- src/com/sun/org/apache/xerces/internal/utils/ConfigurationError.java 1970-01-01 01:00:00.000000000 +0100 -++++ src/com/sun/org/apache/xerces/internal/utils/ConfigurationError.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -0,0 +1,58 @@ -++/* -++ * reserved comment block -++ * DO NOT REMOVE OR ALTER! -++ */ -++/* -++ * Copyright 2001-2005 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.xerces.internal.utils; -++ -++/** -++ * A configuration error. This was an internal class in ObjectFactory previously -++ */ -++public final class ConfigurationError -++ extends Error { -++ -++ // -++ // Data -++ // -++ -++ /** Exception. */ -++ private Exception exception; -++ -++ // -++ // Constructors -++ // -++ -++ /** -++ * Construct a new instance with the specified detail string and -++ * exception. -++ */ -++ ConfigurationError(String msg, Exception x) { -++ super(msg); -++ this.exception = x; -++ } // <init>(String,Exception) -++ -++ // -++ // methods -++ // -++ -++ /** Returns the exception associated to this error. */ -++ public Exception getException() { -++ return exception; -++ } // getException():Exception -++ -++} // class ConfigurationError -+--- src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java 1970-01-01 01:00:00.000000000 +0100 -++++ src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -0,0 +1,436 @@ -++/* -++ * reserved comment block -++ * DO NOT REMOVE OR ALTER! -++ */ -++/* -++ * Copyright 2001-2005 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.xerces.internal.utils; -++ -++import java.io.InputStream; -++import java.io.IOException; -++import java.io.File; -++import java.io.FileInputStream; -++ -++import java.util.Properties; -++import java.io.BufferedReader; -++import java.io.InputStreamReader; -++ -++/** -++ * This class is duplicated for each JAXP subpackage so keep it in sync. -++ * It is package private and therefore is not exposed as part of the JAXP -++ * API. -++ * <p> -++ * This code is designed to implement the JAXP 1.1 spec pluggability -++ * feature and is designed to run on JDK version 1.1 and -++ * later, and to compile on JDK 1.2 and onward. -++ * The code also runs both as part of an unbundled jar file and -++ * when bundled as part of the JDK. -++ * <p> -++ * -++ * @version $Id: ObjectFactory.java,v 1.6 2010/04/23 01:44:34 joehw Exp $ -++ */ -++public final class ObjectFactory { -++ -++ // -++ // Constants -++ // -++ private static final String DEFAULT_INTERNAL_CLASSES = "com.sun.org.apache."; -++ -++ // name of default properties file to look for in JDK's jre/lib directory -++ private static final String DEFAULT_PROPERTIES_FILENAME = "xerces.properties"; -++ -++ /** Set to true for debugging */ -++ private static final boolean DEBUG = isDebugEnabled(); -++ -++ /** -++ * Default columns per line. -++ */ -++ private static final int DEFAULT_LINE_LENGTH = 80; -++ -++ /** cache the contents of the xerces.properties file. -++ * Until an attempt has been made to read this file, this will -++ * be null; if the file does not exist or we encounter some other error -++ * during the read, this will be empty. -++ */ -++ private static Properties fXercesProperties = null; -++ -++ /*** -++ * Cache the time stamp of the xerces.properties file so -++ * that we know if it's been modified and can invalidate -++ * the cache when necessary. -++ */ -++ private static long fLastModified = -1; -++ -++ // -++ // static methods -++ // -++ -++ /** -++ * Finds the implementation Class object in the specified order. The -++ * specified order is the following: -++ * <ol> -++ * <li>query the system property using <code>System.getProperty</code> -++ * <li>read <code>META-INF/services/<i>factoryId</i></code> file -++ * <li>use fallback classname -++ * </ol> -++ * -++ * @return Class object of factory, never null -++ * -++ * @param factoryId Name of the factory to find, same as -++ * a property name -++ * @param fallbackClassName Implementation class name, if nothing else -++ * is found. Use null to mean no fallback. -++ * -++ * @exception ObjectFactory.ConfigurationError -++ */ -++ public static Object createObject(String factoryId, String fallbackClassName) -++ throws ConfigurationError { -++ return createObject(factoryId, null, fallbackClassName); -++ } // createObject(String,String):Object -++ -++ /** -++ * Finds the implementation Class object in the specified order. The -++ * specified order is the following: -++ * <ol> -++ * <li>query the system property using <code>System.getProperty</code> -++ * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -++ * <li>read <code>META-INF/services/<i>factoryId</i></code> file -++ * <li>use fallback classname -++ * </ol> -++ * -++ * @return Class object of factory, never null -++ * -++ * @param factoryId Name of the factory to find, same as -++ * a property name -++ * @param propertiesFilename The filename in the $java.home/lib directory -++ * of the properties file. If none specified, -++ * ${java.home}/lib/xerces.properties will be used. -++ * @param fallbackClassName Implementation class name, if nothing else -++ * is found. Use null to mean no fallback. -++ * -++ * @exception ObjectFactory.ConfigurationError -++ */ -++ public static Object createObject(String factoryId, -++ String propertiesFilename, -++ String fallbackClassName) -++ throws ConfigurationError -++ { -++ if (DEBUG) debugPrintln("debug is on"); -++ -++ ClassLoader cl = findClassLoader(); -++ -++ // Use the system property first -++ try { -++ String systemProp = SecuritySupport.getSystemProperty(factoryId); -++ if (systemProp != null && systemProp.length() > 0) { -++ if (DEBUG) debugPrintln("found system property, value=" + systemProp); -++ return newInstance(systemProp, cl, true); -++ } -++ } catch (SecurityException se) { -++ // Ignore and continue w/ next location -++ } -++ -++ // JAXP specific change -++ // always use fallback class to avoid the expense of constantly -++ // "stat"ing a non-existent "xerces.properties" and jar SPI entry -++ // see CR 6400863: Expensive creating of SAX parser in Mustang -++ if (fallbackClassName == null) { -++ throw new ConfigurationError( -++ "Provider for " + factoryId + " cannot be found", null); -++ } -++ -++ if (DEBUG) debugPrintln("using fallback, value=" + fallbackClassName); -++ return newInstance(fallbackClassName, cl, true); -++ -++ } // createObject(String,String,String):Object -++ -++ // -++ // Private static methods -++ // -++ -++ /** Returns true if debug has been enabled. */ -++ private static boolean isDebugEnabled() { -++ try { -++ String val = SecuritySupport.getSystemProperty("xerces.debug"); -++ // Allow simply setting the prop to turn on debug -++ return (val != null && (!"false".equals(val))); -++ } -++ catch (SecurityException se) {} -++ return false; -++ } // isDebugEnabled() -++ -++ /** Prints a message to standard error if debugging is enabled. */ -++ private static void debugPrintln(String msg) { -++ if (DEBUG) { -++ System.err.println("XERCES: " + msg); -++ } -++ } // debugPrintln(String) -++ -++ /** -++ * Figure out which ClassLoader to use. For JDK 1.2 and later use -++ * the context ClassLoader. -++ */ -++ public static ClassLoader findClassLoader() -++ throws ConfigurationError -++ { -++ if (System.getSecurityManager()!=null) { -++ //this will ensure bootclassloader is used -++ return null; -++ } -++ // Figure out which ClassLoader to use for loading the provider -++ // class. If there is a Context ClassLoader then use it. -++ ClassLoader context = SecuritySupport.getContextClassLoader(); -++ ClassLoader system = SecuritySupport.getSystemClassLoader(); -++ -++ ClassLoader chain = system; -++ while (true) { -++ if (context == chain) { -++ // Assert: we are on JDK 1.1 or we have no Context ClassLoader -++ // or any Context ClassLoader in chain of system classloader -++ // (including extension ClassLoader) so extend to widest -++ // ClassLoader (always look in system ClassLoader if Xerces -++ // is in boot/extension/system classpath and in current -++ // ClassLoader otherwise); normal classloaders delegate -++ // back to system ClassLoader first so this widening doesn't -++ // change the fact that context ClassLoader will be consulted -++ ClassLoader current = ObjectFactory.class.getClassLoader(); -++ -++ chain = system; -++ while (true) { -++ if (current == chain) { -++ // Assert: Current ClassLoader in chain of -++ // boot/extension/system ClassLoaders -++ return system; -++ } -++ if (chain == null) { -++ break; -++ } -++ chain = SecuritySupport.getParentClassLoader(chain); -++ } -++ -++ // Assert: Current ClassLoader not in chain of -++ // boot/extension/system ClassLoaders -++ return current; -++ } -++ -++ if (chain == null) { -++ // boot ClassLoader reached -++ break; -++ } -++ -++ // Check for any extension ClassLoaders in chain up to -++ // boot ClassLoader -++ chain = SecuritySupport.getParentClassLoader(chain); -++ }; -++ -++ // Assert: Context ClassLoader not in chain of -++ // boot/extension/system ClassLoaders -++ return context; -++ } // findClassLoader():ClassLoader -++ -++ /** -++ * Create an instance of a class using the same classloader for the ObjectFactory by default -++ * or bootclassloader when Security Manager is in place -++ */ -++ public static Object newInstance(String className, boolean doFallback) -++ throws ConfigurationError -++ { -++ if (System.getSecurityManager()!=null) { -++ return newInstance(className, null, doFallback); -++ } else { -++ return newInstance(className, -++ findClassLoader (), doFallback); -++ } -++ } -++ -++ /** -++ * Create an instance of a class using the specified ClassLoader -++ */ -++ public static Object newInstance(String className, ClassLoader cl, -++ boolean doFallback) -++ throws ConfigurationError -++ { -++ // assert(className != null); -++ try{ -++ Class providerClass = findProviderClass(className, cl, doFallback); -++ Object instance = providerClass.newInstance(); -++ if (DEBUG) debugPrintln("created new instance of " + providerClass + -++ " using ClassLoader: " + cl); -++ return instance; -++ } catch (ClassNotFoundException x) { -++ throw new ConfigurationError( -++ "Provider " + className + " not found", x); -++ } catch (Exception x) { -++ throw new ConfigurationError( -++ "Provider " + className + " could not be instantiated: " + x, -++ x); -++ } -++ } -++ -++ /** -++ * Find a Class using the same classloader for the ObjectFactory by default -++ * or bootclassloader when Security Manager is in place -++ */ -++ public static Class findProviderClass(String className, boolean doFallback) -++ throws ClassNotFoundException, ConfigurationError -++ { -++ if (System.getSecurityManager()!=null) { -++ return Class.forName(className); -++ } else { -++ return findProviderClass (className, -++ findClassLoader (), doFallback); -++ } -++ } -++ /** -++ * Find a Class using the specified ClassLoader -++ */ -++ public static Class findProviderClass(String className, ClassLoader cl, -++ boolean doFallback) -++ throws ClassNotFoundException, ConfigurationError -++ { -++ //throw security exception if the calling thread is not allowed to access the package -++ //restrict the access to package as speicified in java.security policy -++ SecurityManager security = System.getSecurityManager(); -++ if (security != null) { -++ if (className.startsWith(DEFAULT_INTERNAL_CLASSES)) { -++ cl = null; -++ } else { -++ final int lastDot = className.lastIndexOf("."); -++ String packageName = className; -++ if (lastDot != -1) packageName = className.substring(0, lastDot); -++ security.checkPackageAccess(packageName); -++ } -++ } -++ Class providerClass; -++ if (cl == null) { -++ //use the bootstrap ClassLoader. -++ providerClass = Class.forName(className); -++ } else { -++ try { -++ providerClass = cl.loadClass(className); -++ } catch (ClassNotFoundException x) { -++ if (doFallback) { -++ // Fall back to current classloader -++ ClassLoader current = ObjectFactory.class.getClassLoader(); -++ if (current == null) { -++ providerClass = Class.forName(className); -++ } else if (cl != current) { -++ cl = current; -++ providerClass = cl.loadClass(className); -++ } else { -++ throw x; -++ } -++ } else { -++ throw x; -++ } -++ } -++ } -++ -++ return providerClass; -++ } -++ -++ /* -++ * Try to find provider using Jar Service Provider Mechanism -++ * -++ * @return instance of provider class if found or null -++ */ -++ private static Object findJarServiceProvider(String factoryId) -++ throws ConfigurationError -++ { -++ String serviceId = "META-INF/services/" + factoryId; -++ InputStream is = null; -++ -++ // First try the Context ClassLoader -++ ClassLoader cl = findClassLoader(); -++ -++ is = SecuritySupport.getResourceAsStream(cl, serviceId); -++ -++ // If no provider found then try the current ClassLoader -++ if (is == null) { -++ ClassLoader current = ObjectFactory.class.getClassLoader(); -++ if (cl != current) { -++ cl = current; -++ is = SecuritySupport.getResourceAsStream(cl, serviceId); -++ } -++ } -++ -++ if (is == null) { -++ // No provider found -++ return null; -++ } -++ -++ if (DEBUG) debugPrintln("found jar resource=" + serviceId + -++ " using ClassLoader: " + cl); -++ -++ // Read the service provider name in UTF-8 as specified in -++ // the jar spec. Unfortunately this fails in Microsoft -++ // VJ++, which does not implement the UTF-8 -++ // encoding. Theoretically, we should simply let it fail in -++ // that case, since the JVM is obviously broken if it -++ // doesn't support such a basic standard. But since there -++ // are still some users attempting to use VJ++ for -++ // development, we have dropped in a fallback which makes a -++ // second attempt using the platform's default encoding. In -++ // VJ++ this is apparently ASCII, which is a subset of -++ // UTF-8... and since the strings we'll be reading here are -++ // also primarily limited to the 7-bit ASCII range (at -++ // least, in English versions), this should work well -++ // enough to keep us on the air until we're ready to -++ // officially decommit from VJ++. [Edited comment from -++ // jkesselm] -++ BufferedReader rd; -++ try { -++ rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); -++ } catch (java.io.UnsupportedEncodingException e) { -++ rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); -++ } -++ -++ String factoryClassName = null; -++ try { -++ // XXX Does not handle all possible input as specified by the -++ // Jar Service Provider specification -++ factoryClassName = rd.readLine(); -++ } catch (IOException x) { -++ // No provider found -++ return null; -++ } -++ finally { -++ try { -++ // try to close the reader. -++ rd.close(); -++ } -++ // Ignore the exception. -++ catch (IOException exc) {} -++ } -++ -++ if (factoryClassName != null && -++ ! "".equals(factoryClassName)) { -++ if (DEBUG) debugPrintln("found in resource, value=" -++ + factoryClassName); -++ -++ // Note: here we do not want to fall back to the current -++ // ClassLoader because we want to avoid the case where the -++ // resource file was found using one ClassLoader and the -++ // provider class was instantiated using a different one. -++ return newInstance(factoryClassName, cl, false); -++ } -++ -++ // No provider found -++ return null; -++ } -++ -++} // class ObjectFactory -+--- src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java 1970-01-01 01:00:00.000000000 +0100 -++++ src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -0,0 +1,199 @@ -++/* -++ * 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.xerces.internal.utils; -++ -++import java.io.File; -++import java.io.FileInputStream; -++import java.io.FileNotFoundException; -++import java.io.InputStream; -++ -++import java.security.AccessController; -++import java.security.PrivilegedAction; -++import java.security.PrivilegedActionException; -++import java.security.PrivilegedExceptionAction; -++import java.util.Locale; -++import java.util.MissingResourceException; -++import java.util.PropertyResourceBundle; -++import java.util.ResourceBundle; -++ -++/** -++ * This class is duplicated for each subpackage so keep it in sync. -++ * 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(ObjectFactory.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 ResourceBundle getResourceBundle(String bundle) { -++ return getResourceBundle(bundle, Locale.getDefault()); -++ } -++ -++ /** -++ * Gets a resource bundle using the specified base name and locale, and the caller's class loader. -++ * @param bundle the base name of the resource bundle, a fully qualified class name -++ * @param locale the locale for which a resource bundle is desired -++ * @return a resource bundle for the given base name and locale -++ */ -++ public static ResourceBundle getResourceBundle(final String bundle, final Locale locale) { -++ return AccessController.doPrivileged(new PrivilegedAction<ResourceBundle>() { -++ public ResourceBundle run() { -++ try { -++ return PropertyResourceBundle.getBundle(bundle, locale); -++ } catch (MissingResourceException e) { -++ try { -++ return PropertyResourceBundle.getBundle(bundle, new Locale("en", "US")); -++ } catch (MissingResourceException e2) { -++ throw new MissingResourceException( -++ "Could not load any resource bundle by " + bundle, bundle, ""); -++ } -++ } -++ } -++ }); -++ } -++ -++ static boolean getFileExists(final File f) { -++ return ((Boolean) -++ AccessController.doPrivileged(new PrivilegedAction() { -++ 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(); -++ } -++ -++ private SecuritySupport () {} -++} -+--- src/com/sun/org/apache/xerces/internal/xinclude/XIncludeMessageFormatter.java 2013-04-16 14:28:09.628154939 +0100 -++++ src/com/sun/org/apache/xerces/internal/xinclude/XIncludeMessageFormatter.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -20,11 +20,11 @@ -+ -+ package com.sun.org.apache.xerces.internal.xinclude; -+ -++import com.sun.org.apache.xerces.internal.util.MessageFormatter; -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import java.util.Locale; -+ import java.util.MissingResourceException; -+ import java.util.ResourceBundle; -+-import java.util.PropertyResourceBundle; -+-import com.sun.org.apache.xerces.internal.util.MessageFormatter; -+ -+ // TODO: fix error messages in XIncludeMessages.properties -+ /** -+@@ -32,6 +32,7 @@ -+ * -+ * @author Peter McCracken, IBM -+ * -++ * @version $Id: XIncludeMessageFormatter.java,v 1.7 2010-11-01 04:40:18 joehw Exp $ -+ */ -+ public class XIncludeMessageFormatter implements MessageFormatter { -+ -+@@ -61,12 +62,12 @@ -+ -+ if (fResourceBundle == null || locale != fLocale) { -+ if (locale != null) { -+- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages", locale); -++ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages", locale); -+ // memorize the most-recent locale -+ fLocale = locale; -+ } -+ if (fResourceBundle == null) -+- fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages"); -++ fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages"); -+ } -+ -+ String msg = fResourceBundle.getString(key); -+--- src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java 2013-04-16 14:28:09.636155069 +0100 -++++ src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -24,6 +24,7 @@ -+ import java.util.ResourceBundle; -+ import java.util.PropertyResourceBundle; -+ import com.sun.org.apache.xerces.internal.util.MessageFormatter; -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ -+ /** -+ * XPointerMessageFormatter provides error messages for the XPointer Framework -+@@ -31,6 +32,7 @@ -+ * -+ * @xerces.internal -+ * -++ * @version $Id: XPointerMessageFormatter.java,v 1.5 2010-11-01 04:40:26 joehw Exp $ -+ */ -+ class XPointerMessageFormatter implements MessageFormatter { -+ -+@@ -64,14 +66,14 @@ -+ -+ if (fResourceBundle == null || locale != fLocale) { -+ if (locale != null) { -+- fResourceBundle = PropertyResourceBundle.getBundle( -++ fResourceBundle = SecuritySupport.getResourceBundle( -+ "com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages", locale); -+ // memorize the most-recent locale -+ fLocale = locale; -+ } -+ if (fResourceBundle == null) -+- fResourceBundle = PropertyResourceBundle -+- .getBundle("com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages"); -++ fResourceBundle = SecuritySupport.getResourceBundle( -++ "com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages"); -+ } -+ -+ String msg = fResourceBundle.getString(key); -+--- src/com/sun/org/apache/xml/internal/dtm/DTMManager.java 2013-04-16 14:28:09.644155197 +0100 -++++ src/com/sun/org/apache/xml/internal/dtm/DTMManager.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -26,6 +26,7 @@ -+ import com.sun.org.apache.xml.internal.res.XMLMessages; -+ import com.sun.org.apache.xml.internal.utils.PrefixResolver; -+ import com.sun.org.apache.xml.internal.utils.XMLStringFactory; -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ -+ /** -+ * A DTMManager instance can be used to create DTM and -+@@ -358,7 +359,7 @@ -+ { -+ try -+ { -+- debug = System.getProperty("dtm.debug") != null; -++ debug = SecuritySupport.getSystemProperty("dtm.debug") != null; -+ } -+ catch (SecurityException ex){} -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ca.java 2013-04-16 14:28:09.664155519 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ca.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_cs.java 2013-04-16 14:28:09.664155519 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_cs.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_de.java 2013-04-16 14:28:09.664155519 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_de.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java 2013-04-16 14:28:09.664155519 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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("es", "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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_fr.java 2013-04-16 14:28:09.664155519 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_fr.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_it.java 2013-04-16 14:28:09.664155519 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_it.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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("it", "IT")); -+- } -+- 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ja.java 2013-04-16 14:28:09.664155519 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ja.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources.java 2013-04-16 14:28:09.660155456 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources.java 2013-04-16 14:29:26.557394511 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -461,67 +458,4 @@ -+ 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java 2013-04-16 14:28:09.664155519 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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("ko", "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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sk.java 2013-04-16 14:28:09.664155519 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sk.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_tr.java 2013-04-16 14:28:09.668155584 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_tr.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_CN.java 2013-04-16 14:28:09.668155584 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_CN.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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("zh", "CN")); -+- } -+- catch (MissingResourceException e2) -+- { -+- -+- // Now we are really in trouble. -+- // very bad, definitely very bad...not going to get very far -+- throw new MissingResourceException( -+- "\u65e0\u6cd5\u88c5\u5165\u4efb\u4f55\u8d44\u6e90\u5305\u3002", 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_TW.java 2013-04-16 14:28:09.668155584 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_TW.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -24,9 +24,6 @@ -+ -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -442,67 +439,4 @@ -+ }; -+ } -+ -+- /** -+- * 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("zh", "TW")); -+- } -+- 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xml/internal/res/XMLMessages.java 2013-04-16 14:28:09.668155584 +0100 -++++ src/com/sun/org/apache/xml/internal/res/XMLMessages.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -22,10 +22,9 @@ -+ */ -+ package com.sun.org.apache.xml.internal.res; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import java.util.ListResourceBundle; -+ import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * A utility class for issuing XML error messages. -+@@ -82,8 +81,9 @@ -+ */ -+ public static final String createXMLMessage(String msgKey, Object args[]) -+ { -+- if (XMLBundle == null) -+- XMLBundle = loadResourceBundle(XML_ERROR_RESOURCES); -++ if (XMLBundle == null) { -++ XMLBundle = SecuritySupport.getResourceBundle(XML_ERROR_RESOURCES); -++ } -+ -+ if (XMLBundle != null) -+ { -+@@ -156,61 +156,4 @@ -+ 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; -+- } -+ } -+--- src/com/sun/org/apache/xml/internal/resolver/Catalog.java 2013-04-16 14:28:09.668155584 +0100 -++++ src/com/sun/org/apache/xml/internal/resolver/Catalog.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -23,6 +23,8 @@ -+ -+ package com.sun.org.apache.xml.internal.resolver; -+ -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -++ -+ import java.io.IOException; -+ import java.io.FileNotFoundException; -+ import java.io.InputStream; -+@@ -819,7 +821,7 @@ -+ // tack on a basename because URLs point to files not dirs -+ catalogCwd = FileURL.makeURL("basename"); -+ } catch (MalformedURLException e) { -+- String userdir = System.getProperty("user.dir"); -++ String userdir = SecuritySupport.getSystemProperty("user.dir"); -+ userdir.replace('\\', '/'); -+ catalogManager.debug.message(1, "Malformed URL on cwd", userdir); -+ catalogCwd = null; -+@@ -1715,7 +1717,7 @@ -+ protected String resolveLocalSystem(String systemId) -+ throws MalformedURLException, IOException { -+ -+- String osname = System.getProperty("os.name"); -++ String osname = SecuritySupport.getSystemProperty("os.name"); -+ boolean windows = (osname.indexOf("Windows") >= 0); -+ Enumeration en = catalogEntries.elements(); -+ while (en.hasMoreElements()) { -+--- src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java 2013-04-16 14:28:09.668155584 +0100 -++++ src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -23,6 +23,7 @@ -+ -+ package com.sun.org.apache.xml.internal.resolver; -+ -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import java.io.InputStream; -+ -+ import java.net.URL; -+@@ -141,8 +142,8 @@ -+ -+ /** Flag to ignore missing property files and/or properties */ -+ private boolean ignoreMissingProperties -+- = (System.getProperty(pIgnoreMissing) != null -+- || System.getProperty(pFiles) != null); -++ = (SecuritySupport.getSystemProperty(pIgnoreMissing) != null -++ || SecuritySupport.getSystemProperty(pFiles) != null); -+ -+ /** Holds the resources after they are loaded from the file. */ -+ private ResourceBundle resources; -+@@ -331,7 +332,7 @@ -+ private int queryVerbosity () { -+ String defaultVerbStr = Integer.toString(defaultVerbosity); -+ -+- String verbStr = System.getProperty(pVerbosity); -++ String verbStr = SecuritySupport.getSystemProperty(pVerbosity); -+ -+ if (verbStr == null) { -+ if (resources==null) readProperties(); -+@@ -466,7 +467,7 @@ -+ * @return A semicolon delimited list of catlog file URIs -+ */ -+ private String queryCatalogFiles () { -+- String catalogList = System.getProperty(pFiles); -++ String catalogList = SecuritySupport.getSystemProperty(pFiles); -+ fromPropertiesFile = false; -+ -+ if (catalogList == null) { -+@@ -551,7 +552,7 @@ -+ * defaultPreferSetting. -+ */ -+ private boolean queryPreferPublic () { -+- String prefer = System.getProperty(pPrefer); -++ String prefer = SecuritySupport.getSystemProperty(pPrefer); -+ -+ if (prefer == null) { -+ if (resources==null) readProperties(); -+@@ -610,7 +611,7 @@ -+ * defaultUseStaticCatalog. -+ */ -+ private boolean queryUseStaticCatalog () { -+- String staticCatalog = System.getProperty(pStatic); -++ String staticCatalog = SecuritySupport.getSystemProperty(pStatic); -+ -+ if (staticCatalog == null) { -+ if (resources==null) readProperties(); -+@@ -741,7 +742,7 @@ -+ * defaultOasisXMLCatalogPI. -+ */ -+ public boolean queryAllowOasisXMLCatalogPI () { -+- String allow = System.getProperty(pAllowPI); -++ String allow = SecuritySupport.getSystemProperty(pAllowPI); -+ -+ if (allow == null) { -+ if (resources==null) readProperties(); -+@@ -794,7 +795,7 @@ -+ * -+ */ -+ public String queryCatalogClassName () { -+- String className = System.getProperty(pClassname); -++ String className = SecuritySupport.getSystemProperty(pClassname); -+ -+ if (className == null) { -+ if (resources==null) readProperties(); -+--- src/com/sun/org/apache/xml/internal/resolver/Resolver.java 2013-04-16 14:28:09.668155584 +0100 -++++ src/com/sun/org/apache/xml/internal/resolver/Resolver.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -31,6 +31,7 @@ -+ import java.net.URL; -+ import java.net.URLConnection; -+ import java.net.MalformedURLException; -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader; -+ import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader; -+ import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader; -+@@ -521,7 +522,7 @@ -+ */ -+ private Vector resolveAllLocalSystem(String systemId) { -+ Vector map = new Vector(); -+- String osname = System.getProperty("os.name"); -++ String osname = SecuritySupport.getSystemProperty("os.name"); -+ boolean windows = (osname.indexOf("Windows") >= 0); -+ Enumeration en = catalogEntries.elements(); -+ while (en.hasMoreElements()) { -+@@ -549,7 +550,7 @@ -+ */ -+ private Vector resolveLocalSystemReverse(String systemId) { -+ Vector map = new Vector(); -+- String osname = System.getProperty("os.name"); -++ String osname = SecuritySupport.getSystemProperty("os.name"); -+ boolean windows = (osname.indexOf("Windows") >= 0); -+ Enumeration en = catalogEntries.elements(); -+ while (en.hasMoreElements()) { -+--- src/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java 2013-04-16 14:28:09.684155841 +0100 -++++ src/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -21,6 +21,7 @@ -+ -+ package com.sun.org.apache.xml.internal.serialize; -+ -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ -+ import java.io.OutputStream; -+ import java.io.Writer; -+@@ -63,7 +64,7 @@ -+ factory = new SerializerFactoryImpl( Method.TEXT ); -+ registerSerializerFactory( factory ); -+ -+- list = System.getProperty( FactoriesProperty ); -++ list = SecuritySupport.getSystemProperty( FactoriesProperty ); -+ if ( list != null ) { -+ token = new StringTokenizer( list, " ;,:" ); -+ while ( token.hasMoreTokens() ) { -+--- src/com/sun/org/apache/xml/internal/serializer/Encodings.java 2013-04-16 14:28:09.684155841 +0100 -++++ src/com/sun/org/apache/xml/internal/serializer/Encodings.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -34,6 +34,7 @@ -+ import java.util.Properties; -+ import java.util.StringTokenizer; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ -+ /** -+ * Provides information about encodings. Depends on the Java runtime -+@@ -218,7 +219,7 @@ -+ // Get the default system character encoding. This may be -+ // incorrect if they passed in a writer, but right now there -+ // seems to be no way to get the encoding from a writer. -+- encoding = System.getProperty("file.encoding", "UTF8"); -++ encoding = SecuritySupport.getSystemProperty("file.encoding", "UTF8"); -+ -+ if (null != encoding) -+ { -+@@ -312,7 +313,7 @@ -+ -+ try -+ { -+- urlString = System.getProperty(ENCODINGS_PROP, ""); -++ urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, ""); -+ } -+ catch (SecurityException e) -+ { -+@@ -324,9 +325,7 @@ -+ } -+ -+ if (is == null) { -+- SecuritySupport ss = SecuritySupport.getInstance(); -+- is = ss.getResourceAsStream(ObjectFactory.findClassLoader(), -+- ENCODINGS_FILE); -++ is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE); -+ } -+ -+ Properties props = new Properties(); -+--- src/com/sun/org/apache/xml/internal/serializer/ObjectFactory.java 2013-04-16 14:28:09.688155906 +0100 -++++ src/com/sun/org/apache/xml/internal/serializer/ObjectFactory.java 1970-01-01 01:00:00.000000000 +0100 -+@@ -1,662 +0,0 @@ -+-/* -+- * reserved comment block -+- * DO NOT REMOVE OR ALTER! -+- */ -+-/* -+- * Copyright 2001-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. -+- */ -+-/* -+- * $Id: ObjectFactory.java,v 1.2.4.1 2005/09/15 08:15:20 suresh_emailid Exp $ -+- */ -+- -+-package com.sun.org.apache.xml.internal.serializer; -+- -+-import java.io.BufferedReader; -+-import java.io.File; -+-import java.io.FileInputStream; -+-import java.io.IOException; -+-import java.io.InputStream; -+-import java.io.InputStreamReader; -+-import java.util.Properties; -+- -+-/** -+- * This class is duplicated for each JAXP subpackage so keep it in sync. -+- * It is package private and therefore is not exposed as part of the JAXP -+- * API. -+- * <p> -+- * This code is designed to implement the JAXP 1.1 spec pluggability -+- * feature and is designed to run on JDK version 1.1 and -+- * later, and to compile on JDK 1.2 and onward. -+- * The code also runs both as part of an unbundled jar file and -+- * when bundled as part of the JDK. -+- * <p> -+- * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code> -+- * class and modified to be used as a general utility for creating objects -+- * dynamically. -+- * -+- * @xsl.usage internal -+- */ -+-class ObjectFactory { -+- -+- // -+- // Constants -+- // -+- -+- // name of default properties file to look for in JDK's jre/lib directory -+- private static final String DEFAULT_PROPERTIES_FILENAME = -+- "xalan.properties"; -+- -+- private static final String SERVICES_PATH = "META-INF/services/"; -+- -+- /** Set to true for debugging */ -+- private static final boolean DEBUG = false; -+- -+- /** cache the contents of the xalan.properties file. -+- * Until an attempt has been made to read this file, this will -+- * be null; if the file does not exist or we encounter some other error -+- * during the read, this will be empty. -+- */ -+- private static Properties fXalanProperties = null; -+- -+- /*** -+- * Cache the time stamp of the xalan.properties file so -+- * that we know if it's been modified and can invalidate -+- * the cache when necessary. -+- */ -+- private static long fLastModified = -1; -+- -+- // -+- // Public static methods -+- // -+- -+- /** -+- * Finds the implementation Class object in the specified order. The -+- * specified order is the following: -+- * <ol> -+- * <li>query the system property using <code>System.getProperty</code> -+- * <li>read <code>META-INF/services/<i>factoryId</i></code> file -+- * <li>use fallback classname -+- * </ol> -+- * -+- * @return instance of factory, never null -+- * -+- * @param factoryId Name of the factory to find, same as -+- * a property name -+- * @param fallbackClassName Implementation class name, if nothing else -+- * is found. Use null to mean no fallback. -+- * -+- * @exception ObjectFactory.ConfigurationError -+- */ -+- static Object createObject(String factoryId, String fallbackClassName) -+- throws ConfigurationError { -+- return createObject(factoryId, null, fallbackClassName); -+- } // createObject(String,String):Object -+- -+- /** -+- * Finds the implementation Class object in the specified order. The -+- * specified order is the following: -+- * <ol> -+- * <li>query the system property using <code>System.getProperty</code> -+- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -+- * <li>read <code>META-INF/services/<i>factoryId</i></code> file -+- * <li>use fallback classname -+- * </ol> -+- * -+- * @return instance of factory, never null -+- * -+- * @param factoryId Name of the factory to find, same as -+- * a property name -+- * @param propertiesFilename The filename in the $java.home/lib directory -+- * of the properties file. If none specified, -+- * ${java.home}/lib/xalan.properties will be used. -+- * @param fallbackClassName Implementation class name, if nothing else -+- * is found. Use null to mean no fallback. -+- * -+- * @exception ObjectFactory.ConfigurationError -+- */ -+- static Object createObject(String factoryId, -+- String propertiesFilename, -+- String fallbackClassName) -+- throws ConfigurationError -+- { -+- Class factoryClass = lookUpFactoryClass(factoryId, -+- propertiesFilename, -+- fallbackClassName); -+- -+- if (factoryClass == null) { -+- throw new ConfigurationError( -+- "Provider for " + factoryId + " cannot be found", null); -+- } -+- -+- try{ -+- Object instance = factoryClass.newInstance(); -+- if (DEBUG) debugPrintln("created new instance of factory " + factoryId); -+- return instance; -+- } catch (Exception x) { -+- throw new ConfigurationError( -+- "Provider for factory " + factoryId -+- + " could not be instantiated: " + x, x); -+- } -+- } // createObject(String,String,String):Object -+- -+- /** -+- * Finds the implementation Class object in the specified order. The -+- * specified order is the following: -+- * <ol> -+- * <li>query the system property using <code>System.getProperty</code> -+- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -+- * <li>read <code>META-INF/services/<i>factoryId</i></code> file -+- * <li>use fallback classname -+- * </ol> -+- * -+- * @return Class object of factory, never null -+- * -+- * @param factoryId Name of the factory to find, same as -+- * a property name -+- * @param propertiesFilename The filename in the $java.home/lib directory -+- * of the properties file. If none specified, -+- * ${java.home}/lib/xalan.properties will be used. -+- * @param fallbackClassName Implementation class name, if nothing else -+- * is found. Use null to mean no fallback. -+- * -+- * @exception ObjectFactory.ConfigurationError -+- */ -+- static Class lookUpFactoryClass(String factoryId) -+- throws ConfigurationError -+- { -+- return lookUpFactoryClass(factoryId, null, null); -+- } // lookUpFactoryClass(String):Class -+- -+- /** -+- * Finds the implementation Class object in the specified order. The -+- * specified order is the following: -+- * <ol> -+- * <li>query the system property using <code>System.getProperty</code> -+- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -+- * <li>read <code>META-INF/services/<i>factoryId</i></code> file -+- * <li>use fallback classname -+- * </ol> -+- * -+- * @return Class object that provides factory service, never null -+- * -+- * @param factoryId Name of the factory to find, same as -+- * a property name -+- * @param propertiesFilename The filename in the $java.home/lib directory -+- * of the properties file. If none specified, -+- * ${java.home}/lib/xalan.properties will be used. -+- * @param fallbackClassName Implementation class name, if nothing else -+- * is found. Use null to mean no fallback. -+- * -+- * @exception ObjectFactory.ConfigurationError -+- */ -+- static Class lookUpFactoryClass(String factoryId, -+- String propertiesFilename, -+- String fallbackClassName) -+- throws ConfigurationError -+- { -+- String factoryClassName = lookUpFactoryClassName(factoryId, -+- propertiesFilename, -+- fallbackClassName); -+- ClassLoader cl = findClassLoader(); -+- -+- if (factoryClassName == null) { -+- factoryClassName = fallbackClassName; -+- } -+- -+- // assert(className != null); -+- try{ -+- Class providerClass = findProviderClass(factoryClassName, -+- cl, -+- true); -+- if (DEBUG) debugPrintln("created new instance of " + providerClass + -+- " using ClassLoader: " + cl); -+- return providerClass; -+- } catch (ClassNotFoundException x) { -+- throw new ConfigurationError( -+- "Provider " + factoryClassName + " not found", x); -+- } catch (Exception x) { -+- throw new ConfigurationError( -+- "Provider "+factoryClassName+" could not be instantiated: "+x, -+- x); -+- } -+- } // lookUpFactoryClass(String,String,String):Class -+- -+- /** -+- * Finds the name of the required implementation class in the specified -+- * order. The specified order is the following: -+- * <ol> -+- * <li>query the system property using <code>System.getProperty</code> -+- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -+- * <li>read <code>META-INF/services/<i>factoryId</i></code> file -+- * <li>use fallback classname -+- * </ol> -+- * -+- * @return name of class that provides factory service, never null -+- * -+- * @param factoryId Name of the factory to find, same as -+- * a property name -+- * @param propertiesFilename The filename in the $java.home/lib directory -+- * of the properties file. If none specified, -+- * ${java.home}/lib/xalan.properties will be used. -+- * @param fallbackClassName Implementation class name, if nothing else -+- * is found. Use null to mean no fallback. -+- * -+- * @exception ObjectFactory.ConfigurationError -+- */ -+- static String lookUpFactoryClassName(String factoryId, -+- String propertiesFilename, -+- String fallbackClassName) -+- { -+- SecuritySupport ss = SecuritySupport.getInstance(); -+- -+- // Use the system property first -+- try { -+- String systemProp = ss.getSystemProperty(factoryId); -+- if (systemProp != null) { -+- if (DEBUG) debugPrintln("found system property, value=" + systemProp); -+- return systemProp; -+- } -+- } catch (SecurityException se) { -+- // Ignore and continue w/ next location -+- } -+- -+- // Try to read from propertiesFilename, or -+- // $java.home/lib/xalan.properties -+- String factoryClassName = null; -+- // no properties file name specified; use -+- // $JAVA_HOME/lib/xalan.properties: -+- if (propertiesFilename == null) { -+- File propertiesFile = null; -+- boolean propertiesFileExists = false; -+- try { -+- String javah = ss.getSystemProperty("java.home"); -+- propertiesFilename = javah + File.separator + -+- "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; -+- propertiesFile = new File(propertiesFilename); -+- propertiesFileExists = ss.getFileExists(propertiesFile); -+- } catch (SecurityException e) { -+- // try again... -+- fLastModified = -1; -+- fXalanProperties = null; -+- } -+- -+- synchronized (ObjectFactory.class) { -+- boolean loadProperties = false; -+- FileInputStream fis = null; -+- try { -+- // file existed last time -+- if(fLastModified >= 0) { -+- if(propertiesFileExists && -+- (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { -+- loadProperties = true; -+- } else { -+- // file has stopped existing... -+- if(!propertiesFileExists) { -+- fLastModified = -1; -+- fXalanProperties = null; -+- } // else, file wasn't modified! -+- } -+- } else { -+- // file has started to exist: -+- if(propertiesFileExists) { -+- loadProperties = true; -+- fLastModified = ss.getLastModified(propertiesFile); -+- } // else, nothing's changed -+- } -+- if(loadProperties) { -+- // must never have attempted to read xalan.properties -+- // before (or it's outdeated) -+- fXalanProperties = new Properties(); -+- fis = ss.getFileInputStream(propertiesFile); -+- fXalanProperties.load(fis); -+- } -+- } catch (Exception x) { -+- fXalanProperties = null; -+- fLastModified = -1; -+- // assert(x instanceof FileNotFoundException -+- // || x instanceof SecurityException) -+- // In both cases, ignore and continue w/ next location -+- } -+- finally { -+- // try to close the input stream if one was opened. -+- if (fis != null) { -+- try { -+- fis.close(); -+- } -+- // Ignore the exception. -+- catch (IOException exc) {} -+- } -+- } -+- } -+- if(fXalanProperties != null) { -+- factoryClassName = fXalanProperties.getProperty(factoryId); -+- } -+- } else { -+- FileInputStream fis = null; -+- try { -+- fis = ss.getFileInputStream(new File(propertiesFilename)); -+- Properties props = new Properties(); -+- props.load(fis); -+- factoryClassName = props.getProperty(factoryId); -+- } catch (Exception x) { -+- // assert(x instanceof FileNotFoundException -+- // || x instanceof SecurityException) -+- // In both cases, ignore and continue w/ next location -+- } -+- finally { -+- // try to close the input stream if one was opened. -+- if (fis != null) { -+- try { -+- fis.close(); -+- } -+- // Ignore the exception. -+- catch (IOException exc) {} -+- } -+- } -+- } -+- if (factoryClassName != null) { -+- if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value=" -+- + factoryClassName); -+- return factoryClassName; -+- } -+- -+- // Try Jar Service Provider Mechanism -+- return findJarServiceProviderName(factoryId); -+- } // lookUpFactoryClass(String,String):String -+- -+- // -+- // Private static methods -+- // -+- -+- /** Prints a message to standard error if debugging is enabled. */ -+- private static void debugPrintln(String msg) { -+- if (DEBUG) { -+- System.err.println("JAXP: " + msg); -+- } -+- } // debugPrintln(String) -+- -+- /** -+- * Figure out which ClassLoader to use. For JDK 1.2 and later use -+- * the context ClassLoader. -+- */ -+- static ClassLoader findClassLoader() -+- throws ConfigurationError -+- { -+- SecuritySupport ss = SecuritySupport.getInstance(); -+- -+- // Figure out which ClassLoader to use for loading the provider -+- // class. If there is a Context ClassLoader then use it. -+- ClassLoader context = ss.getContextClassLoader(); -+- ClassLoader system = ss.getSystemClassLoader(); -+- -+- ClassLoader chain = system; -+- while (true) { -+- if (context == chain) { -+- // Assert: we are on JDK 1.1 or we have no Context ClassLoader -+- // or any Context ClassLoader in chain of system classloader -+- // (including extension ClassLoader) so extend to widest -+- // ClassLoader (always look in system ClassLoader if Xalan -+- // is in boot/extension/system classpath and in current -+- // ClassLoader otherwise); normal classloaders delegate -+- // back to system ClassLoader first so this widening doesn't -+- // change the fact that context ClassLoader will be consulted -+- ClassLoader current = ObjectFactory.class.getClassLoader(); -+- -+- chain = system; -+- while (true) { -+- if (current == chain) { -+- // Assert: Current ClassLoader in chain of -+- // boot/extension/system ClassLoaders -+- return system; -+- } -+- if (chain == null) { -+- break; -+- } -+- chain = ss.getParentClassLoader(chain); -+- } -+- -+- // Assert: Current ClassLoader not in chain of -+- // boot/extension/system ClassLoaders -+- return current; -+- } -+- -+- if (chain == null) { -+- // boot ClassLoader reached -+- break; -+- } -+- -+- // Check for any extension ClassLoaders in chain up to -+- // boot ClassLoader -+- chain = ss.getParentClassLoader(chain); -+- }; -+- -+- // Assert: Context ClassLoader not in chain of -+- // boot/extension/system ClassLoaders -+- return context; -+- } // findClassLoader():ClassLoader -+- -+- /** -+- * Create an instance of a class using the specified ClassLoader -+- */ -+- static Object newInstance(String className, ClassLoader cl, -+- boolean doFallback) -+- throws ConfigurationError -+- { -+- // assert(className != null); -+- try{ -+- Class providerClass = findProviderClass(className, cl, doFallback); -+- Object instance = providerClass.newInstance(); -+- if (DEBUG) debugPrintln("created new instance of " + providerClass + -+- " using ClassLoader: " + cl); -+- return instance; -+- } catch (ClassNotFoundException x) { -+- throw new ConfigurationError( -+- "Provider " + className + " not found", x); -+- } catch (Exception x) { -+- throw new ConfigurationError( -+- "Provider " + className + " could not be instantiated: " + x, -+- x); -+- } -+- } -+- -+- /** -+- * Find a Class using the specified ClassLoader -+- */ -+- static Class findProviderClass(String className, ClassLoader cl, -+- boolean doFallback) -+- throws ClassNotFoundException, ConfigurationError -+- { -+- //throw security exception if the calling thread is not allowed to access the -+- //class. Restrict the access to the package classes as specified in java.security policy. -+- SecurityManager security = System.getSecurityManager(); -+- try{ -+- if (security != null){ -+- final int lastDot = className.lastIndexOf("."); -+- String packageName = className; -+- if (lastDot != -1) packageName = className.substring(0, lastDot); -+- security.checkPackageAccess(packageName); -+- } -+- }catch(SecurityException e){ -+- throw e; -+- } -+- -+- Class providerClass; -+- if (cl == null) { -+- // XXX Use the bootstrap ClassLoader. There is no way to -+- // load a class using the bootstrap ClassLoader that works -+- // in both JDK 1.1 and Java 2. However, this should still -+- // work b/c the following should be true: -+- // -+- // (cl == null) iff current ClassLoader == null -+- // -+- // Thus Class.forName(String) will use the current -+- // ClassLoader which will be the bootstrap ClassLoader. -+- providerClass = Class.forName(className); -+- } else { -+- try { -+- providerClass = cl.loadClass(className); -+- } catch (ClassNotFoundException x) { -+- if (doFallback) { -+- // Fall back to current classloader -+- ClassLoader current = ObjectFactory.class.getClassLoader(); -+- if (current == null) { -+- providerClass = Class.forName(className); -+- } else if (cl != current) { -+- cl = current; -+- providerClass = cl.loadClass(className); -+- } else { -+- throw x; -+- } -+- } else { -+- throw x; -+- } -+- } -+- } -+- -+- return providerClass; -+- } -+- -+- /** -+- * Find the name of service provider using Jar Service Provider Mechanism -+- * -+- * @return instance of provider class if found or null -+- */ -+- private static String findJarServiceProviderName(String factoryId) -+- { -+- SecuritySupport ss = SecuritySupport.getInstance(); -+- String serviceId = SERVICES_PATH + factoryId; -+- InputStream is = null; -+- -+- // First try the Context ClassLoader -+- ClassLoader cl = findClassLoader(); -+- -+- is = ss.getResourceAsStream(cl, serviceId); -+- -+- // If no provider found then try the current ClassLoader -+- if (is == null) { -+- ClassLoader current = ObjectFactory.class.getClassLoader(); -+- if (cl != current) { -+- cl = current; -+- is = ss.getResourceAsStream(cl, serviceId); -+- } -+- } -+- -+- if (is == null) { -+- // No provider found -+- return null; -+- } -+- -+- if (DEBUG) debugPrintln("found jar resource=" + serviceId + -+- " using ClassLoader: " + cl); -+- -+- // Read the service provider name in UTF-8 as specified in -+- // the jar spec. Unfortunately this fails in Microsoft -+- // VJ++, which does not implement the UTF-8 -+- // encoding. Theoretically, we should simply let it fail in -+- // that case, since the JVM is obviously broken if it -+- // doesn't support such a basic standard. But since there -+- // are still some users attempting to use VJ++ for -+- // development, we have dropped in a fallback which makes a -+- // second attempt using the platform's default encoding. In -+- // VJ++ this is apparently ASCII, which is a subset of -+- // UTF-8... and since the strings we'll be reading here are -+- // also primarily limited to the 7-bit ASCII range (at -+- // least, in English versions), this should work well -+- // enough to keep us on the air until we're ready to -+- // officially decommit from VJ++. [Edited comment from -+- // jkesselm] -+- BufferedReader rd; -+- try { -+- rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); -+- } catch (java.io.UnsupportedEncodingException e) { -+- rd = new BufferedReader(new InputStreamReader(is)); -+- } -+- -+- String factoryClassName = null; -+- try { -+- // XXX Does not handle all possible input as specified by the -+- // Jar Service Provider specification -+- factoryClassName = rd.readLine(); -+- } catch (IOException x) { -+- // No provider found -+- return null; -+- } -+- finally { -+- try { -+- // try to close the reader. -+- rd.close(); -+- } -+- // Ignore the exception. -+- catch (IOException exc) {} -+- } -+- -+- if (factoryClassName != null && -+- ! "".equals(factoryClassName)) { -+- if (DEBUG) debugPrintln("found in resource, value=" -+- + factoryClassName); -+- -+- // Note: here we do not want to fall back to the current -+- // ClassLoader because we want to avoid the case where the -+- // resource file was found using one ClassLoader and the -+- // provider class was instantiated using a different one. -+- return factoryClassName; -+- } -+- -+- // No provider found -+- return null; -+- } -+- -+- // -+- // Classes -+- // -+- -+- /** -+- * A configuration error. -+- */ -+- static class ConfigurationError -+- extends Error { -+- static final long serialVersionUID = 8859254254255146542L; -+- // -+- // Data -+- // -+- -+- /** Exception. */ -+- private Exception exception; -+- -+- // -+- // Constructors -+- // -+- -+- /** -+- * Construct a new instance with the specified detail string and -+- * exception. -+- */ -+- ConfigurationError(String msg, Exception x) { -+- super(msg); -+- this.exception = x; -+- } // <init>(String,Exception) -+- -+- // -+- // Public methods -+- // -+- -+- /** Returns the exception associated to this error. */ -+- Exception getException() { -+- return exception; -+- } // getException():Exception -+- -+- } // class ConfigurationError -+- -+-} // class ObjectFactory -+--- src/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java 2013-04-16 14:28:09.688155906 +0100 -++++ src/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java 2013-04-16 14:29:26.561394576 +0100 -+@@ -22,6 +22,7 @@ -+ */ -+ package com.sun.org.apache.xml.internal.serializer; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import java.io.BufferedInputStream; -+ import java.io.IOException; -+ import java.io.InputStream; -+@@ -451,7 +452,7 @@ -+ String value = null; -+ try -+ { -+- value = System.getProperty(key); -++ value = SecuritySupport.getSystemProperty(key); -+ } -+ catch (SecurityException se) -+ { -+@@ -464,7 +465,7 @@ -+ String newValue = null; -+ try -+ { -+- newValue = System.getProperty(newKey); -++ newValue = SecuritySupport.getSystemProperty(newKey); -+ } -+ catch (SecurityException se) -+ { -+--- src/com/sun/org/apache/xml/internal/serializer/SecuritySupport12.java 2013-04-16 14:28:09.688155906 +0100 -++++ src/com/sun/org/apache/xml/internal/serializer/SecuritySupport12.java 1970-01-01 01:00:00.000000000 +0100 -+@@ -1,145 +0,0 @@ -+-/* -+- * 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. -+- */ -+-/* -+- * $Id: SecuritySupport12.java,v 1.2.4.1 2005/09/15 08:15:22 suresh_emailid Exp $ -+- */ -+- -+-package com.sun.org.apache.xml.internal.serializer; -+- -+-import java.io.File; -+-import java.io.FileInputStream; -+-import java.io.FileNotFoundException; -+-import java.io.InputStream; -+-import java.security.AccessController; -+-import java.security.PrivilegedAction; -+-import java.security.PrivilegedActionException; -+-import java.security.PrivilegedExceptionAction; -+- -+-/** -+- * This class is duplicated for each Xalan-Java subpackage so keep it in sync. -+- * It is package private and therefore is not exposed as part of the Xalan-Java -+- * API. -+- * -+- * Security related methods that only work on J2SE 1.2 and newer. -+- */ -+-class SecuritySupport12 extends SecuritySupport { -+- -+- ClassLoader getContextClassLoader() { -+- return (ClassLoader) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- ClassLoader cl = null; -+- try { -+- cl = Thread.currentThread().getContextClassLoader(); -+- } catch (SecurityException ex) { } -+- return cl; -+- } -+- }); -+- } -+- -+- ClassLoader getSystemClassLoader() { -+- return (ClassLoader) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- ClassLoader cl = null; -+- try { -+- cl = ClassLoader.getSystemClassLoader(); -+- } catch (SecurityException ex) {} -+- return cl; -+- } -+- }); -+- } -+- -+- 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; -+- } -+- }); -+- } -+- -+- String getSystemProperty(final String propName) { -+- return (String) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- return System.getProperty(propName); -+- } -+- }); -+- } -+- -+- FileInputStream getFileInputStream(final File file) -+- throws FileNotFoundException -+- { -+- try { -+- return (FileInputStream) -+- AccessController.doPrivileged(new PrivilegedExceptionAction() { -+- public Object run() throws FileNotFoundException { -+- return new FileInputStream(file); -+- } -+- }); -+- } catch (PrivilegedActionException e) { -+- throw (FileNotFoundException)e.getException(); -+- } -+- } -+- -+- InputStream getResourceAsStream(final ClassLoader cl, -+- final String name) -+- { -+- return (InputStream) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- InputStream ris; -+- if (cl == null) { -+- ris = ClassLoader.getSystemResourceAsStream(name); -+- } else { -+- ris = cl.getResourceAsStream(name); -+- } -+- return ris; -+- } -+- }); -+- } -+- -+- boolean getFileExists(final File f) { -+- return ((Boolean) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- return new Boolean(f.exists()); -+- } -+- })).booleanValue(); -+- } -+- -+- long getLastModified(final File f) { -+- return ((Long) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- return new Long(f.lastModified()); -+- } -+- })).longValue(); -+- } -+- -+-} -+--- src/com/sun/org/apache/xml/internal/serializer/SecuritySupport.java 2013-04-16 14:28:09.688155906 +0100 -++++ src/com/sun/org/apache/xml/internal/serializer/SecuritySupport.java 1970-01-01 01:00:00.000000000 +0100 -+@@ -1,125 +0,0 @@ -+-/* -+- * 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. -+- */ -+-/* -+- * $Id: SecuritySupport.java,v 1.2.4.1 2005/09/15 08:15:21 suresh_emailid Exp $ -+- */ -+- -+-package com.sun.org.apache.xml.internal.serializer; -+- -+-import java.io.File; -+-import java.io.FileInputStream; -+-import java.io.FileNotFoundException; -+-import java.io.InputStream; -+- -+-/** -+- * This class is duplicated for each Xalan-Java subpackage so keep it in sync. -+- * It is package private and therefore is not exposed as part of the Xalan-Java -+- * API. -+- * -+- * Base class with security related methods that work on JDK 1.1. -+- */ -+-class SecuritySupport { -+- -+- /* -+- * Make this of type Object so that the verifier won't try to -+- * prove its type, thus possibly trying to load the SecuritySupport12 -+- * class. -+- */ -+- private static final Object securitySupport; -+- -+- static { -+- SecuritySupport ss = null; -+- try { -+- Class c = Class.forName("java.security.AccessController"); -+- // if that worked, we're on 1.2. -+- /* -+- // don't reference the class explicitly so it doesn't -+- // get dragged in accidentally. -+- c = Class.forName("javax.mail.SecuritySupport12"); -+- Constructor cons = c.getConstructor(new Class[] { }); -+- ss = (SecuritySupport)cons.newInstance(new Object[] { }); -+- */ -+- /* -+- * Unfortunately, we can't load the class using reflection -+- * because the class is package private. And the class has -+- * to be package private so the APIs aren't exposed to other -+- * code that could use them to circumvent security. Thus, -+- * we accept the risk that the direct reference might fail -+- * on some JDK 1.1 JVMs, even though we would never execute -+- * this code in such a case. Sigh... -+- */ -+- ss = new SecuritySupport12(); -+- } catch (Exception ex) { -+- // ignore it -+- } finally { -+- if (ss == null) -+- ss = new SecuritySupport(); -+- securitySupport = ss; -+- } -+- } -+- -+- /** -+- * Return an appropriate instance of this class, depending on whether -+- * we're on a JDK 1.1 or J2SE 1.2 (or later) system. -+- */ -+- static SecuritySupport getInstance() { -+- return (SecuritySupport)securitySupport; -+- } -+- -+- ClassLoader getContextClassLoader() { -+- return null; -+- } -+- -+- ClassLoader getSystemClassLoader() { -+- return null; -+- } -+- -+- ClassLoader getParentClassLoader(ClassLoader cl) { -+- return null; -+- } -+- -+- String getSystemProperty(String propName) { -+- return System.getProperty(propName); -+- } -+- -+- FileInputStream getFileInputStream(File file) -+- throws FileNotFoundException -+- { -+- return new FileInputStream(file); -+- } -+- -+- InputStream getResourceAsStream(ClassLoader cl, String name) { -+- InputStream ris; -+- if (cl == null) { -+- ris = ClassLoader.getSystemResourceAsStream(name); -+- } else { -+- ris = cl.getResourceAsStream(name); -+- } -+- return ris; -+- } -+- -+- boolean getFileExists(File f) { -+- return f.exists(); -+- } -+- -+- long getLastModified(File f) { -+- return f.lastModified(); -+- } -+-} -+--- src/com/sun/org/apache/xml/internal/serializer/ToStream.java 2013-04-16 14:28:09.700156100 +0100 -++++ src/com/sun/org/apache/xml/internal/serializer/ToStream.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -22,6 +22,7 @@ -+ */ -+ package com.sun.org.apache.xml.internal.serializer; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import java.io.IOException; -+ import java.io.OutputStream; -+ import java.io.UnsupportedEncodingException; -+@@ -140,7 +141,7 @@ -+ * extension attribute xalan:line-separator. -+ */ -+ protected char[] m_lineSep = -+- System.getProperty("line.separator").toCharArray(); -++ SecuritySupport.getSystemProperty("line.separator").toCharArray(); -+ -+ /** -+ * True if the the system line separator is to be used. -+--- src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java 2013-04-16 14:28:09.704156164 +0100 -++++ src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -22,6 +22,7 @@ -+ */ -+ package com.sun.org.apache.xml.internal.serializer; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import java.io.File; -+ -+ import com.sun.org.apache.xml.internal.serializer.utils.AttList; -+@@ -104,7 +105,7 @@ -+ else { -+ try { -+ // Bug see Bugzilla 26741 -+- m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); -++ m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl"); -+ } -+ catch (SecurityException se) {// user.dir not accessible from applet -+ } -+@@ -115,7 +116,7 @@ -+ m_contentHandler.setDocumentLocator(m_locator); -+ try { -+ // Bug see Bugzilla 26741 -+- m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); -++ m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl"); -+ } -+ catch (SecurityException se){// user.dir not accessible from applet -+ -+--- src/com/sun/org/apache/xml/internal/serializer/utils/Messages.java 2013-04-16 14:28:09.708156229 +0100 -++++ src/com/sun/org/apache/xml/internal/serializer/utils/Messages.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -22,6 +22,7 @@ -+ */ -+ package com.sun.org.apache.xml.internal.serializer.utils; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import java.util.ListResourceBundle; -+ import java.util.Locale; -+ import java.util.MissingResourceException; -+@@ -87,9 +88,6 @@ -+ * can have the Message strings translated in an alternate language -+ * in a errorResourceClass with a language suffix. -+ * -+- * More sophisticated use of this class would be to pass null -+- * when contructing it, but then call loadResourceBundle() -+- * before creating any messages. -+ * -+ * This class is not a public API, it is only public because it is -+ * used in com.sun.org.apache.xml.internal.serializer. -+@@ -126,18 +124,6 @@ -+ 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. -+@@ -151,16 +137,6 @@ -+ } -+ -+ /** -+- * Get the ListResourceBundle being used by this Messages instance which was -+- * previously set by a call to loadResourceBundle(className) -+- * @xsl.usage internal -+- */ -+- private ListResourceBundle getResourceBundle() -+- { -+- return m_resourceBundle; -+- } -+- -+- /** -+ * Creates a message from the specified key and replacement -+ * arguments, localized to the given locale. -+ * -+@@ -174,7 +150,7 @@ -+ public final String createMessage(String msgKey, Object args[]) -+ { -+ if (m_resourceBundle == null) -+- m_resourceBundle = loadResourceBundle(m_resourceBundleName); -++ m_resourceBundle = SecuritySupport.getResourceBundle(m_resourceBundleName); -+ -+ if (m_resourceBundle != null) -+ { -+@@ -293,76 +269,4 @@ -+ 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; -+- } -+ } -+--- src/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java 2013-04-16 14:28:09.728156552 +0100 -++++ src/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -22,6 +22,8 @@ -+ */ -+ package com.sun.org.apache.xml.internal.utils.res; -+ -++import java.security.AccessController; -++import java.security.PrivilegedAction; -+ import java.util.ListResourceBundle; -+ import java.util.Locale; -+ import java.util.MissingResourceException; -+@@ -29,114 +31,45 @@ -+ -+ /** -+ * The default (english) resource bundle. -++ * -+ * @xsl.usage internal -+ */ -+-public class XResourceBundle extends ListResourceBundle -+-{ -++public class XResourceBundle extends ListResourceBundle { -+ -+- /** Error resource constants */ -+- public static final String ERROR_RESOURCES = -+- "com.sun.org.apache.xalan.internal.res.XSLTErrorResources", XSLT_RESOURCE = -+- "com.sun.org.apache.xml.internal.utils.res.XResourceBundle", LANG_BUNDLE_NAME = -+- "com.sun.org.apache.xml.internal.utils.res.XResources", MULT_ORDER = -+- "multiplierOrder", MULT_PRECEDES = "precedes", MULT_FOLLOWS = -+- "follows", LANG_ORIENTATION = "orientation", LANG_RIGHTTOLEFT = -+- "rightToLeft", LANG_LEFTTORIGHT = "leftToRight", LANG_NUMBERING = -+- "numbering", LANG_ADDITIVE = "additive", LANG_MULT_ADD = -+- "multiplicative-additive", LANG_MULTIPLIER = -+- "multiplier", LANG_MULTIPLIER_CHAR = -+- "multiplierChar", LANG_NUMBERGROUPS = "numberGroups", LANG_NUM_TABLES = -+- "tables", LANG_ALPHABET = "alphabet", LANG_TRAD_ALPHABET = "tradAlphabet"; -+- -+- /** -+- * Return a named ResourceBundle for a particular locale. This method mimics the behavior -+- * of ResourceBundle.getBundle(). -+- * -+- * @param className Name of local-specific subclass. -+- * @param locale the locale to prefer when searching for the bundle -+- */ -+- public static final XResourceBundle loadResourceBundle( -+- String className, Locale locale) throws MissingResourceException -+- { -+- -+- String suffix = getResourceSuffix(locale); -+- -+- //System.out.println("resource " + className + suffix); -+- try -+- { -+- -+- // first try with the given locale -+- String resourceName = className + suffix; -+- return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale); -++ /** -++ * Error resource constants -++ */ -++ public static final String ERROR_RESOURCES = -++ "com.sun.org.apache.xalan.internal.res.XSLTErrorResources", XSLT_RESOURCE = -++ "com.sun.org.apache.xml.internal.utils.res.XResourceBundle", LANG_BUNDLE_NAME = -++ "com.sun.org.apache.xml.internal.utils.res.XResources", MULT_ORDER = -++ "multiplierOrder", MULT_PRECEDES = "precedes", MULT_FOLLOWS = -++ "follows", LANG_ORIENTATION = "orientation", LANG_RIGHTTOLEFT = -++ "rightToLeft", LANG_LEFTTORIGHT = "leftToRight", LANG_NUMBERING = -++ "numbering", LANG_ADDITIVE = "additive", LANG_MULT_ADD = -++ "multiplicative-additive", LANG_MULTIPLIER = -++ "multiplier", LANG_MULTIPLIER_CHAR = -++ "multiplierChar", LANG_NUMBERGROUPS = "numberGroups", LANG_NUM_TABLES = -++ "tables", LANG_ALPHABET = "alphabet", LANG_TRAD_ALPHABET = "tradAlphabet"; -++ -++ -++ /** -++ * Get the association list. -++ * -++ * @return The association list. -++ */ -++ public Object[][] getContents() { -++ return new Object[][]{ -++ {"ui_language", "en"}, {"help_language", "en"}, {"language", "en"}, -++ {"alphabet", new CharArrayWrapper(new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', -++ 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', -++ 'V', 'W', 'X', 'Y', 'Z'})}, -++ {"tradAlphabet", new CharArrayWrapper(new char[]{'A', 'B', 'C', 'D', 'E', 'F', -++ 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', -++ 'U', 'V', 'W', 'X', 'Y', 'Z'})}, -++ //language orientation -++ {"orientation", "LeftToRight"}, -++ //language numbering -++ {"numbering", "additive"},}; -+ } -+- catch (MissingResourceException e) -+- { -+- try // try to fall back to en_US if we can't load -+- { -+- -+- // Since we can't find the localized property file, -+- // fall back to en_US. -+- return (XResourceBundle) ResourceBundle.getBundle( -+- XSLT_RESOURCE, new Locale("en", "US")); -+- } -+- catch (MissingResourceException e2) -+- { -+- -+- // Now we are really in trouble. -+- // very bad, definitely very bad...not going to get very far -+- throw new MissingResourceException( -+- "Could not load any resource bundles.", className, ""); -+- } -+- } -+- } -+- -+- /** -+- * Return the resource file suffic for the indicated locale -+- * For most locales, this will be based the language code. However -+- * for Chinese, we do distinguish between Taiwan and PRC -+- * -+- * @param locale the locale -+- * @return an String suffix which canbe appended to a resource name -+- */ -+- private static final String getResourceSuffix(Locale locale) -+- { -+- -+- String lang = locale.getLanguage(); -+- String country = locale.getCountry(); -+- String variant = locale.getVariant(); -+- String suffix = "_" + locale.getLanguage(); -+- -+- if (lang.equals("zh")) -+- suffix += "_" + country; -+- -+- if (country.equals("JP")) -+- suffix += "_" + country + "_" + variant; -+- -+- return suffix; -+- } -+- -+- /** -+- * Get the association list. -+- * -+- * @return The association list. -+- */ -+- public Object[][] getContents() -+- { -+- return new Object[][] -+- { -+- { "ui_language", "en" }, { "help_language", "en" }, { "language", "en" }, -+- { "alphabet", new CharArrayWrapper(new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', -+- 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', -+- 'V', 'W', 'X', 'Y', 'Z' })}, -+- { "tradAlphabet", new CharArrayWrapper(new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', -+- 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', -+- 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, -+- -+- //language orientation -+- { "orientation", "LeftToRight" }, -+- -+- //language numbering -+- { "numbering", "additive" }, -+- }; -+- } -+ } -+--- src/com/sun/org/apache/xml/internal/utils/TreeWalker.java 2013-04-16 14:28:09.720156422 +0100 -++++ src/com/sun/org/apache/xml/internal/utils/TreeWalker.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -22,6 +22,7 @@ -+ */ -+ package com.sun.org.apache.xml.internal.utils; -+ -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ import java.io.File; -+ -+ import org.w3c.dom.Comment; -+@@ -93,7 +94,7 @@ -+ else { -+ try { -+ // Bug see Bugzilla 26741 -+- m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); -++ m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl"); -+ } -+ catch (SecurityException se) {// user.dir not accessible from applet -+ } -+@@ -112,7 +113,7 @@ -+ m_contentHandler.setDocumentLocator(m_locator); -+ try { -+ // Bug see Bugzilla 26741 -+- m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); -++ m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl"); -+ } -+ catch (SecurityException se){// user.dir not accessible from applet -+ } -+@@ -131,7 +132,7 @@ -+ m_contentHandler.setDocumentLocator(m_locator); -+ try { -+ // Bug see Bugzilla 26741 -+- m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); -++ m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl"); -+ } -+ catch (SecurityException se){// user.dir not accessible from applet -+ -+--- src/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java 2013-04-16 14:28:09.752156937 +0100 -++++ src/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -31,6 +31,8 @@ -+ import com.sun.org.apache.xpath.internal.objects.XObject; -+ import com.sun.org.apache.xpath.internal.objects.XString; -+ import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; -++import com.sun.org.apache.xalan.internal.utils.ObjectFactory; -++import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -+ -+ /** -+ * Execute the SystemProperty() function. -+@@ -100,7 +102,7 @@ -+ -+ try -+ { -+- result = System.getProperty(propName); -++ result = SecuritySupport.getSystemProperty(propName); -+ -+ if (null == result) -+ { -+@@ -122,7 +124,7 @@ -+ { -+ try -+ { -+- result = System.getProperty(fullName); -++ result = SecuritySupport.getSystemProperty(fullName); -+ -+ if (null == result) -+ { -+@@ -163,14 +165,12 @@ -+ * should already be fully qualified as path/filename -+ * @param target The target property bag the file will be placed into. -+ */ -+- private void loadPropertyFile(String file, Properties target) -++ public void loadPropertyFile(String file, Properties target) -+ { -+ try -+ { -+ // Use SecuritySupport class to provide priveleged access to property file -+- SecuritySupport ss = SecuritySupport.getInstance(); -+- -+- InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(), -++ InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(), -+ file); -+ -+ // get a buffered version -+--- src/com/sun/org/apache/xpath/internal/functions/ObjectFactory.java 2013-04-16 14:28:09.752156937 +0100 -++++ src/com/sun/org/apache/xpath/internal/functions/ObjectFactory.java 1970-01-01 01:00:00.000000000 +0100 -+@@ -1,663 +0,0 @@ -+-/* -+- * reserved comment block -+- * DO NOT REMOVE OR ALTER! -+- */ -+-/* -+- * Copyright 2001-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. -+- */ -+-/* -+- * $Id: ObjectFactory.java,v 1.2.4.1 2005/09/14 20:25:54 jeffsuttor Exp $ -+- */ -+- -+-package com.sun.org.apache.xpath.internal.functions; -+- -+-import java.io.InputStream; -+-import java.io.IOException; -+-import java.io.File; -+-import java.io.FileInputStream; -+- -+-import java.util.Properties; -+-import java.io.BufferedReader; -+-import java.io.InputStreamReader; -+- -+-/** -+- * This class is duplicated for each JAXP subpackage so keep it in sync. -+- * It is package private and therefore is not exposed as part of the JAXP -+- * API. -+- * <p> -+- * This code is designed to implement the JAXP 1.1 spec pluggability -+- * feature and is designed to run on JDK version 1.1 and -+- * later, and to compile on JDK 1.2 and onward. -+- * The code also runs both as part of an unbundled jar file and -+- * when bundled as part of the JDK. -+- * <p> -+- * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code> -+- * class and modified to be used as a general utility for creating objects -+- * dynamically. -+- * -+- * @version $Id: ObjectFactory.java,v 1.7 2008/04/02 00:40:59 joehw Exp $ -+- */ -+-class ObjectFactory { -+- -+- // -+- // Constants -+- // -+- -+- // name of default properties file to look for in JDK's jre/lib directory -+- private static final String DEFAULT_PROPERTIES_FILENAME = -+- "xalan.properties"; -+- -+- private static final String SERVICES_PATH = "META-INF/services/"; -+- -+- /** Set to true for debugging */ -+- private static final boolean DEBUG = false; -+- -+- /** cache the contents of the xalan.properties file. -+- * Until an attempt has been made to read this file, this will -+- * be null; if the file does not exist or we encounter some other error -+- * during the read, this will be empty. -+- */ -+- private static Properties fXalanProperties = null; -+- -+- /*** -+- * Cache the time stamp of the xalan.properties file so -+- * that we know if it's been modified and can invalidate -+- * the cache when necessary. -+- */ -+- private static long fLastModified = -1; -+- -+- // -+- // Public static methods -+- // -+- -+- /** -+- * Finds the implementation Class object in the specified order. The -+- * specified order is the following: -+- * <ol> -+- * <li>query the system property using <code>System.getProperty</code> -+- * <li>read <code>META-INF/services/<i>factoryId</i></code> file -+- * <li>use fallback classname -+- * </ol> -+- * -+- * @return instance of factory, never null -+- * -+- * @param factoryId Name of the factory to find, same as -+- * a property name -+- * @param fallbackClassName Implementation class name, if nothing else -+- * is found. Use null to mean no fallback. -+- * -+- * @exception ObjectFactory.ConfigurationError -+- */ -+- static Object createObject(String factoryId, String fallbackClassName) -+- throws ConfigurationError { -+- return createObject(factoryId, null, fallbackClassName); -+- } // createObject(String,String):Object -+- -+- /** -+- * Finds the implementation Class object in the specified order. The -+- * specified order is the following: -+- * <ol> -+- * <li>query the system property using <code>System.getProperty</code> -+- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -+- * <li>read <code>META-INF/services/<i>factoryId</i></code> file -+- * <li>use fallback classname -+- * </ol> -+- * -+- * @return instance of factory, never null -+- * -+- * @param factoryId Name of the factory to find, same as -+- * a property name -+- * @param propertiesFilename The filename in the $java.home/lib directory -+- * of the properties file. If none specified, -+- * ${java.home}/lib/xalan.properties will be used. -+- * @param fallbackClassName Implementation class name, if nothing else -+- * is found. Use null to mean no fallback. -+- * -+- * @exception ObjectFactory.ConfigurationError -+- */ -+- static Object createObject(String factoryId, -+- String propertiesFilename, -+- String fallbackClassName) -+- throws ConfigurationError -+- { -+- Class factoryClass = lookUpFactoryClass(factoryId, -+- propertiesFilename, -+- fallbackClassName); -+- -+- if (factoryClass == null) { -+- throw new ConfigurationError( -+- "Provider for " + factoryId + " cannot be found", null); -+- } -+- -+- try{ -+- Object instance = factoryClass.newInstance(); -+- if (DEBUG) debugPrintln("created new instance of factory " + factoryId); -+- return instance; -+- } catch (Exception x) { -+- throw new ConfigurationError( -+- "Provider for factory " + factoryId -+- + " could not be instantiated: " + x, x); -+- } -+- } // createObject(String,String,String):Object -+- -+- /** -+- * Finds the implementation Class object in the specified order. The -+- * specified order is the following: -+- * <ol> -+- * <li>query the system property using <code>System.getProperty</code> -+- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -+- * <li>read <code>META-INF/services/<i>factoryId</i></code> file -+- * <li>use fallback classname -+- * </ol> -+- * -+- * @return Class object of factory, never null -+- * -+- * @param factoryId Name of the factory to find, same as -+- * a property name -+- * @param propertiesFilename The filename in the $java.home/lib directory -+- * of the properties file. If none specified, -+- * ${java.home}/lib/xalan.properties will be used. -+- * @param fallbackClassName Implementation class name, if nothing else -+- * is found. Use null to mean no fallback. -+- * -+- * @exception ObjectFactory.ConfigurationError -+- */ -+- static Class lookUpFactoryClass(String factoryId) -+- throws ConfigurationError -+- { -+- return lookUpFactoryClass(factoryId, null, null); -+- } // lookUpFactoryClass(String):Class -+- -+- /** -+- * Finds the implementation Class object in the specified order. The -+- * specified order is the following: -+- * <ol> -+- * <li>query the system property using <code>System.getProperty</code> -+- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -+- * <li>read <code>META-INF/services/<i>factoryId</i></code> file -+- * <li>use fallback classname -+- * </ol> -+- * -+- * @return Class object that provides factory service, never null -+- * -+- * @param factoryId Name of the factory to find, same as -+- * a property name -+- * @param propertiesFilename The filename in the $java.home/lib directory -+- * of the properties file. If none specified, -+- * ${java.home}/lib/xalan.properties will be used. -+- * @param fallbackClassName Implementation class name, if nothing else -+- * is found. Use null to mean no fallback. -+- * -+- * @exception ObjectFactory.ConfigurationError -+- */ -+- static Class lookUpFactoryClass(String factoryId, -+- String propertiesFilename, -+- String fallbackClassName) -+- throws ConfigurationError -+- { -+- String factoryClassName = lookUpFactoryClassName(factoryId, -+- propertiesFilename, -+- fallbackClassName); -+- ClassLoader cl = findClassLoader(); -+- -+- if (factoryClassName == null) { -+- factoryClassName = fallbackClassName; -+- } -+- -+- // assert(className != null); -+- try{ -+- Class providerClass = findProviderClass(factoryClassName, -+- cl, -+- true); -+- if (DEBUG) debugPrintln("created new instance of " + providerClass + -+- " using ClassLoader: " + cl); -+- return providerClass; -+- } catch (ClassNotFoundException x) { -+- throw new ConfigurationError( -+- "Provider " + factoryClassName + " not found", x); -+- } catch (Exception x) { -+- throw new ConfigurationError( -+- "Provider "+factoryClassName+" could not be instantiated: "+x, -+- x); -+- } -+- } // lookUpFactoryClass(String,String,String):Class -+- -+- /** -+- * Finds the name of the required implementation class in the specified -+- * order. The specified order is the following: -+- * <ol> -+- * <li>query the system property using <code>System.getProperty</code> -+- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file -+- * <li>read <code>META-INF/services/<i>factoryId</i></code> file -+- * <li>use fallback classname -+- * </ol> -+- * -+- * @return name of class that provides factory service, never null -+- * -+- * @param factoryId Name of the factory to find, same as -+- * a property name -+- * @param propertiesFilename The filename in the $java.home/lib directory -+- * of the properties file. If none specified, -+- * ${java.home}/lib/xalan.properties will be used. -+- * @param fallbackClassName Implementation class name, if nothing else -+- * is found. Use null to mean no fallback. -+- * -+- * @exception ObjectFactory.ConfigurationError -+- */ -+- static String lookUpFactoryClassName(String factoryId, -+- String propertiesFilename, -+- String fallbackClassName) -+- { -+- SecuritySupport ss = SecuritySupport.getInstance(); -+- -+- // Use the system property first -+- try { -+- String systemProp = ss.getSystemProperty(factoryId); -+- if (systemProp != null) { -+- if (DEBUG) debugPrintln("found system property, value=" + systemProp); -+- return systemProp; -+- } -+- } catch (SecurityException se) { -+- // Ignore and continue w/ next location -+- } -+- -+- // Try to read from propertiesFilename, or -+- // $java.home/lib/xalan.properties -+- String factoryClassName = null; -+- // no properties file name specified; use -+- // $JAVA_HOME/lib/xalan.properties: -+- if (propertiesFilename == null) { -+- File propertiesFile = null; -+- boolean propertiesFileExists = false; -+- try { -+- String javah = ss.getSystemProperty("java.home"); -+- propertiesFilename = javah + File.separator + -+- "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; -+- propertiesFile = new File(propertiesFilename); -+- propertiesFileExists = ss.getFileExists(propertiesFile); -+- } catch (SecurityException e) { -+- // try again... -+- fLastModified = -1; -+- fXalanProperties = null; -+- } -+- -+- synchronized (ObjectFactory.class) { -+- boolean loadProperties = false; -+- FileInputStream fis = null; -+- try { -+- // file existed last time -+- if(fLastModified >= 0) { -+- if(propertiesFileExists && -+- (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { -+- loadProperties = true; -+- } else { -+- // file has stopped existing... -+- if(!propertiesFileExists) { -+- fLastModified = -1; -+- fXalanProperties = null; -+- } // else, file wasn't modified! -+- } -+- } else { -+- // file has started to exist: -+- if(propertiesFileExists) { -+- loadProperties = true; -+- fLastModified = ss.getLastModified(propertiesFile); -+- } // else, nothing's changed -+- } -+- if(loadProperties) { -+- // must never have attempted to read xalan.properties -+- // before (or it's outdeated) -+- fXalanProperties = new Properties(); -+- fis = ss.getFileInputStream(propertiesFile); -+- fXalanProperties.load(fis); -+- } -+- } catch (Exception x) { -+- fXalanProperties = null; -+- fLastModified = -1; -+- // assert(x instanceof FileNotFoundException -+- // || x instanceof SecurityException) -+- // In both cases, ignore and continue w/ next location -+- } -+- finally { -+- // try to close the input stream if one was opened. -+- if (fis != null) { -+- try { -+- fis.close(); -+- } -+- // Ignore the exception. -+- catch (IOException exc) {} -+- } -+- } -+- } -+- if(fXalanProperties != null) { -+- factoryClassName = fXalanProperties.getProperty(factoryId); -+- } -+- } else { -+- FileInputStream fis = null; -+- try { -+- fis = ss.getFileInputStream(new File(propertiesFilename)); -+- Properties props = new Properties(); -+- props.load(fis); -+- factoryClassName = props.getProperty(factoryId); -+- } catch (Exception x) { -+- // assert(x instanceof FileNotFoundException -+- // || x instanceof SecurityException) -+- // In both cases, ignore and continue w/ next location -+- } -+- finally { -+- // try to close the input stream if one was opened. -+- if (fis != null) { -+- try { -+- fis.close(); -+- } -+- // Ignore the exception. -+- catch (IOException exc) {} -+- } -+- } -+- } -+- if (factoryClassName != null) { -+- if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value=" -+- + factoryClassName); -+- return factoryClassName; -+- } -+- -+- // Try Jar Service Provider Mechanism -+- return findJarServiceProviderName(factoryId); -+- } // lookUpFactoryClass(String,String):String -+- -+- // -+- // Private static methods -+- // -+- -+- /** Prints a message to standard error if debugging is enabled. */ -+- private static void debugPrintln(String msg) { -+- if (DEBUG) { -+- System.err.println("JAXP: " + msg); -+- } -+- } // debugPrintln(String) -+- -+- /** -+- * Figure out which ClassLoader to use. For JDK 1.2 and later use -+- * the context ClassLoader. -+- */ -+- static ClassLoader findClassLoader() -+- throws ConfigurationError -+- { -+- SecuritySupport ss = SecuritySupport.getInstance(); -+- -+- // Figure out which ClassLoader to use for loading the provider -+- // class. If there is a Context ClassLoader then use it. -+- ClassLoader context = ss.getContextClassLoader(); -+- ClassLoader system = ss.getSystemClassLoader(); -+- -+- ClassLoader chain = system; -+- while (true) { -+- if (context == chain) { -+- // Assert: we are on JDK 1.1 or we have no Context ClassLoader -+- // or any Context ClassLoader in chain of system classloader -+- // (including extension ClassLoader) so extend to widest -+- // ClassLoader (always look in system ClassLoader if Xalan -+- // is in boot/extension/system classpath and in current -+- // ClassLoader otherwise); normal classloaders delegate -+- // back to system ClassLoader first so this widening doesn't -+- // change the fact that context ClassLoader will be consulted -+- ClassLoader current = ObjectFactory.class.getClassLoader(); -+- -+- chain = system; -+- while (true) { -+- if (current == chain) { -+- // Assert: Current ClassLoader in chain of -+- // boot/extension/system ClassLoaders -+- return system; -+- } -+- if (chain == null) { -+- break; -+- } -+- chain = ss.getParentClassLoader(chain); -+- } -+- -+- // Assert: Current ClassLoader not in chain of -+- // boot/extension/system ClassLoaders -+- return current; -+- } -+- -+- if (chain == null) { -+- // boot ClassLoader reached -+- break; -+- } -+- -+- // Check for any extension ClassLoaders in chain up to -+- // boot ClassLoader -+- chain = ss.getParentClassLoader(chain); -+- }; -+- -+- // Assert: Context ClassLoader not in chain of -+- // boot/extension/system ClassLoaders -+- return context; -+- } // findClassLoader():ClassLoader -+- -+- /** -+- * Create an instance of a class using the specified ClassLoader -+- */ -+- static Object newInstance(String className, ClassLoader cl, -+- boolean doFallback) -+- throws ConfigurationError -+- { -+- // assert(className != null); -+- try{ -+- Class providerClass = findProviderClass(className, cl, doFallback); -+- Object instance = providerClass.newInstance(); -+- if (DEBUG) debugPrintln("created new instance of " + providerClass + -+- " using ClassLoader: " + cl); -+- return instance; -+- } catch (ClassNotFoundException x) { -+- throw new ConfigurationError( -+- "Provider " + className + " not found", x); -+- } catch (Exception x) { -+- throw new ConfigurationError( -+- "Provider " + className + " could not be instantiated: " + x, -+- x); -+- } -+- } -+- -+- /** -+- * Find a Class using the specified ClassLoader -+- */ -+- static Class findProviderClass(String className, ClassLoader cl, -+- boolean doFallback) -+- throws ClassNotFoundException, ConfigurationError -+- { -+- //throw security exception if the calling thread is not allowed to access the -+- //class. Restrict the access to the package classes as specified in java.security policy. -+- SecurityManager security = System.getSecurityManager(); -+- try{ -+- if (security != null){ -+- final int lastDot = className.lastIndexOf("."); -+- String packageName = className; -+- if (lastDot != -1) packageName = className.substring(0, lastDot); -+- security.checkPackageAccess(packageName); -+- } -+- }catch(SecurityException e){ -+- throw e; -+- } -+- -+- Class providerClass; -+- if (cl == null) { -+- // XXX Use the bootstrap ClassLoader. There is no way to -+- // load a class using the bootstrap ClassLoader that works -+- // in both JDK 1.1 and Java 2. However, this should still -+- // work b/c the following should be true: -+- // -+- // (cl == null) iff current ClassLoader == null -+- // -+- // Thus Class.forName(String) will use the current -+- // ClassLoader which will be the bootstrap ClassLoader. -+- providerClass = Class.forName(className); -+- } else { -+- try { -+- providerClass = cl.loadClass(className); -+- } catch (ClassNotFoundException x) { -+- if (doFallback) { -+- // Fall back to current classloader -+- ClassLoader current = ObjectFactory.class.getClassLoader(); -+- if (current == null) { -+- providerClass = Class.forName(className); -+- } else if (cl != current) { -+- cl = current; -+- providerClass = cl.loadClass(className); -+- } else { -+- throw x; -+- } -+- } else { -+- throw x; -+- } -+- } -+- } -+- -+- return providerClass; -+- } -+- -+- /** -+- * Find the name of service provider using Jar Service Provider Mechanism -+- * -+- * @return instance of provider class if found or null -+- */ -+- private static String findJarServiceProviderName(String factoryId) -+- { -+- SecuritySupport ss = SecuritySupport.getInstance(); -+- String serviceId = SERVICES_PATH + factoryId; -+- InputStream is = null; -+- -+- // First try the Context ClassLoader -+- ClassLoader cl = findClassLoader(); -+- -+- is = ss.getResourceAsStream(cl, serviceId); -+- -+- // If no provider found then try the current ClassLoader -+- if (is == null) { -+- ClassLoader current = ObjectFactory.class.getClassLoader(); -+- if (cl != current) { -+- cl = current; -+- is = ss.getResourceAsStream(cl, serviceId); -+- } -+- } -+- -+- if (is == null) { -+- // No provider found -+- return null; -+- } -+- -+- if (DEBUG) debugPrintln("found jar resource=" + serviceId + -+- " using ClassLoader: " + cl); -+- -+- // Read the service provider name in UTF-8 as specified in -+- // the jar spec. Unfortunately this fails in Microsoft -+- // VJ++, which does not implement the UTF-8 -+- // encoding. Theoretically, we should simply let it fail in -+- // that case, since the JVM is obviously broken if it -+- // doesn't support such a basic standard. But since there -+- // are still some users attempting to use VJ++ for -+- // development, we have dropped in a fallback which makes a -+- // second attempt using the platform's default encoding. In -+- // VJ++ this is apparently ASCII, which is a subset of -+- // UTF-8... and since the strings we'll be reading here are -+- // also primarily limited to the 7-bit ASCII range (at -+- // least, in English versions), this should work well -+- // enough to keep us on the air until we're ready to -+- // officially decommit from VJ++. [Edited comment from -+- // jkesselm] -+- BufferedReader rd; -+- try { -+- rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); -+- } catch (java.io.UnsupportedEncodingException e) { -+- rd = new BufferedReader(new InputStreamReader(is)); -+- } -+- -+- String factoryClassName = null; -+- try { -+- // XXX Does not handle all possible input as specified by the -+- // Jar Service Provider specification -+- factoryClassName = rd.readLine(); -+- } catch (IOException x) { -+- // No provider found -+- return null; -+- } -+- finally { -+- try { -+- // try to close the reader. -+- rd.close(); -+- } -+- // Ignore the exception. -+- catch (IOException exc) {} -+- } -+- -+- if (factoryClassName != null && -+- ! "".equals(factoryClassName)) { -+- if (DEBUG) debugPrintln("found in resource, value=" -+- + factoryClassName); -+- -+- // Note: here we do not want to fall back to the current -+- // ClassLoader because we want to avoid the case where the -+- // resource file was found using one ClassLoader and the -+- // provider class was instantiated using a different one. -+- return factoryClassName; -+- } -+- -+- // No provider found -+- return null; -+- } -+- -+- // -+- // Classes -+- // -+- -+- /** -+- * A configuration error. -+- */ -+- static class ConfigurationError -+- extends Error { -+- static final long serialVersionUID = -5782303800588797207L; -+- // -+- // Data -+- // -+- -+- /** Exception. */ -+- private Exception exception; -+- -+- // -+- // Constructors -+- // -+- -+- /** -+- * Construct a new instance with the specified detail string and -+- * exception. -+- */ -+- ConfigurationError(String msg, Exception x) { -+- super(msg); -+- this.exception = x; -+- } // <init>(String,Exception) -+- -+- // -+- // Public methods -+- // -+- -+- /** Returns the exception associated to this error. */ -+- Exception getException() { -+- return exception; -+- } // getException():Exception -+- -+- } // class ConfigurationError -+- -+-} // class ObjectFactory -+--- src/com/sun/org/apache/xpath/internal/functions/SecuritySupport12.java 2013-04-16 14:28:09.752156937 +0100 -++++ src/com/sun/org/apache/xpath/internal/functions/SecuritySupport12.java 1970-01-01 01:00:00.000000000 +0100 -+@@ -1,148 +0,0 @@ -+-/* -+- * 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. -+- */ -+-/* -+- * $Id: SecuritySupport12.java,v 1.1.2.1 2005/08/01 01:29:45 jeffsuttor Exp $ -+- */ -+- -+-package com.sun.org.apache.xpath.internal.functions; -+- -+-import java.io.File; -+-import java.io.FileInputStream; -+-import java.io.FileNotFoundException; -+-import java.io.InputStream; -+- -+-import java.security.AccessController; -+-import java.security.PrivilegedAction; -+-import java.security.PrivilegedActionException; -+-import java.security.PrivilegedExceptionAction; -+- -+-import java.util.Properties; -+- -+-/** -+- * This class is duplicated for each Xalan-Java subpackage so keep it in sync. -+- * It is package private and therefore is not exposed as part of the Xalan-Java -+- * API. -+- * -+- * Security related methods that only work on J2SE 1.2 and newer. -+- */ -+-class SecuritySupport12 extends SecuritySupport { -+- -+- ClassLoader getContextClassLoader() { -+- return (ClassLoader) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- ClassLoader cl = null; -+- try { -+- cl = Thread.currentThread().getContextClassLoader(); -+- } catch (SecurityException ex) { } -+- return cl; -+- } -+- }); -+- } -+- -+- ClassLoader getSystemClassLoader() { -+- return (ClassLoader) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- ClassLoader cl = null; -+- try { -+- cl = ClassLoader.getSystemClassLoader(); -+- } catch (SecurityException ex) {} -+- return cl; -+- } -+- }); -+- } -+- -+- 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; -+- } -+- }); -+- } -+- -+- String getSystemProperty(final String propName) { -+- return (String) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- return System.getProperty(propName); -+- } -+- }); -+- } -+- -+- FileInputStream getFileInputStream(final File file) -+- throws FileNotFoundException -+- { -+- try { -+- return (FileInputStream) -+- AccessController.doPrivileged(new PrivilegedExceptionAction() { -+- public Object run() throws FileNotFoundException { -+- return new FileInputStream(file); -+- } -+- }); -+- } catch (PrivilegedActionException e) { -+- throw (FileNotFoundException)e.getException(); -+- } -+- } -+- -+- InputStream getResourceAsStream(final ClassLoader cl, -+- final String name) -+- { -+- return (InputStream) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- InputStream ris; -+- if (cl == null) { -+- ris = ClassLoader.getSystemResourceAsStream(name); -+- } else { -+- ris = cl.getResourceAsStream(name); -+- } -+- return ris; -+- } -+- }); -+- } -+- -+- boolean getFileExists(final File f) { -+- return ((Boolean) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- return new Boolean(f.exists()); -+- } -+- })).booleanValue(); -+- } -+- -+- long getLastModified(final File f) { -+- return ((Long) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- return new Long(f.lastModified()); -+- } -+- })).longValue(); -+- } -+- -+-} -+--- src/com/sun/org/apache/xpath/internal/functions/SecuritySupport.java 2013-04-16 14:28:09.752156937 +0100 -++++ src/com/sun/org/apache/xpath/internal/functions/SecuritySupport.java 1970-01-01 01:00:00.000000000 +0100 -+@@ -1,127 +0,0 @@ -+-/* -+- * 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. -+- */ -+-/* -+- * $Id: SecuritySupport.java,v 1.1.2.1 2005/08/01 01:29:39 jeffsuttor Exp $ -+- */ -+- -+-package com.sun.org.apache.xpath.internal.functions; -+- -+-import java.io.File; -+-import java.io.FileInputStream; -+-import java.io.FileNotFoundException; -+-import java.io.InputStream; -+- -+-import java.util.Properties; -+- -+-/** -+- * This class is duplicated for each Xalan-Java subpackage so keep it in sync. -+- * It is package private and therefore is not exposed as part of the Xalan-Java -+- * API. -+- * -+- * Base class with security related methods that work on JDK 1.1. -+- */ -+-class SecuritySupport { -+- -+- /* -+- * Make this of type Object so that the verifier won't try to -+- * prove its type, thus possibly trying to load the SecuritySupport12 -+- * class. -+- */ -+- private static final Object securitySupport; -+- -+- static { -+- SecuritySupport ss = null; -+- try { -+- Class c = Class.forName("java.security.AccessController"); -+- // if that worked, we're on 1.2. -+- /* -+- // don't reference the class explicitly so it doesn't -+- // get dragged in accidentally. -+- c = Class.forName("javax.mail.SecuritySupport12"); -+- Constructor cons = c.getConstructor(new Class[] { }); -+- ss = (SecuritySupport)cons.newInstance(new Object[] { }); -+- */ -+- /* -+- * Unfortunately, we can't load the class using reflection -+- * because the class is package private. And the class has -+- * to be package private so the APIs aren't exposed to other -+- * code that could use them to circumvent security. Thus, -+- * we accept the risk that the direct reference might fail -+- * on some JDK 1.1 JVMs, even though we would never execute -+- * this code in such a case. Sigh... -+- */ -+- ss = new SecuritySupport12(); -+- } catch (Exception ex) { -+- // ignore it -+- } finally { -+- if (ss == null) -+- ss = new SecuritySupport(); -+- securitySupport = ss; -+- } -+- } -+- -+- /** -+- * Return an appropriate instance of this class, depending on whether -+- * we're on a JDK 1.1 or J2SE 1.2 (or later) system. -+- */ -+- static SecuritySupport getInstance() { -+- return (SecuritySupport)securitySupport; -+- } -+- -+- ClassLoader getContextClassLoader() { -+- return null; -+- } -+- -+- ClassLoader getSystemClassLoader() { -+- return null; -+- } -+- -+- ClassLoader getParentClassLoader(ClassLoader cl) { -+- return null; -+- } -+- -+- String getSystemProperty(String propName) { -+- return System.getProperty(propName); -+- } -+- -+- FileInputStream getFileInputStream(File file) -+- throws FileNotFoundException -+- { -+- return new FileInputStream(file); -+- } -+- -+- InputStream getResourceAsStream(ClassLoader cl, String name) { -+- InputStream ris; -+- if (cl == null) { -+- ris = ClassLoader.getSystemResourceAsStream(name); -+- } else { -+- ris = cl.getResourceAsStream(name); -+- } -+- return ris; -+- } -+- -+- boolean getFileExists(File f) { -+- return f.exists(); -+- } -+- -+- long getLastModified(File f) { -+- return f.lastModified(); -+- } -+-} -+--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java 2013-04-16 14:28:09.764157131 +0100 -++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -23,9 +23,6 @@ -+ package com.sun.org.apache.xpath.internal.res; -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -1269,68 +1266,4 @@ -+ /** Field QUERY_HEADER */ -+ public static final String QUERY_HEADER = "MUSTER "; -+ -+- -+- /** -+- * 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java 2013-04-16 14:28:09.764157131 +0100 -++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -23,9 +23,6 @@ -+ package com.sun.org.apache.xpath.internal.res; -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -1273,68 +1270,4 @@ -+ /** Field QUERY_HEADER */ -+ public static final String QUERY_HEADER = "PATTERN "; -+ -+- -+- /** -+- * Return a named ResourceBundle for a particular locale. This method mimics the behavior -+- * of ResourceBundle.getBundle(). -+- * -+- * @param className Name of local-specific subclass. -+- * @return the ResourceBundle -+- * @throws MissingResourceException -+- */ -+- public static final XPATHErrorResources loadResourceBundle(String className) -+- throws MissingResourceException -+- { -+- -+- Locale locale = Locale.getDefault(); -+- String suffix = getResourceSuffix(locale); -+- -+- try -+- { -+- -+- // first try with the given locale -+- return (XPATHErrorResources) ResourceBundle.getBundle(className -+- + suffix, locale); -+- } -+- catch (MissingResourceException e) -+- { -+- try // try to fall back to en_US if we can't load -+- { -+- -+- // Since we can't find the localized property file, -+- // fall back to en_US. -+- return (XPATHErrorResources) ResourceBundle.getBundle(className, -+- new Locale("es", "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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java 2013-04-16 14:28:09.768157196 +0100 -++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -23,9 +23,6 @@ -+ package com.sun.org.apache.xpath.internal.res; -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -1270,68 +1267,4 @@ -+ /** Field QUERY_HEADER */ -+ public static final String QUERY_HEADER = "PATTERN "; -+ -+- -+- /** -+- * Return a named ResourceBundle for a particular locale. This method mimics the behavior -+- * of ResourceBundle.getBundle(). -+- * -+- * @param className Name of local-specific subclass. -+- * @return the ResourceBundle -+- * @throws MissingResourceException -+- */ -+- public static final XPATHErrorResources loadResourceBundle(String className) -+- throws MissingResourceException -+- { -+- -+- Locale locale = Locale.getDefault(); -+- String suffix = getResourceSuffix(locale); -+- -+- try -+- { -+- -+- // first try with the given locale -+- return (XPATHErrorResources) ResourceBundle.getBundle(className -+- + suffix, locale); -+- } -+- catch (MissingResourceException e) -+- { -+- try // try to fall back to en_US if we can't load -+- { -+- -+- // Since we can't find the localized property file, -+- // fall back to en_US. -+- return (XPATHErrorResources) ResourceBundle.getBundle(className, -+- new Locale("en", "US")); -+- } -+- catch (MissingResourceException e2) -+- { -+- -+- // Now we are really in trouble. -+- // very bad, definitely very bad...not going to get very far -+- throw new MissingResourceException( -+- "Could not load any resource bundles.", className, ""); -+- } -+- } -+- } -+- -+- /** -+- * Return the resource file suffic for the indicated locale -+- * For most locales, this will be based the language code. However -+- * for Chinese, we do distinguish between Taiwan and PRC -+- * -+- * @param locale the locale -+- * @return an String suffix which canbe appended to a resource name -+- */ -+- private static final String getResourceSuffix(Locale locale) -+- { -+- -+- String suffix = "_" + locale.getLanguage(); -+- String country = locale.getCountry(); -+- -+- if (country.equals("TW")) -+- suffix += "_" + country; -+- -+- return suffix; -+- } -+- -+ } -+--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java 2013-04-16 14:28:09.768157196 +0100 -++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -23,9 +23,6 @@ -+ package com.sun.org.apache.xpath.internal.res; -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -1272,68 +1269,4 @@ -+ /** Field QUERY_HEADER */ -+ public static final String QUERY_HEADER = "MODELLO "; -+ -+- -+- /** -+- * 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("it", "IT")); -+- } -+- 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java 2013-04-16 14:28:09.768157196 +0100 -++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -23,9 +23,6 @@ -+ package com.sun.org.apache.xpath.internal.res; -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -1269,68 +1266,4 @@ -+ /** Field QUERY_HEADER */ -+ public static final String QUERY_HEADER = "\u30d1\u30bf\u30fc\u30f3 "; -+ -+- -+- /** -+- * 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java 2013-04-16 14:28:09.764157131 +0100 -++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -23,9 +23,6 @@ -+ package com.sun.org.apache.xpath.internal.res; -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -938,68 +935,4 @@ -+ /** Field QUERY_HEADER */ -+ public static final String QUERY_HEADER = "PATTERN "; -+ -+- -+- /** -+- * Return a named ResourceBundle for a particular locale. This method mimics the behavior -+- * of ResourceBundle.getBundle(). -+- * -+- * @param className Name of local-specific subclass. -+- * @return the ResourceBundle -+- * @throws MissingResourceException -+- */ -+- public static final XPATHErrorResources loadResourceBundle(String className) -+- throws MissingResourceException -+- { -+- -+- Locale locale = Locale.getDefault(); -+- String suffix = getResourceSuffix(locale); -+- -+- try -+- { -+- -+- // first try with the given locale -+- return (XPATHErrorResources) ResourceBundle.getBundle(className -+- + suffix, locale); -+- } -+- catch (MissingResourceException e) -+- { -+- try // try to fall back to en_US if we can't load -+- { -+- -+- // Since we can't find the localized property file, -+- // fall back to en_US. -+- return (XPATHErrorResources) ResourceBundle.getBundle(className, -+- new Locale("en", "US")); -+- } -+- catch (MissingResourceException e2) -+- { -+- -+- // Now we are really in trouble. -+- // very bad, definitely very bad...not going to get very far -+- throw new MissingResourceException( -+- "Could not load any resource bundles.", className, ""); -+- } -+- } -+- } -+- -+- /** -+- * Return the resource file suffic for the indicated locale -+- * For most locales, this will be based the language code. However -+- * for Chinese, we do distinguish between Taiwan and PRC -+- * -+- * @param locale the locale -+- * @return an String suffix which canbe appended to a resource name -+- */ -+- private static final String getResourceSuffix(Locale locale) -+- { -+- -+- String suffix = "_" + locale.getLanguage(); -+- String country = locale.getCountry(); -+- -+- if (country.equals("TW")) -+- suffix += "_" + country; -+- -+- return suffix; -+- } -+- -+ } -+--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java 2013-04-16 14:28:09.768157196 +0100 -++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -23,9 +23,6 @@ -+ package com.sun.org.apache.xpath.internal.res; -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -1269,68 +1266,4 @@ -+ /** Field QUERY_HEADER */ -+ public static final String QUERY_HEADER = "PATTERN "; -+ -+- -+- /** -+- * Return a named ResourceBundle for a particular locale. This method mimics the behavior -+- * of ResourceBundle.getBundle(). -+- * -+- * @param className Name of local-specific subclass. -+- * @return the ResourceBundle -+- * @throws MissingResourceException -+- */ -+- public static final XPATHErrorResources loadResourceBundle(String className) -+- throws MissingResourceException -+- { -+- -+- Locale locale = Locale.getDefault(); -+- String suffix = getResourceSuffix(locale); -+- -+- try -+- { -+- -+- // first try with the given locale -+- return (XPATHErrorResources) ResourceBundle.getBundle(className -+- + suffix, locale); -+- } -+- catch (MissingResourceException e) -+- { -+- try // try to fall back to en_US if we can't load -+- { -+- -+- // Since we can't find the localized property file, -+- // fall back to en_US. -+- return (XPATHErrorResources) ResourceBundle.getBundle(className, -+- new Locale("ko", "KR")); -+- } -+- 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java 2013-04-16 14:28:09.772157260 +0100 -++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -23,9 +23,6 @@ -+ package com.sun.org.apache.xpath.internal.res; -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -1270,68 +1267,4 @@ -+ /** Field QUERY_HEADER */ -+ public static final String QUERY_HEADER = "PATTERN "; -+ -+- -+- /** -+- * Return a named ResourceBundle for a particular locale. This method mimics the behavior -+- * of ResourceBundle.getBundle(). -+- * -+- * @param className Name of local-specific subclass. -+- * @return the ResourceBundle -+- * @throws MissingResourceException -+- */ -+- public static final XPATHErrorResources loadResourceBundle(String className) -+- throws MissingResourceException -+- { -+- -+- Locale locale = Locale.getDefault(); -+- String suffix = getResourceSuffix(locale); -+- -+- try -+- { -+- -+- // first try with the given locale -+- return (XPATHErrorResources) ResourceBundle.getBundle(className -+- + suffix, locale); -+- } -+- catch (MissingResourceException e) -+- { -+- try // try to fall back to en_US if we can't load -+- { -+- -+- // Since we can't find the localized property file, -+- // fall back to en_US. -+- return (XPATHErrorResources) ResourceBundle.getBundle(className, -+- new Locale("zh", "CN")); -+- } -+- catch (MissingResourceException e2) -+- { -+- -+- // Now we are really in trouble. -+- // very bad, definitely very bad...not going to get very far -+- throw new MissingResourceException( -+- "\u65e0\u6cd5\u88c5\u5165\u4efb\u4f55\u8d44\u6e90\u5305\u3002", 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java 2013-04-16 14:28:09.772157260 +0100 -++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java 2013-04-16 14:29:26.565394640 +0100 -+@@ -23,9 +23,6 @@ -+ package com.sun.org.apache.xpath.internal.res; -+ -+ import java.util.ListResourceBundle; -+-import java.util.Locale; -+-import java.util.MissingResourceException; -+-import java.util.ResourceBundle; -+ -+ /** -+ * Set up error messages. -+@@ -1270,68 +1267,4 @@ -+ /** Field QUERY_HEADER */ -+ public static final String QUERY_HEADER = "PATTERN "; -+ -+- -+- /** -+- * Return a named ResourceBundle for a particular locale. This method mimics the behavior -+- * of ResourceBundle.getBundle(). -+- * -+- * @param className Name of local-specific subclass. -+- * @return the ResourceBundle -+- * @throws MissingResourceException -+- */ -+- public static final XPATHErrorResources loadResourceBundle(String className) -+- throws MissingResourceException -+- { -+- -+- Locale locale = Locale.getDefault(); -+- String suffix = getResourceSuffix(locale); -+- -+- try -+- { -+- -+- // first try with the given locale -+- return (XPATHErrorResources) ResourceBundle.getBundle(className -+- + suffix, locale); -+- } -+- catch (MissingResourceException e) -+- { -+- try // try to fall back to en_US if we can't load -+- { -+- -+- // Since we can't find the localized property file, -+- // fall back to en_US. -+- return (XPATHErrorResources) ResourceBundle.getBundle(className, -+- new Locale("zh", "TW")); -+- } -+- 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; -+- } -+- -+ } -+--- src/com/sun/org/apache/xpath/internal/res/XPATHMessages.java 2013-04-16 14:28:09.772157260 +0100 -++++ src/com/sun/org/apache/xpath/internal/res/XPATHMessages.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -22,130 +22,128 @@ -+ */ -+ package com.sun.org.apache.xpath.internal.res; -+ -+-import java.util.ListResourceBundle; -+- -++import com.sun.org.apache.bcel.internal.util.SecuritySupport; -+ import com.sun.org.apache.xml.internal.res.XMLMessages; -++import java.util.ListResourceBundle; -+ -+ /** -+ * A utility class for issuing XPath error messages. -++ * -+ * @xsl.usage internal -+ */ -+-public class XPATHMessages extends XMLMessages -+-{ -+- /** The language specific resource object for XPath messages. */ -+- private static ListResourceBundle XPATHBundle = null; -+- -+- /** The class name of the XPath error message string table. */ -+- private static final String XPATH_ERROR_RESOURCES = -+- "com.sun.org.apache.xpath.internal.res.XPATHErrorResources"; -+- -+- /** -+- * Creates a message from the specified key and replacement -+- * arguments, localized to the given locale. -+- * -+- * @param msgKey The key for the message text. -+- * @param args The arguments to be used as replacement text -+- * in the message created. -+- * -+- * @return The formatted message string. -+- */ -+- public static final String createXPATHMessage(String msgKey, Object args[]) //throws Exception -+- { -+- if (XPATHBundle == null) -+- XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES); -++public class XPATHMessages extends XMLMessages { -+ -+- if (XPATHBundle != null) -++ /** -++ * The language specific resource object for XPath messages. -++ */ -++ private static ListResourceBundle XPATHBundle = null; -++ /** -++ * The class name of the XPath error message string table. -++ */ -++ private static final String XPATH_ERROR_RESOURCES = -++ "com.sun.org.apache.xpath.internal.res.XPATHErrorResources"; -++ -++ /** -++ * Creates a message from the specified key and replacement arguments, -++ * localized to the given locale. -++ * -++ * @param msgKey The key for the message text. -++ * @param args The arguments to be used as replacement text in the message -++ * created. -++ * -++ * @return The formatted message string. -++ */ -++ public static final String createXPATHMessage(String msgKey, Object args[]) //throws Exception -+ { -+- return createXPATHMsg(XPATHBundle, msgKey, args); -+- } -+- else -+- return "Could not load any resource bundles."; -+- } -+- -+- /** -+- * Creates a message from the specified key and replacement -+- * arguments, localized to the given locale. -+- * -+- * @param msgKey The key for the message text. -+- * @param args The arguments to be used as replacement text -+- * in the message created. -+- * -+- * @return The formatted warning string. -+- */ -+- public static final String createXPATHWarning(String msgKey, Object args[]) //throws Exception -+- { -+- if (XPATHBundle == null) -+- XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES); -++ if (XPATHBundle == null) { -++ XPATHBundle = SecuritySupport.getResourceBundle(XPATH_ERROR_RESOURCES); -++ } -+ -+- if (XPATHBundle != null) -+- { -+- return createXPATHMsg(XPATHBundle, msgKey, args); -++ if (XPATHBundle != null) { -++ return createXPATHMsg(XPATHBundle, msgKey, args); -++ } else { -++ return "Could not load any resource bundles."; -++ } -+ } -+- else -+- return "Could not load any resource bundles."; -+- } -+- -+- /** -+- * Creates a message from the specified key and replacement -+- * arguments, localized to the given locale. -+- * -+- * @param fResourceBundle The resource bundle to use. -+- * @param msgKey The message key to use. -+- * @param args The arguments to be used as replacement text -+- * in the message created. -+- * -+- * @return The formatted message string. -+- */ -+- public static final String createXPATHMsg(ListResourceBundle fResourceBundle, -+- String msgKey, Object args[]) //throws Exception -+- { -+- -+- String fmsg = null; -+- boolean throwex = false; -+- String msg = null; -+- -+- if (msgKey != null) -+- msg = fResourceBundle.getString(msgKey); -+ -+- if (msg == null) -++ /** -++ * Creates a message from the specified key and replacement arguments, -++ * localized to the given locale. -++ * -++ * @param msgKey The key for the message text. -++ * @param args The arguments to be used as replacement text in the message -++ * created. -++ * -++ * @return The formatted warning string. -++ */ -++ public static final String createXPATHWarning(String msgKey, Object args[]) //throws Exception -+ { -+- msg = fResourceBundle.getString(XPATHErrorResources.BAD_CODE); -+- throwex = true; -++ if (XPATHBundle == null) { -++ XPATHBundle = SecuritySupport.getResourceBundle(XPATH_ERROR_RESOURCES); -++ } -++ -++ if (XPATHBundle != null) { -++ return createXPATHMsg(XPATHBundle, msgKey, args); -++ } else { -++ return "Could not load any resource bundles."; -++ } -+ } -+ -+- if (args != null) -++ /** -++ * Creates a message from the specified key and replacement arguments, -++ * localized to the given locale. -++ * -++ * @param fResourceBundle The resource bundle to use. -++ * @param msgKey The message key to use. -++ * @param args The arguments to be used as replacement text in the message -++ * created. -++ * -++ * @return The formatted message string. -++ */ -++ public static final String createXPATHMsg(ListResourceBundle fResourceBundle, -++ String msgKey, Object args[]) //throws Exception -+ { -+- try -+- { -+ -+- // Do this to keep format from crying. -+- // This is better than making a bunch of conditional -+- // code all over the place. -+- int n = args.length; -+- -+- for (int i = 0; i < n; i++) -+- { -+- if (null == args[i]) -+- args[i] = ""; -+- } -+- -+- fmsg = java.text.MessageFormat.format(msg, args); -+- } -+- catch (Exception e) -+- { -+- fmsg = fResourceBundle.getString(XPATHErrorResources.FORMAT_FAILED); -+- fmsg += " " + msg; -+- } -+- } -+- else -+- fmsg = msg; -++ String fmsg = null; -++ boolean throwex = false; -++ String msg = null; -+ -+- if (throwex) -+- { -+- throw new RuntimeException(fmsg); -+- } -++ if (msgKey != null) { -++ msg = fResourceBundle.getString(msgKey); -++ } -++ -++ if (msg == null) { -++ msg = fResourceBundle.getString(XPATHErrorResources.BAD_CODE); -++ throwex = true; -++ } -+ -+- return fmsg; -+- } -++ if (args != null) { -++ try { -+ -++ // Do this to keep format from crying. -++ // This is better than making a bunch of conditional -++ // code all over the place. -++ int n = args.length; -++ -++ for (int i = 0; i < n; i++) { -++ if (null == args[i]) { -++ args[i] = ""; -++ } -++ } -++ -++ fmsg = java.text.MessageFormat.format(msg, args); -++ } catch (Exception e) { -++ fmsg = fResourceBundle.getString(XPATHErrorResources.FORMAT_FAILED); -++ fmsg += " " + msg; -++ } -++ } else { -++ fmsg = msg; -++ } -++ -++ if (throwex) { -++ throw new RuntimeException(fmsg); -++ } -++ -++ return fmsg; -++ } -+ } -+--- src/com/sun/xml/internal/stream/writers/WriterUtility.java 2013-04-16 14:28:09.780157389 +0100 -++++ src/com/sun/xml/internal/stream/writers/WriterUtility.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -32,6 +32,7 @@ -+ import java.nio.charset.Charset; -+ import java.nio.charset.CharsetEncoder; -+ import com.sun.org.apache.xerces.internal.util.XMLChar; -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ -+ /** -+ * Implements common xml writer functions. -+@@ -240,7 +241,7 @@ -+ -+ private CharsetEncoder getDefaultEncoder(){ -+ try{ -+- String encoding = System.getProperty("file.encoding"); -++ String encoding = SecuritySupport.getSystemProperty("file.encoding"); -+ if(encoding != null){ -+ return Charset.forName(encoding).newEncoder(); -+ } -+--- src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java 2013-04-16 14:28:09.780157389 +0100 -++++ src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -53,6 +53,7 @@ -+ import com.sun.org.apache.xerces.internal.impl.PropertyManager; -+ import com.sun.org.apache.xerces.internal.util.NamespaceSupport; -+ import com.sun.org.apache.xerces.internal.util.SymbolTable; -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ import com.sun.org.apache.xerces.internal.xni.QName; -+ -+ import com.sun.xml.internal.stream.util.ReadOnlyIterator; -+@@ -339,7 +340,7 @@ -+ fEncoder = Charset.forName(encoding).newEncoder(); -+ } -+ } else { -+- encoding = System.getProperty("file.encoding"); -++ encoding = SecuritySupport.getSystemProperty("file.encoding"); -+ if (encoding != null && encoding.equalsIgnoreCase("utf-8")) { -+ fWriter = new UTF8OutputStreamWriter(os); -+ } else { -+--- src/com/sun/xml/internal/stream/XMLEntityStorage.java 2013-04-16 14:28:09.772157260 +0100 -++++ src/com/sun/xml/internal/stream/XMLEntityStorage.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -36,6 +36,7 @@ -+ import com.sun.org.apache.xerces.internal.impl.PropertyManager; -+ import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; -+ import com.sun.org.apache.xerces.internal.impl.Constants; -++import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -+ -+ /** -+ * -+@@ -410,7 +411,7 @@ -+ // get the user.dir property -+ String userDir = ""; -+ try { -+- userDir = System.getProperty("user.dir"); -++ userDir = SecuritySupport.getSystemProperty("user.dir"); -+ } -+ catch (SecurityException se) { -+ } -+--- src/javax/xml/datatype/FactoryFinder.java 2013-04-16 14:28:09.784157453 +0100 -++++ src/javax/xml/datatype/FactoryFinder.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -44,6 +44,7 @@ -+ * @author Santiago.PericasGeertsen@sun.com -+ */ -+ class FactoryFinder { -++ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal"; -+ -+ /** -+ * Internal debug flag. -+@@ -95,18 +96,24 @@ -+ * If the class loader supplied is <code>null</code>, first try using the -+ * context class loader followed by the current (i.e. bootstrap) class -+ * loader. -++ * -++ * Use bootstrap classLoader if cl = null and useBSClsLoader is true -+ */ -+ static private Class getProviderClass(String className, ClassLoader cl, -+- boolean doFallback) throws ClassNotFoundException -++ boolean doFallback, boolean useBSClsLoader) throws ClassNotFoundException -+ { -+ try { -+ if (cl == null) { -+- cl = ss.getContextClassLoader(); -+- if (cl == null) { -+- throw new ClassNotFoundException(); -+- } -+- else { -+- return cl.loadClass(className); -++ if (useBSClsLoader) { -++ return Class.forName(className, true, FactoryFinder.class.getClassLoader()); -++ } else { -++ cl = ss.getContextClassLoader(); -++ if (cl == null) { -++ throw new ClassNotFoundException(); -++ } -++ else { -++ return cl.loadClass(className); -++ } -+ } -+ } -+ else { -+@@ -131,8 +138,8 @@ -+ * @param className Name of the concrete class corresponding to the -+ * service provider -+ * -+- * @param cl ClassLoader to use to load the class, null means to use -+- * the bootstrap ClassLoader -++ * @param cl <code>ClassLoader</code> used to load the factory class. If <code>null</code> -++ * current <code>Thread</code>'s context classLoader is used to load the factory class. -+ * -+ * @param doFallback True if the current ClassLoader should be tried as -+ * a fallback if the class is not found using cl -+@@ -140,8 +147,38 @@ -+ static Object newInstance(String className, ClassLoader cl, boolean doFallback) -+ throws ConfigurationError -+ { -++ return newInstance(className, cl, doFallback, false); -++ } -++ -++ /** -++ * Create an instance of a class. Delegates to method -++ * <code>getProviderClass()</code> in order to load the class. -++ * -++ * @param className Name of the concrete class corresponding to the -++ * service provider -++ * -++ * @param cl ClassLoader to use to load the class, null means to use -++ * the bootstrap ClassLoader -++ * -++ * @param doFallback True if the current ClassLoader should be tried as -++ * a fallback if the class is not found using cl -++ * -++ * @param useBSClsLoader True if cl=null actually meant bootstrap classLoader. This parameter -++ * is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader. -++ */ -++ static Object newInstance(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader) -++ throws ConfigurationError -++ { -++ // make sure we have access to restricted packages -++ if (System.getSecurityManager() != null) { -++ if (className != null && className.startsWith(DEFAULT_PACKAGE)) { -++ cl = null; -++ useBSClsLoader = true; -++ } -++ } -++ -+ try { -+- Class providerClass = getProviderClass(className, cl, doFallback); -++ Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader); -+ Object instance = providerClass.newInstance(); -+ if (debug) { // Extra check to avoid computing cl strings -+ dPrint("created new instance of " + providerClass + -+@@ -244,6 +281,7 @@ -+ -+ // First try the Context ClassLoader -+ ClassLoader cl = ss.getContextClassLoader(); -++ boolean useBSClsLoader = false; -+ if (cl != null) { -+ is = ss.getResourceAsStream(cl, serviceId); -+ -+@@ -251,11 +289,13 @@ -+ if (is == null) { -+ cl = FactoryFinder.class.getClassLoader(); -+ is = ss.getResourceAsStream(cl, serviceId); -++ useBSClsLoader = true; -+ } -+ } else { -+ // No Context ClassLoader, try the current ClassLoader -+ cl = FactoryFinder.class.getClassLoader(); -+ is = ss.getResourceAsStream(cl, serviceId); -++ useBSClsLoader = true; -+ } -+ -+ if (is == null) { -+@@ -293,7 +333,7 @@ -+ // ClassLoader because we want to avoid the case where the -+ // resource file was found using one ClassLoader and the -+ // provider class was instantiated using a different one. -+- return newInstance(factoryClassName, cl, false); -++ return newInstance(factoryClassName, cl, false, useBSClsLoader); -+ } -+ -+ // No provider found -+--- src/javax/xml/stream/FactoryFinder.java 2013-04-16 14:28:09.788157518 +0100 -++++ src/javax/xml/stream/FactoryFinder.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -25,14 +25,12 @@ -+ -+ package javax.xml.stream; -+ -+-import java.io.InputStream; -+-import java.io.IOException; -+-import java.io.File; -+-import java.io.FileInputStream; -+- -+-import java.util.Properties; -+ import java.io.BufferedReader; -++import java.io.File; -++import java.io.IOException; -++import java.io.InputStream; -+ import java.io.InputStreamReader; -++import java.util.Properties; -+ -+ /** -+ * <p>Implements pluggable Datatypes.</p> -+@@ -43,6 +41,8 @@ -+ * @author Santiago.PericasGeertsen@sun.com -+ */ -+ class FactoryFinder { -++ // Check we have access to package. -++ private static final String DEFAULT_PACKAGE = "com.sun.xml.internal."; -+ -+ /** -+ * Internal debug flag. -+@@ -94,18 +94,24 @@ -+ * If the class loader supplied is <code>null</code>, first try using the -+ * context class loader followed by the current (i.e. bootstrap) class -+ * loader. -++ * -++ * Use bootstrap classLoader if cl = null and useBSClsLoader is true -+ */ -+ static private Class getProviderClass(String className, ClassLoader cl, -+- boolean doFallback) throws ClassNotFoundException -++ boolean doFallback, boolean useBSClsLoader) throws ClassNotFoundException -+ { -+ try { -+ if (cl == null) { -+- cl = ss.getContextClassLoader(); -+- if (cl == null) { -+- throw new ClassNotFoundException(); -+- } -+- else { -+- return cl.loadClass(className); -++ if (useBSClsLoader) { -++ return Class.forName(className, true, FactoryFinder.class.getClassLoader()); -++ } else { -++ cl = ss.getContextClassLoader(); -++ if (cl == null) { -++ throw new ClassNotFoundException(); -++ } -++ else { -++ return cl.loadClass(className); -++ } -+ } -+ } -+ else { -+@@ -130,8 +136,8 @@ -+ * @param className Name of the concrete class corresponding to the -+ * service provider -+ * -+- * @param cl ClassLoader to use to load the class, null means to use -+- * the bootstrap ClassLoader -++ * @param cl <code>ClassLoader</code> used to load the factory class. If <code>null</code> -++ * current <code>Thread</code>'s context classLoader is used to load the factory class. -+ * -+ * @param doFallback True if the current ClassLoader should be tried as -+ * a fallback if the class is not found using cl -+@@ -139,8 +145,38 @@ -+ static Object newInstance(String className, ClassLoader cl, boolean doFallback) -+ throws ConfigurationError -+ { -++ return newInstance(className, cl, doFallback, false); -++ } -++ -++ /** -++ * Create an instance of a class. Delegates to method -++ * <code>getProviderClass()</code> in order to load the class. -++ * -++ * @param className Name of the concrete class corresponding to the -++ * service provider -++ * -++ * @param cl <code>ClassLoader</code> used to load the factory class. If <code>null</code> -++ * current <code>Thread</code>'s context classLoader is used to load the factory class. -++ * -++ * @param doFallback True if the current ClassLoader should be tried as -++ * a fallback if the class is not found using cl -++ * -++ * @param useBSClsLoader True if cl=null actually meant bootstrap classLoader. This parameter -++ * is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader. -++ */ -++ static Object newInstance(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader) -++ throws ConfigurationError -++ { -++ // make sure we have access to restricted packages -++ if (System.getSecurityManager() != null) { -++ if (className != null && className.startsWith(DEFAULT_PACKAGE)) { -++ cl = null; -++ useBSClsLoader = true; -++ } -++ } -++ -+ try { -+- Class providerClass = getProviderClass(className, cl, doFallback); -++ Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader); -+ Object instance = providerClass.newInstance(); -+ if (debug) { // Extra check to avoid computing cl strings -+ dPrint("created new instance of " + providerClass + -+@@ -233,11 +269,11 @@ -+ if (ss.doesFileExist(f)) { -+ dPrint("Read properties file "+f); -+ cacheProps.load(ss.getFileInputStream(f)); -+- } -+- } -+ } -+ } -+ } -++ } -++ } -+ factoryClassName = cacheProps.getProperty(factoryId); -+ -+ if (factoryClassName != null) { -+@@ -276,6 +312,7 @@ -+ -+ // First try the Context ClassLoader -+ ClassLoader cl = ss.getContextClassLoader(); -++ boolean useBSClsLoader = false; -+ if (cl != null) { -+ is = ss.getResourceAsStream(cl, serviceId); -+ -+@@ -283,11 +320,13 @@ -+ if (is == null) { -+ cl = FactoryFinder.class.getClassLoader(); -+ is = ss.getResourceAsStream(cl, serviceId); -++ useBSClsLoader = true; -+ } -+ } else { -+ // No Context ClassLoader, try the current ClassLoader -+ cl = FactoryFinder.class.getClassLoader(); -+ is = ss.getResourceAsStream(cl, serviceId); -++ useBSClsLoader = true; -+ } -+ -+ if (is == null) { -+@@ -325,7 +364,7 @@ -+ // ClassLoader because we want to avoid the case where the -+ // resource file was found using one ClassLoader and the -+ // provider class was instantiated using a different one. -+- return newInstance(factoryClassName, cl, false); -++ return newInstance(factoryClassName, cl, false, useBSClsLoader); -+ } -+ -+ // No provider found -+--- src/javax/xml/validation/SchemaFactoryFinder.java 2013-04-16 14:28:09.800157711 +0100 -++++ src/javax/xml/validation/SchemaFactoryFinder.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -53,6 +53,7 @@ -+ *<p> Take care of restrictions imposed by java security model </p> -+ */ -+ private static SecuritySupport ss = new SecuritySupport(); -++ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal"; -+ /** -+ * <p>Cache properties for performance.</p> -+ */ -+@@ -212,28 +213,6 @@ -+ } -+ } -+ -+- /** -+- // try to read from $java.home/lib/jaxp.properties -+- try { -+- String javah = ss.getSystemProperty( "java.home" ); -+- String configFile = javah + File.separator + -+- "lib" + File.separator + "jaxp.properties"; -+- File f = new File( configFile ); -+- if( ss.doesFileExist(f)) { -+- sf = loadFromProperty( -+- propertyName,f.getAbsolutePath(), new FileInputStream(f)); -+- if(sf!=null) return sf; -+- } else { -+- debugPrintln("Tried to read "+ f.getAbsolutePath()+", but it doesn't exist."); -+- } -+- } catch(Throwable e) { -+- if( debug ) { -+- debugPrintln("failed to read $java.home/lib/jaxp.properties"); -+- e.printStackTrace(); -+- } -+- } -+- */ -+- -+ // try META-INF/services files -+ Iterator sitr = createServiceFileIterator(); -+ while(sitr.hasNext()) { -+@@ -268,14 +247,20 @@ -+ */ -+ private Class createClass(String className) { -+ Class clazz; -++ // make sure we have access to restricted packages -++ boolean internal = false; -++ if (System.getSecurityManager() != null) { -++ if (className != null && className.startsWith(DEFAULT_PACKAGE)) { -++ internal = true; -++ } -++ } -+ -+- // use approprite ClassLoader -+ try { -+- if (classLoader != null) { -+- clazz = classLoader.loadClass(className); -+- } else { -+- clazz = Class.forName(className); -+- } -++ if (classLoader != null && !internal) { -++ clazz = classLoader.loadClass(className); -++ } else { -++ clazz = Class.forName(className); -++ } -+ } catch (Throwable t) { -+ if(debug) t.printStackTrace(); -+ return null; -+--- src/javax/xml/xpath/XPathFactoryFinder.java 2013-04-16 14:28:09.800157711 +0100 -++++ src/javax/xml/xpath/XPathFactoryFinder.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -47,6 +47,7 @@ -+ * @since 1.5 -+ */ -+ class XPathFactoryFinder { -++ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xpath.internal"; -+ -+ private static SecuritySupport ss = new SecuritySupport() ; -+ /** debug support code. */ -+@@ -245,18 +246,25 @@ -+ */ -+ private Class createClass(String className) { -+ Class clazz; -+- -+- // use approprite ClassLoader -+- try { -+- if (classLoader != null) { -+- clazz = classLoader.loadClass(className); -+- } else { -+- clazz = Class.forName(className); -+- } -+- } catch (Throwable t) { -+- if(debug) t.printStackTrace(); -+- return null; -++ // make sure we have access to restricted packages -++ boolean internal = false; -++ if (System.getSecurityManager() != null) { -++ if (className != null && className.startsWith(DEFAULT_PACKAGE)) { -++ internal = true; -+ } -++ } -++ -++ // use approprite ClassLoader -++ try { -++ if (classLoader != null && !internal) { -++ clazz = classLoader.loadClass(className); -++ } else { -++ clazz = Class.forName(className); -++ } -++ } catch (Throwable t) { -++ if(debug) t.printStackTrace(); -++ return null; -++ } -+ -+ return clazz; -+ } -+--- src/org/w3c/dom/bootstrap/DOMImplementationRegistry.java 2013-04-16 14:28:09.808157841 +0100 -++++ src/org/w3c/dom/bootstrap/DOMImplementationRegistry.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -104,6 +104,8 @@ -+ */ -+ private static final String FALLBACK_CLASS = -+ "com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl"; -++ private static final String DEFAULT_PACKAGE = -++ "com.sun.org.apache.xerces.internal.dom"; -+ /** -+ * Private constructor. -+ * @param srcs Vector List of DOMImplementationSources -+@@ -168,10 +170,15 @@ -+ StringTokenizer st = new StringTokenizer(p); -+ while (st.hasMoreTokens()) { -+ String sourceName = st.nextToken(); -+- // Use context class loader, falling back to Class.forName -+- // if and only if this fails... -++ // make sure we have access to restricted packages -++ boolean internal = false; -++ if (System.getSecurityManager() != null) { -++ if (sourceName != null && sourceName.startsWith(DEFAULT_PACKAGE)) { -++ internal = true; -++ } -++ } -+ Class sourceClass = null; -+- if (classLoader != null) { -++ if (classLoader != null && !internal) { -+ sourceClass = classLoader.loadClass(sourceName); -+ } else { -+ sourceClass = Class.forName(sourceName); -+--- src/org/xml/sax/helpers/NewInstance.java 2013-04-16 14:28:09.832158226 +0100 -++++ src/org/xml/sax/helpers/NewInstance.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -54,9 +54,10 @@ -+ * including versions of Java 2.</p> -+ * -+ * @author Edwin Goei, David Brownell -++ * @version 2.0.1 (sax2r2) -+ */ -+ class NewInstance { -+- -++ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal"; -+ /** -+ * Creates a new instance of the specified class name -+ * -+@@ -66,8 +67,16 @@ -+ throws ClassNotFoundException, IllegalAccessException, -+ InstantiationException -+ { -++ // make sure we have access to restricted packages -++ boolean internal = false; -++ if (System.getSecurityManager() != null) { -++ if (className != null && className.startsWith(DEFAULT_PACKAGE)) { -++ internal = true; -++ } -++ } -++ -+ Class driverClass; -+- if (classLoader == null) { -++ if (classLoader == null || internal) { -+ driverClass = Class.forName(className); -+ } else { -+ driverClass = classLoader.loadClass(className); -+@@ -75,29 +84,4 @@ -+ return driverClass.newInstance(); -+ } -+ -+- /** -+- * Figure out which ClassLoader to use. For JDK 1.2 and later use -+- * the context ClassLoader. -+- */ -+- static ClassLoader getClassLoader () -+- { -+- Method m = null; -+- -+- try { -+- m = Thread.class.getMethod("getContextClassLoader", (Class[]) null); -+- } catch (NoSuchMethodException e) { -+- // Assume that we are running JDK 1.1, use the current ClassLoader -+- return NewInstance.class.getClassLoader(); -+- } -+- -+- try { -+- return (ClassLoader) m.invoke(Thread.currentThread(), (Object[]) null); -+- } catch (IllegalAccessException e) { -+- // assert(false) -+- throw new UnknownError(e.getMessage()); -+- } catch (InvocationTargetException e) { -+- // assert(e.getTargetException() instanceof SecurityException) -+- throw new UnknownError(e.getMessage()); -+- } -+- } -+ } -+--- src/org/xml/sax/helpers/ParserAdapter.java 2013-04-16 14:28:09.836158291 +0100 -++++ src/org/xml/sax/helpers/ParserAdapter.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -74,13 +74,14 @@ -+ * -+ * @since SAX 2.0 -+ * @author David Megginson -++ * @version 2.0.1 (sax2r2) -+ * @see org.xml.sax.helpers.XMLReaderAdapter -+ * @see org.xml.sax.XMLReader -+ * @see org.xml.sax.Parser -+ */ -+ public class ParserAdapter implements XMLReader, DocumentHandler -+ { -+- -++ private static SecuritySupport ss = new SecuritySupport(); -+ -+ //////////////////////////////////////////////////////////////////// -+ // Constructors. -+@@ -102,7 +103,7 @@ -+ { -+ super(); -+ -+- String driver = System.getProperty("org.xml.sax.parser"); -++ String driver = ss.getSystemProperty("org.xml.sax.parser"); -+ -+ try { -+ setup(ParserFactory.makeParser()); -+--- src/org/xml/sax/helpers/ParserFactory.java 2013-04-16 14:28:09.836158291 +0100 -++++ src/org/xml/sax/helpers/ParserFactory.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -30,12 +30,6 @@ -+ -+ package org.xml.sax.helpers; -+ -+-import java.lang.ClassNotFoundException; -+-import java.lang.IllegalAccessException; -+-import java.lang.InstantiationException; -+-import java.lang.SecurityException; -+-import java.lang.ClassCastException; -+- -+ import org.xml.sax.Parser; -+ -+ -+@@ -69,9 +63,10 @@ -+ * interface. -+ * @since SAX 1.0 -+ * @author David Megginson -++ * @version 2.0.1 (sax2r2) -+ */ -+ public class ParserFactory { -+- -++ private static SecuritySupport ss = new SecuritySupport(); -+ -+ /** -+ * Private null constructor. -+@@ -109,7 +104,7 @@ -+ NullPointerException, -+ ClassCastException -+ { -+- String className = System.getProperty("org.xml.sax.parser"); -++ String className = ss.getSystemProperty("org.xml.sax.parser"); -+ if (className == null) { -+ throw new NullPointerException("No value for sax.parser property"); -+ } else { -+@@ -146,7 +141,7 @@ -+ ClassCastException -+ { -+ return (Parser) NewInstance.newInstance ( -+- NewInstance.getClassLoader (), className); -++ ss.getContextClassLoader(), className); -+ } -+ -+ } -+--- src/org/xml/sax/helpers/SecuritySupport.java 1970-01-01 01:00:00.000000000 +0100 -++++ src/org/xml/sax/helpers/SecuritySupport.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -0,0 +1,108 @@ -++/* -++ * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved. -++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -++ * -++ * This code is free software; you can redistribute it and/or modify it -++ * under the terms of the GNU General Public License version 2 only, as -++ * published by the Free Software Foundation. Oracle designates this -++ * particular file as subject to the "Classpath" exception as provided -++ * by Oracle in the LICENSE file that accompanied this code. -++ * -++ * This code is distributed in the hope that it will be useful, but WITHOUT -++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -++ * version 2 for more details (a copy is included in the LICENSE file that -++ * accompanied this code). -++ * -++ * You should have received a copy of the GNU General Public License version -++ * 2 along with this work; if not, write to the Free Software Foundation, -++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -++ * -++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -++ * or visit www.oracle.com if you need additional information or have any -++ * questions. -++ */ -++ -++package org.xml.sax.helpers; -++ -++import java.io.*; -++import java.security.*; -++ -++/** -++ * This class is duplicated for each JAXP subpackage so keep it in sync. -++ * It is package private and therefore is not exposed as part of the JAXP -++ * API. -++ * -++ * Security related methods that only work on J2SE 1.2 and newer. -++ */ -++class SecuritySupport { -++ -++ -++ ClassLoader getContextClassLoader() throws SecurityException{ -++ return (ClassLoader) -++ AccessController.doPrivileged(new PrivilegedAction() { -++ public Object run() { -++ ClassLoader cl = null; -++ //try { -++ cl = Thread.currentThread().getContextClassLoader(); -++ //} catch (SecurityException ex) { } -++ -++ if (cl == null) -++ cl = ClassLoader.getSystemClassLoader(); -++ -++ return cl; -++ } -++ }); -++ } -++ -++ String getSystemProperty(final String propName) { -++ return (String) -++ AccessController.doPrivileged(new PrivilegedAction() { -++ public Object run() { -++ return System.getProperty(propName); -++ } -++ }); -++ } -++ -++ FileInputStream getFileInputStream(final File file) -++ throws FileNotFoundException -++ { -++ try { -++ return (FileInputStream) -++ AccessController.doPrivileged(new PrivilegedExceptionAction() { -++ public Object run() throws FileNotFoundException { -++ return new FileInputStream(file); -++ } -++ }); -++ } catch (PrivilegedActionException e) { -++ throw (FileNotFoundException)e.getException(); -++ } -++ } -++ -++ InputStream getResourceAsStream(final ClassLoader cl, -++ final String name) -++ { -++ return (InputStream) -++ AccessController.doPrivileged(new PrivilegedAction() { -++ public Object run() { -++ InputStream ris; -++ if (cl == null) { -++ ris = Object.class.getResourceAsStream(name); -++ } else { -++ ris = cl.getResourceAsStream(name); -++ } -++ return ris; -++ } -++ }); -++ } -++ -++ boolean doesFileExist(final File f) { -++ return ((Boolean) -++ AccessController.doPrivileged(new PrivilegedAction() { -++ public Object run() { -++ return new Boolean(f.exists()); -++ } -++ })).booleanValue(); -++ } -++ -++} -+--- src/org/xml/sax/helpers/XMLReaderFactory.java 2013-04-16 14:28:09.836158291 +0100 -++++ src/org/xml/sax/helpers/XMLReaderFactory.java 2013-04-16 14:29:26.569394704 +0100 -+@@ -34,8 +34,6 @@ -+ import java.io.BufferedReader; -+ import java.io.InputStream; -+ import java.io.InputStreamReader; -+-import java.security.AccessController; -+-import java.security.PrivilegedAction; -+ import org.xml.sax.XMLReader; -+ import org.xml.sax.SAXException; -+ -+@@ -85,8 +83,8 @@ -+ } -+ -+ private static final String property = "org.xml.sax.driver"; -++ private static SecuritySupport ss = new SecuritySupport(); -+ -+- private static String _clsFromJar = null; -+ private static boolean _jarread = false; -+ /** -+ * Attempt to create an XMLReader from system defaults. -+@@ -134,43 +132,45 @@ -+ throws SAXException -+ { -+ String className = null; -+- ClassLoader loader = NewInstance.getClassLoader (); -++ ClassLoader cl = ss.getContextClassLoader(); -+ -+ // 1. try the JVM-instance-wide system property -+- try { className = System.getProperty (property); } -+- catch (RuntimeException e) { /* normally fails for applets */ } -++ try { -++ className = ss.getSystemProperty(property); -++ } -++ catch (RuntimeException e) { /* continue searching */ } -+ -+ // 2. if that fails, try META-INF/services/ -+ if (className == null) { -+ if (!_jarread) { -+- final ClassLoader loader1 = loader; -+ _jarread = true; -+- _clsFromJar = (String) -+- AccessController.doPrivileged(new PrivilegedAction() { -+- public Object run() { -+- String clsName = null; -+- try { -+- String service = "META-INF/services/" + property; -+- InputStream in; -+- BufferedReader reader; -+- if (loader1 == null) -+- in = ClassLoader.getSystemResourceAsStream (service); -+- else -+- in = loader1.getResourceAsStream (service); -+- -+- if (in != null) { -+- reader = new BufferedReader ( -+- new InputStreamReader (in, "UTF8")); -+- clsName = reader.readLine (); -+- in.close (); -+- } -+- } catch (Exception e) { -++ String service = "META-INF/services/" + property; -++ InputStream in; -++ BufferedReader reader; -++ -++ try { -++ if (cl != null) { -++ in = ss.getResourceAsStream(cl, service); -++ -++ // If no provider found then try the current ClassLoader -++ if (in == null) { -++ cl = null; -++ in = ss.getResourceAsStream(cl, service); -+ } -+- return clsName; -++ } else { -++ // No Context ClassLoader, try the current ClassLoader -++ in = ss.getResourceAsStream(cl, service); -+ } -+- }); -++ -++ if (in != null) { -++ reader = new BufferedReader ( -++ new InputStreamReader (in, "UTF8")); -++ className = reader.readLine (); -++ in.close (); -++ } -++ } catch (Exception e) { -++ } -+ } -+- className = _clsFromJar; -+ } -+ -+ // 3. Distro-specific fallback -+@@ -187,7 +187,7 @@ -+ -+ // do we know the XMLReader implementation class yet? -+ if (className != null) -+- return loadClass (loader, className); -++ return loadClass (cl, className); -+ -+ // 4. panic -- adapt any SAX1 parser -+ try { -+@@ -217,7 +217,7 @@ -+ public static XMLReader createXMLReader (String className) -+ throws SAXException -+ { -+- return loadClass (NewInstance.getClassLoader (), className); -++ return loadClass (ss.getContextClassLoader(), className); -+ } -+ -+ private static XMLReader loadClass (ClassLoader loader, String className) ---- jdk/src/share/lib/security/java.security 2013-04-16 14:28:12.392199476 +0100 -+++ jdk/src/share/lib/security/java.security 2013-04-16 14:29:26.545394318 +0100 -@@ -130,10 +130,27 @@ - package.access=sun.,\ - com.sun.xml.internal.bind.,\ - com.sun.xml.internal.org.jvnet.staxex.,\ -+ com.sun.xml.internal.stream.,\ - com.sun.xml.internal.ws.,\ - com.sun.imageio.,\ - com.sun.istack.internal.,\ -- com.sun.jmx. -+ com.sun.jmx.,\ -+ com.sun.org.apache.bcel.internal.,\ -+ com.sun.org.apache.regexp.internal.,\ -+ com.sun.org.apache.xerces.internal.,\ -+ com.sun.org.apache.xpath.internal.,\ -+ com.sun.org.apache.xalan.internal.extensions.,\ -+ com.sun.org.apache.xalan.internal.lib.,\ -+ com.sun.org.apache.xalan.internal.res.,\ -+ com.sun.org.apache.xalan.internal.templates.,\ -+ com.sun.org.apache.xalan.internal.xslt.,\ -+ com.sun.org.apache.xalan.internal.xsltc.cmdline.,\ -+ com.sun.org.apache.xalan.internal.xsltc.compiler.,\ -+ com.sun.org.apache.xalan.internal.xsltc.trax.,\ -+ com.sun.org.apache.xalan.internal.xsltc.util.,\ -+ com.sun.org.apache.xml.internal.res.,\ -+ com.sun.org.apache.xml.internal.serializer.utils.,\ -+ com.sun.org.apache.xml.internal.utils. - - # - # List of comma-separated packages that start with or equal this string -@@ -148,10 +165,27 @@ - package.definition=sun.,\ - com.sun.xml.internal.bind.,\ - com.sun.xml.internal.org.jvnet.staxex.,\ -+ com.sun.xml.internal.stream.,\ - com.sun.xml.internal.ws.,\ - com.sun.imageio.,\ - com.sun.istack.internal.,\ -- com.sun.jmx. -+ com.sun.jmx.,\ -+ com.sun.org.apache.bcel.internal.,\ -+ com.sun.org.apache.regexp.internal.,\ -+ com.sun.org.apache.xerces.internal.,\ -+ com.sun.org.apache.xpath.internal.,\ -+ com.sun.org.apache.xalan.internal.extensions.,\ -+ com.sun.org.apache.xalan.internal.lib.,\ -+ com.sun.org.apache.xalan.internal.res.,\ -+ com.sun.org.apache.xalan.internal.templates.,\ -+ com.sun.org.apache.xalan.internal.xslt.,\ -+ com.sun.org.apache.xalan.internal.xsltc.cmdline.,\ -+ com.sun.org.apache.xalan.internal.xsltc.compiler.,\ -+ com.sun.org.apache.xalan.internal.xsltc.trax.,\ -+ com.sun.org.apache.xalan.internal.xsltc.util.,\ -+ com.sun.org.apache.xml.internal.res.,\ -+ com.sun.org.apache.xml.internal.serializer.utils.,\ -+ com.sun.org.apache.xml.internal.utils. - - # - # Determines whether this properties file can be appended to ---- jdk/src/share/lib/security/java.security-solaris 2013-04-16 14:28:12.396199540 +0100 -+++ jdk/src/share/lib/security/java.security-solaris 2013-04-16 14:30:42.026610629 +0100 -@@ -131,10 +131,27 @@ - package.access=sun.,\ - com.sun.xml.internal.bind.,\ - com.sun.xml.internal.org.jvnet.staxex.,\ -+ com.sun.xml.internal.stream.,\ - com.sun.xml.internal.ws.,\ - com.sun.imageio. - com.sun.istack.internal.,\ -- com.sun.jmx. -+ com.sun.jmx.,\ -+ com.sun.org.apache.bcel.internal.,\ -+ com.sun.org.apache.regexp.internal.,\ -+ com.sun.org.apache.xerces.internal.,\ -+ com.sun.org.apache.xpath.internal.,\ -+ com.sun.org.apache.xalan.internal.extensions.,\ -+ com.sun.org.apache.xalan.internal.lib.,\ -+ com.sun.org.apache.xalan.internal.res.,\ -+ com.sun.org.apache.xalan.internal.templates.,\ -+ com.sun.org.apache.xalan.internal.xslt.,\ -+ com.sun.org.apache.xalan.internal.xsltc.cmdline.,\ -+ com.sun.org.apache.xalan.internal.xsltc.compiler.,\ -+ com.sun.org.apache.xalan.internal.xsltc.trax.,\ -+ com.sun.org.apache.xalan.internal.xsltc.util.,\ -+ com.sun.org.apache.xml.internal.res.,\ -+ com.sun.org.apache.xml.internal.serializer.utils.,\ -+ com.sun.org.apache.xml.internal.utils. - - # - # List of comma-separated packages that start with or equal this string -@@ -149,10 +166,27 @@ - package.definition=sun.,\ - com.sun.xml.internal.bind.,\ - com.sun.xml.internal.org.jvnet.staxex.,\ -+ com.sun.xml.internal.stream.,\ - com.sun.xml.internal.ws.,\ - com.sun.imageio. - com.sun.istack.internal.,\ -- com.sun.jmx. -+ com.sun.jmx.,\ -+ com.sun.org.apache.bcel.internal.,\ -+ com.sun.org.apache.regexp.internal.,\ -+ com.sun.org.apache.xerces.internal.,\ -+ com.sun.org.apache.xpath.internal.,\ -+ com.sun.org.apache.xalan.internal.extensions.,\ -+ com.sun.org.apache.xalan.internal.lib.,\ -+ com.sun.org.apache.xalan.internal.res.,\ -+ com.sun.org.apache.xalan.internal.templates.,\ -+ com.sun.org.apache.xalan.internal.xslt.,\ -+ com.sun.org.apache.xalan.internal.xsltc.cmdline.,\ -+ com.sun.org.apache.xalan.internal.xsltc.compiler.,\ -+ com.sun.org.apache.xalan.internal.xsltc.trax.,\ -+ com.sun.org.apache.xalan.internal.xsltc.util.,\ -+ com.sun.org.apache.xml.internal.res.,\ -+ com.sun.org.apache.xml.internal.serializer.utils.,\ -+ com.sun.org.apache.xml.internal.utils. - - # - # Determines whether this properties file can be appended to ---- jdk/src/share/lib/security/java.security-windows 2013-04-16 14:28:12.396199540 +0100 -+++ jdk/src/share/lib/security/java.security-windows 2013-04-16 14:31:35.027464728 +0100 -@@ -131,10 +131,27 @@ - package.access=sun.,\ - com.sun.xml.internal.bind.,\ - com.sun.xml.internal.org.jvnet.staxex.,\ -+ com.sun.xml.internal.stream.,\ - com.sun.xml.internal.ws.,\ - com.sun.imageio. - com.sun.istack.internal.,\ -- com.sun.jmx. -+ com.sun.jmx.,\ -+ com.sun.org.apache.bcel.internal.,\ -+ com.sun.org.apache.regexp.internal.,\ -+ com.sun.org.apache.xerces.internal.,\ -+ com.sun.org.apache.xpath.internal.,\ -+ com.sun.org.apache.xalan.internal.extensions.,\ -+ com.sun.org.apache.xalan.internal.lib.,\ -+ com.sun.org.apache.xalan.internal.res.,\ -+ com.sun.org.apache.xalan.internal.templates.,\ -+ com.sun.org.apache.xalan.internal.xslt.,\ -+ com.sun.org.apache.xalan.internal.xsltc.cmdline.,\ -+ com.sun.org.apache.xalan.internal.xsltc.compiler.,\ -+ com.sun.org.apache.xalan.internal.xsltc.trax.,\ -+ com.sun.org.apache.xalan.internal.xsltc.util.,\ -+ com.sun.org.apache.xml.internal.res.,\ -+ com.sun.org.apache.xml.internal.serializer.utils.,\ -+ com.sun.org.apache.xml.internal.utils. - - # - # List of comma-separated packages that start with or equal this string -@@ -149,10 +166,27 @@ - package.definition=sun.,\ - com.sun.xml.internal.bind.,\ - com.sun.xml.internal.org.jvnet.staxex.,\ -+ com.sun.xml.internal.stream.,\ - com.sun.xml.internal.ws.,\ - com.sun.imageio. - com.sun.istack.internal.,\ -- com.sun.jmx. -+ com.sun.jmx.,\ -+ com.sun.org.apache.bcel.internal.,\ -+ com.sun.org.apache.regexp.internal.,\ -+ com.sun.org.apache.xerces.internal.,\ -+ com.sun.org.apache.xpath.internal.,\ -+ com.sun.org.apache.xalan.internal.extensions.,\ -+ com.sun.org.apache.xalan.internal.lib.,\ -+ com.sun.org.apache.xalan.internal.res.,\ -+ com.sun.org.apache.xalan.internal.templates.,\ -+ com.sun.org.apache.xalan.internal.xslt.,\ -+ com.sun.org.apache.xalan.internal.xsltc.cmdline.,\ -+ com.sun.org.apache.xalan.internal.xsltc.compiler.,\ -+ com.sun.org.apache.xalan.internal.xsltc.trax.,\ -+ com.sun.org.apache.xalan.internal.xsltc.util.,\ -+ com.sun.org.apache.xml.internal.res.,\ -+ com.sun.org.apache.xml.internal.serializer.utils.,\ -+ com.sun.org.apache.xml.internal.utils. - - # - # Determines whether this properties file can be appended to diff --git a/java/openjdk6/files/icedtea/security/20130416/7200507.patch b/java/openjdk6/files/icedtea/security/20130416/7200507.patch deleted file mode 100644 index db3c012bf638..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/7200507.patch +++ /dev/null @@ -1,230 +0,0 @@ -# HG changeset patch -# User malenkov -# Date 1360332416 -14400 -# Node ID b2b6ab9d345561a349b840b4d0f18ef9bb9911e4 -# Parent 4d66f7ebcf99c1b322f47ff0aa6adadcd995f8f4 -7200507: Refactor Introspector internals -Reviewed-by: ahgross, art - -diff --git a/src/share/classes/java/beans/ThreadGroupContext.java b/src/share/classes/java/beans/ThreadGroupContext.java ---- jdk/src/share/classes/java/beans/ThreadGroupContext.java -+++ jdk/src/share/classes/java/beans/ThreadGroupContext.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -29,7 +29,6 @@ - import com.sun.beans.finder.PropertyEditorFinder; - - import java.awt.GraphicsEnvironment; --import java.util.HashMap; - import java.util.Map; - import java.util.WeakHashMap; - -@@ -42,7 +41,7 @@ - */ - final class ThreadGroupContext { - -- private static final Map<ThreadGroup, ThreadGroupContext> contexts = new WeakHashMap<ThreadGroup, ThreadGroupContext>(); -+ private static final WeakIdentityMap<ThreadGroupContext> contexts = new WeakIdentityMap<ThreadGroupContext>(); - - /** - * Returns the appropriate {@code AppContext} for the caller, -@@ -69,6 +68,8 @@ - private BeanInfoFinder beanInfoFinder; - private PropertyEditorFinder propertyEditorFinder; - -+ private ThreadGroupContext() { -+ } - - boolean isDesignTime() { - return this.isDesignTime; -diff --git a/src/share/classes/java/beans/WeakIdentityMap.java b/src/share/classes/java/beans/WeakIdentityMap.java -new file mode 100644 ---- /dev/null -+++ jdk/src/share/classes/java/beans/WeakIdentityMap.java -@@ -0,0 +1,181 @@ -+/* -+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. Oracle designates this -+ * particular file as subject to the "Classpath" exception as provided -+ * by Oracle in the LICENSE file that accompanied this code. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ */ -+ -+package java.beans; -+ -+import java.lang.ref.ReferenceQueue; -+import java.lang.ref.WeakReference; -+ -+/** -+ * Hash table based mapping, which uses weak references to store keys -+ * and reference-equality in place of object-equality to compare them. -+ * An entry will automatically be removed when its key is no longer -+ * in ordinary use. Both null values and the null key are supported. -+ * -+ * @see java.util.IdentityHashMap -+ * @see java.util.WeakHashMap -+ */ -+final class WeakIdentityMap<T> { -+ -+ private static final int MAXIMUM_CAPACITY = 1 << 30; // it MUST be a power of two -+ private static final Object NULL = new Object(); // special object for null key -+ -+ private final ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); -+ -+ private Entry<T>[] table = newTable(1<<3); // table's length MUST be a power of two -+ private int threshold = 6; // the next size value at which to resize -+ private int size = 0; // the number of key-value mappings -+ -+ public T get(Object key) { -+ removeStaleEntries(); -+ if (key == null) { -+ key = NULL; -+ } -+ int hash = key.hashCode(); -+ int index = getIndex(this.table, hash); -+ for (Entry<T> entry = this.table[index]; entry != null; entry = entry.next) { -+ if (entry.isMatched(key, hash)) { -+ return entry.value; -+ } -+ } -+ return null; -+ } -+ -+ public T put(Object key, T value) { -+ removeStaleEntries(); -+ if (key == null) { -+ key = NULL; -+ } -+ int hash = key.hashCode(); -+ int index = getIndex(this.table, hash); -+ for (Entry<T> entry = this.table[index]; entry != null; entry = entry.next) { -+ if (entry.isMatched(key, hash)) { -+ T oldValue = entry.value; -+ entry.value = value; -+ return oldValue; -+ } -+ } -+ this.table[index] = new Entry<T>(key, hash, value, this.queue, this.table[index]); -+ if (++this.size >= this.threshold) { -+ if (this.table.length == MAXIMUM_CAPACITY) { -+ this.threshold = Integer.MAX_VALUE; -+ } -+ else { -+ removeStaleEntries(); -+ Entry<T>[] table = newTable(this.table.length * 2); -+ transfer(this.table, table); -+ -+ // If ignoring null elements and processing ref queue caused massive -+ // shrinkage, then restore old table. This should be rare, but avoids -+ // unbounded expansion of garbage-filled tables. -+ if (this.size >= this.threshold / 2) { -+ this.table = table; -+ this.threshold *= 2; -+ } -+ else { -+ transfer(table, this.table); -+ } -+ } -+ } -+ return null; -+ } -+ -+ private void removeStaleEntries() { -+ for (Object ref = this.queue.poll(); ref != null; ref = this.queue.poll()) { -+ @SuppressWarnings("unchecked") -+ Entry<T> entry = (Entry<T>) ref; -+ int index = getIndex(this.table, entry.hash); -+ -+ Entry<T> prev = this.table[index]; -+ Entry<T> current = prev; -+ while (current != null) { -+ Entry<T> next = current.next; -+ if (current == entry) { -+ if (prev == entry) { -+ this.table[index] = next; -+ } -+ else { -+ prev.next = next; -+ } -+ entry.value = null; // Help GC -+ entry.next = null; // Help GC -+ this.size--; -+ break; -+ } -+ prev = current; -+ current = next; -+ } -+ } -+ } -+ -+ private void transfer(Entry<T>[] oldTable, Entry<T>[] newTable) { -+ for (int i = 0; i < oldTable.length; i++) { -+ Entry<T> entry = oldTable[i]; -+ oldTable[i] = null; -+ while (entry != null) { -+ Entry<T> next = entry.next; -+ Object key = entry.get(); -+ if (key == null) { -+ entry.value = null; // Help GC -+ entry.next = null; // Help GC -+ this.size--; -+ } -+ else { -+ int index = getIndex(newTable, entry.hash); -+ entry.next = newTable[index]; -+ newTable[index] = entry; -+ } -+ entry = next; -+ } -+ } -+ } -+ -+ -+ @SuppressWarnings("unchecked") -+ private Entry<T>[] newTable(int length) { -+ return (Entry<T>[]) new Entry<?>[length]; -+ } -+ -+ private static int getIndex(Entry<?>[] table, int hash) { -+ return hash & (table.length - 1); -+ } -+ -+ private static class Entry<T> extends WeakReference<Object> { -+ private final int hash; -+ private T value; -+ private Entry<T> next; -+ -+ Entry(Object key, int hash, T value, ReferenceQueue<Object> queue, Entry<T> next) { -+ super(key, queue); -+ this.hash = hash; -+ this.value = value; -+ this.next = next; -+ } -+ -+ boolean isMatched(Object key, int hash) { -+ return (this.hash == hash) && (key == get()); -+ } -+ } -+} diff --git a/java/openjdk6/files/icedtea/security/20130416/8000724.patch b/java/openjdk6/files/icedtea/security/20130416/8000724.patch deleted file mode 100644 index c288d52a497c..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8000724.patch +++ /dev/null @@ -1,1368 +0,0 @@ -# HG changeset patch -# User andrew -# Date 1365736051 -3600 -# Node ID a5bbb8808ac9a6a8e20c5f267044bb0cef0bbdc1 -# Parent a98937f9777091ef36ec58b79962336d2b1ae538 -8000724: Improve networking serialization -Summary: delegate InetAddress fields to a holder object -Reviewed-by: alanb, chegar - -diff --git a/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java b/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java ---- jdk/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java -+++ jdk/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java -@@ -114,7 +114,7 @@ - * not connected already. - */ - protected void disconnect() { -- disconnect0(connectedAddress.family); -+ disconnect0(connectedAddress.holder().getFamily()); - connected = false; - connectedAddress = null; - connectedPort = -1; -diff --git a/src/share/classes/java/net/Inet4Address.java b/src/share/classes/java/net/Inet4Address.java ---- jdk/src/share/classes/java/net/Inet4Address.java -+++ jdk/src/share/classes/java/net/Inet4Address.java -@@ -102,27 +102,28 @@ - - Inet4Address() { - super(); -- hostName = null; -- address = 0; -- family = IPv4; -+ holder().hostName = null; -+ holder().address = 0; -+ holder().family = IPv4; - } - - Inet4Address(String hostName, byte addr[]) { -- this.hostName = hostName; -- this.family = IPv4; -+ holder().hostName = hostName; -+ holder().family = IPv4; - if (addr != null) { - if (addr.length == INADDRSZ) { -- address = addr[3] & 0xFF; -+ int address = addr[3] & 0xFF; - address |= ((addr[2] << 8) & 0xFF00); - address |= ((addr[1] << 16) & 0xFF0000); - address |= ((addr[0] << 24) & 0xFF000000); -+ holder().address = address; - } - } - } - Inet4Address(String hostName, int address) { -- this.hostName = hostName; -- this.family = IPv4; -- this.address = address; -+ holder().hostName = hostName; -+ holder().family = IPv4; -+ holder().address = address; - } - - /** -@@ -136,8 +137,8 @@ - private Object writeReplace() throws ObjectStreamException { - // will replace the to be serialized 'this' object - InetAddress inet = new InetAddress(); -- inet.hostName = this.hostName; -- inet.address = this.address; -+ inet.holder().hostName = holder().getHostName(); -+ inet.holder().address = holder().getAddress(); - - /** - * Prior to 1.4 an InetAddress was created with a family -@@ -145,7 +146,7 @@ - * For compatibility reasons we must therefore write the - * the InetAddress with this family. - */ -- inet.family = 2; -+ inet.holder().family = 2; - - return inet; - } -@@ -159,7 +160,7 @@ - * @since JDK1.1 - */ - public boolean isMulticastAddress() { -- return ((address & 0xf0000000) == 0xe0000000); -+ return ((holder().getAddress() & 0xf0000000) == 0xe0000000); - } - - /** -@@ -169,7 +170,7 @@ - * @since 1.4 - */ - public boolean isAnyLocalAddress() { -- return address == 0; -+ return holder().getAddress() == 0; - } - - /** -@@ -198,6 +199,7 @@ - // defined in "Documenting Special Use IPv4 Address Blocks - // that have been Registered with IANA" by Bill Manning - // draft-manning-dsua-06.txt -+ int address = holder().getAddress(); - return (((address >>> 24) & 0xFF) == 169) - && (((address >>> 16) & 0xFF) == 254); - } -@@ -214,6 +216,7 @@ - // 10/8 prefix - // 172.16/12 prefix - // 192.168/16 prefix -+ int address = holder().getAddress(); - return (((address >>> 24) & 0xFF) == 10) - || ((((address >>> 24) & 0xFF) == 172) - && (((address >>> 16) & 0xF0) == 16)) -@@ -260,6 +263,7 @@ - */ - public boolean isMCLinkLocal() { - // 224.0.0/24 prefix and ttl == 1 -+ int address = holder().getAddress(); - return (((address >>> 24) & 0xFF) == 224) - && (((address >>> 16) & 0xFF) == 0) - && (((address >>> 8) & 0xFF) == 0); -@@ -275,6 +279,7 @@ - */ - public boolean isMCSiteLocal() { - // 239.255/16 prefix or ttl < 32 -+ int address = holder().getAddress(); - return (((address >>> 24) & 0xFF) == 239) - && (((address >>> 16) & 0xFF) == 255); - } -@@ -290,6 +295,7 @@ - */ - public boolean isMCOrgLocal() { - // 239.192 - 239.195 -+ int address = holder().getAddress(); - return (((address >>> 24) & 0xFF) == 239) - && (((address >>> 16) & 0xFF) >= 192) - && (((address >>> 16) & 0xFF) <= 195); -@@ -303,6 +309,7 @@ - * @return the raw IP address of this object. - */ - public byte[] getAddress() { -+ int address = holder().getAddress(); - byte[] addr = new byte[INADDRSZ]; - - addr[0] = (byte) ((address >>> 24) & 0xFF); -@@ -328,7 +335,7 @@ - * @return a hash code value for this IP address. - */ - public int hashCode() { -- return address; -+ return holder().getAddress(); - } - - /** -@@ -349,7 +356,7 @@ - */ - public boolean equals(Object obj) { - return (obj != null) && (obj instanceof Inet4Address) && -- (((InetAddress)obj).address == address); -+ (((InetAddress)obj).holder().getAddress() == holder().getAddress()); - } - - // Utilities -diff --git a/src/share/classes/java/net/Inet4AddressImpl.java b/src/share/classes/java/net/Inet4AddressImpl.java ---- jdk/src/share/classes/java/net/Inet4AddressImpl.java -+++ jdk/src/share/classes/java/net/Inet4AddressImpl.java -@@ -40,7 +40,7 @@ - public synchronized InetAddress anyLocalAddress() { - if (anyLocalAddress == null) { - anyLocalAddress = new Inet4Address(); // {0x00,0x00,0x00,0x00} -- anyLocalAddress.hostName = "0.0.0.0"; -+ anyLocalAddress.holder().hostName = "0.0.0.0"; - } - return anyLocalAddress; - } -diff --git a/src/share/classes/java/net/Inet6Address.java b/src/share/classes/java/net/Inet6Address.java ---- jdk/src/share/classes/java/net/Inet6Address.java -+++ jdk/src/share/classes/java/net/Inet6Address.java -@@ -216,18 +216,18 @@ - - Inet6Address() { - super(); -- hostName = null; -+ holder().hostName = null; - ipaddress = new byte[INADDRSZ]; -- family = IPv6; -+ holder().family = IPv6; - } - - /* checking of value for scope_id should be done by caller - * scope_id must be >= 0, or -1 to indicate not being set - */ - Inet6Address(String hostName, byte addr[], int scope_id) { -- this.hostName = hostName; -+ holder().hostName = hostName; - if (addr.length == INADDRSZ) { // normal IPv6 address -- family = IPv6; -+ holder().family = IPv6; - ipaddress = addr.clone(); - } - if (scope_id >= 0) { -@@ -328,9 +328,9 @@ - } - - private void initif(String hostName, byte addr[],NetworkInterface nif) throws UnknownHostException { -- this.hostName = hostName; -+ holder().hostName = hostName; - if (addr.length == INADDRSZ) { // normal IPv6 address -- family = IPv6; -+ holder().family = IPv6; - ipaddress = addr.clone(); - } - if (nif != null) { -@@ -415,6 +415,11 @@ - throws IOException, ClassNotFoundException { - scope_ifname = null; - scope_ifname_set = false; -+ -+ if (getClass().getClassLoader() != null) { -+ throw new SecurityException ("invalid address type"); -+ } -+ - s.defaultReadObject(); - - if (ifname != null && !"".equals (ifname)) { -@@ -446,7 +451,7 @@ - ipaddress.length); - } - -- if (family != IPv6) { -+ if (holder().getFamily() != IPv6) { - throw new InvalidObjectException("invalid address family type"); - } - } -diff --git a/src/share/classes/java/net/Inet6AddressImpl.java b/src/share/classes/java/net/Inet6AddressImpl.java ---- jdk/src/share/classes/java/net/Inet6AddressImpl.java -+++ jdk/src/share/classes/java/net/Inet6AddressImpl.java -@@ -81,7 +81,7 @@ - if (anyLocalAddress == null) { - if (InetAddress.preferIPv6Address) { - anyLocalAddress = new Inet6Address(); -- anyLocalAddress.hostName = "::"; -+ anyLocalAddress.holder().hostName = "::"; - } else { - anyLocalAddress = (new Inet4AddressImpl()).anyLocalAddress(); - } -diff --git a/src/share/classes/java/net/InetAddress.java b/src/share/classes/java/net/InetAddress.java ---- jdk/src/share/classes/java/net/InetAddress.java -+++ jdk/src/share/classes/java/net/InetAddress.java -@@ -34,8 +34,12 @@ - import java.util.ArrayList; - import java.security.AccessController; - import java.io.ObjectStreamException; -+import java.io.ObjectStreamField; - import java.io.IOException; - import java.io.ObjectInputStream; -+import java.io.ObjectInputStream.GetField; -+import java.io.ObjectOutputStream; -+import java.io.ObjectOutputStream.PutField; - import sun.security.action.*; - import sun.net.InetAddressCachePolicy; - import sun.net.util.IPAddressUtil; -@@ -196,25 +200,47 @@ - /* Specify address family preference */ - static transient boolean preferIPv6Address = false; - -- /** -- * @serial -- */ -- String hostName; -+ static class InetAddressHolder { - -- /** -- * Holds a 32-bit IPv4 address. -- * -- * @serial -- */ -- int address; -+ InetAddressHolder() {} - -- /** -- * Specifies the address family type, for instance, '1' for IPv4 -- * addresses, and '2' for IPv6 addresses. -- * -- * @serial -- */ -- int family; -+ InetAddressHolder(String hostName, int address, int family) { -+ this.hostName = hostName; -+ this.address = address; -+ this.family = family; -+ } -+ -+ String hostName; -+ -+ String getHostName() { -+ return hostName; -+ } -+ -+ /** -+ * Holds a 32-bit IPv4 address. -+ */ -+ int address; -+ -+ int getAddress() { -+ return address; -+ } -+ -+ /** -+ * Specifies the address family type, for instance, '1' for IPv4 -+ * addresses, and '2' for IPv6 addresses. -+ */ -+ int family; -+ -+ int getFamily() { -+ return family; -+ } -+ } -+ -+ final transient InetAddressHolder holder; -+ -+ InetAddressHolder holder() { -+ return holder; -+ } - - /* Used to store the name service provider */ - private static List<NameService> nameServices = null; -@@ -242,6 +268,7 @@ - * put in the address cache, since it is not created by name. - */ - InetAddress() { -+ holder = new InetAddressHolder(); - } - - /** -@@ -254,7 +281,7 @@ - */ - private Object readResolve() throws ObjectStreamException { - // will replace the deserialized 'this' object -- return new Inet4Address(this.hostName, this.address); -+ return new Inet4Address(holder().getHostName(), holder().getAddress()); - } - - /** -@@ -491,10 +518,10 @@ - * @see SecurityManager#checkConnect - */ - String getHostName(boolean check) { -- if (hostName == null) { -- hostName = InetAddress.getHostFromNameService(this, check); -+ if (holder().getHostName() == null) { -+ holder().hostName = InetAddress.getHostFromNameService(this, check); - } -- return hostName; -+ return holder().getHostName(); - } - - /** -@@ -657,6 +684,7 @@ - * @return a string representation of this IP address. - */ - public String toString() { -+ String hostName = holder().getHostName(); - return ((hostName != null) ? hostName : "") - + "/" + getHostAddress(); - } -@@ -1500,14 +1528,58 @@ - } - } - -+ private static final long FIELDS_OFFSET; -+ private static final sun.misc.Unsafe UNSAFE; -+ -+ static { -+ try { -+ sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe(); -+ FIELDS_OFFSET = unsafe.objectFieldOffset( -+ InetAddress.class.getDeclaredField("holder") -+ ); -+ UNSAFE = unsafe; -+ } catch (NoSuchFieldException e) { -+ throw new Error(e); -+ } -+ } -+ - private void readObject (ObjectInputStream s) throws - IOException, ClassNotFoundException { -- s.defaultReadObject (); - if (getClass().getClassLoader() != null) { -- hostName = null; -- address = 0; - throw new SecurityException ("invalid address type"); - } -+ GetField gf = s.readFields(); -+ String host = (String)gf.get("hostName", null); -+ int address= gf.get("address", 0); -+ int family= gf.get("family", 0); -+ InetAddressHolder h = new InetAddressHolder(host, address, family); -+ UNSAFE.putObject(this, FIELDS_OFFSET, h); -+ } -+ -+ /* needed because the serializable fields no longer exist */ -+ -+ /** -+ * @serialField hostName String -+ * @serialField address int -+ * @serialField family int -+ */ -+ private static final ObjectStreamField[] serialPersistentFields = { -+ new ObjectStreamField("hostName", String.class), -+ new ObjectStreamField("address", int.class), -+ new ObjectStreamField("family", int.class), -+ }; -+ -+ private void writeObject (ObjectOutputStream s) throws -+ IOException { -+ if (getClass().getClassLoader() != null) { -+ throw new SecurityException ("invalid address type"); -+ } -+ PutField pf = s.putFields(); -+ pf.put("hostName", holder().hostName); -+ pf.put("address", holder().address); -+ pf.put("family", holder().family); -+ s.writeFields(); -+ s.flush(); - } - } - -diff --git a/src/share/classes/java/net/InetSocketAddress.java b/src/share/classes/java/net/InetSocketAddress.java ---- jdk/src/share/classes/java/net/InetSocketAddress.java -+++ jdk/src/share/classes/java/net/InetSocketAddress.java -@@ -87,8 +87,8 @@ - if (hostname != null) - return hostname; - if (addr != null) { -- if (addr.hostName != null) -- return addr.hostName; -+ if (addr.holder().getHostName() != null) -+ return addr.holder().getHostName(); - else - return addr.getHostAddress(); - } -diff --git a/src/share/native/java/net/InetAddress.c b/src/share/native/java/net/InetAddress.c ---- jdk/src/share/native/java/net/InetAddress.c -+++ jdk/src/share/native/java/net/InetAddress.c -@@ -33,8 +33,11 @@ - */ - - jclass ia_class; --jfieldID ia_addressID; --jfieldID ia_familyID; -+jclass iac_class; -+jfieldID ia_holderID; -+jfieldID iac_addressID; -+jfieldID iac_familyID; -+jfieldID iac_hostNameID; - jfieldID ia_preferIPv6AddressID; - - /* -@@ -48,10 +51,18 @@ - CHECK_NULL(c); - ia_class = (*env)->NewGlobalRef(env, c); - CHECK_NULL(ia_class); -- ia_addressID = (*env)->GetFieldID(env, ia_class, "address", "I"); -- CHECK_NULL(ia_addressID); -- ia_familyID = (*env)->GetFieldID(env, ia_class, "family", "I"); -- CHECK_NULL(ia_familyID); -+ c = (*env)->FindClass(env,"java/net/InetAddress$InetAddressHolder"); -+ CHECK_NULL(c); -+ iac_class = (*env)->NewGlobalRef(env, c); -+ ia_holderID = (*env)->GetFieldID(env, ia_class, "holder", "Ljava/net/InetAddress$InetAddressHolder;"); -+ CHECK_NULL(ia_holderID); - ia_preferIPv6AddressID = (*env)->GetStaticFieldID(env, ia_class, "preferIPv6Address", "Z"); - CHECK_NULL(ia_preferIPv6AddressID); -+ -+ iac_addressID = (*env)->GetFieldID(env, iac_class, "address", "I"); -+ CHECK_NULL(iac_addressID); -+ iac_familyID = (*env)->GetFieldID(env, iac_class, "family", "I"); -+ CHECK_NULL(iac_familyID); -+ iac_hostNameID = (*env)->GetFieldID(env, iac_class, "hostName", "Ljava/lang/String;"); -+ CHECK_NULL(iac_hostNameID); - } -diff --git a/src/share/native/java/net/net_util.c b/src/share/native/java/net/net_util.c ---- jdk/src/share/native/java/net/net_util.c -+++ jdk/src/share/native/java/net/net_util.c -@@ -84,6 +84,58 @@ - } - } - -+/* The address, and family fields used to be in InetAddress -+ * but are now in an implementation object. So, there is an extra -+ * level of indirection to access them now. -+ */ -+ -+extern jclass iac_class; -+extern jfieldID ia_holderID; -+extern jfieldID iac_addressID; -+extern jfieldID iac_familyID; -+ -+void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address) { -+ jobject holder; -+ init(env); -+ holder = (*env)->GetObjectField(env, iaObj, ia_holderID); -+ (*env)->SetIntField(env, holder, iac_addressID, address); -+} -+ -+void setInetAddress_family(JNIEnv *env, jobject iaObj, int family) { -+ jobject holder; -+ init(env); -+ holder = (*env)->GetObjectField(env, iaObj, ia_holderID); -+ (*env)->SetIntField(env, holder, iac_familyID, family); -+} -+ -+void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject host) { -+ jobject holder; -+ init(env); -+ holder = (*env)->GetObjectField(env, iaObj, ia_holderID); -+ (*env)->SetObjectField(env, holder, iac_hostNameID, host); -+} -+ -+int getInetAddress_addr(JNIEnv *env, jobject iaObj) { -+ jobject holder; -+ init(env); -+ holder = (*env)->GetObjectField(env, iaObj, ia_holderID); -+ return (*env)->GetIntField(env, holder, iac_addressID); -+} -+ -+int getInetAddress_family(JNIEnv *env, jobject iaObj) { -+ jobject holder; -+ init(env); -+ holder = (*env)->GetObjectField(env, iaObj, ia_holderID); -+ return (*env)->GetIntField(env, holder, iac_familyID); -+} -+ -+jobject getInetAddress_hostName(JNIEnv *env, jobject iaObj) { -+ jobject holder; -+ init(env); -+ holder = (*env)->GetObjectField(env, iaObj, ia_holderID); -+ return (*env)->GetObjectField(env, holder, iac_hostNameID); -+} -+ - jobject - NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) { - jobject iaObj; -@@ -110,8 +162,8 @@ - iaObj = (*env)->NewObject(env, inet4Cls, ia4_ctrID); - CHECK_NULL_RETURN(iaObj, NULL); - address = NET_IPv4MappedToIPv4(caddr); -- (*env)->SetIntField(env, iaObj, ia_addressID, address); -- (*env)->SetIntField(env, iaObj, ia_familyID, IPv4); -+ setInetAddress_addr(env, iaObj, address); -+ setInetAddress_family(env, iaObj, IPv4); - } else { - static jclass inet6Cls = 0; - if (inet6Cls == 0) { -@@ -130,7 +182,7 @@ - - (*env)->SetObjectField(env, iaObj, ia6_ipaddressID, ipaddress); - -- (*env)->SetIntField(env, iaObj, ia_familyID, IPv6); -+ setInetAddress_family(env, iaObj, IPv6); - (*env)->SetIntField(env, iaObj, ia6_scopeidID, getScopeID(him)); - } - *port = ntohs(him6->sin6_port); -@@ -149,9 +201,8 @@ - } - iaObj = (*env)->NewObject(env, inet4Cls, ia4_ctrID); - CHECK_NULL_RETURN(iaObj, NULL); -- (*env)->SetIntField(env, iaObj, ia_familyID, IPv4); -- (*env)->SetIntField(env, iaObj, ia_addressID, -- ntohl(him4->sin_addr.s_addr)); -+ setInetAddress_family(env, iaObj, IPv4); -+ setInetAddress_addr(env, iaObj, ntohl(him4->sin_addr.s_addr)); - *port = ntohs(him4->sin_port); - } - return iaObj; -@@ -160,8 +211,7 @@ - jint - NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj) - { -- jint family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4? -- AF_INET : AF_INET6; -+ jint family = getInetAddress_family(env, iaObj) == IPv4?AF_INET : AF_INET6; - - #ifdef AF_INET6 - if (him->sa_family == AF_INET6) { -@@ -178,7 +228,7 @@ - return JNI_FALSE; - } - addrNew = NET_IPv4MappedToIPv4(caddrNew); -- addrCur = (*env)->GetIntField(env, iaObj, ia_addressID); -+ addrCur = getInetAddress_addr(env, iaObj); - if (addrNew == addrCur) { - return JNI_TRUE; - } else { -@@ -210,7 +260,7 @@ - return JNI_FALSE; - } - addrNew = ntohl(him4->sin_addr.s_addr); -- addrCur = (*env)->GetIntField(env, iaObj, ia_addressID); -+ addrCur = getInetAddress_addr(env, iaObj); - if (addrNew == addrCur) { - return JNI_TRUE; - } else { -diff --git a/src/share/native/java/net/net_util.h b/src/share/native/java/net/net_util.h ---- jdk/src/share/native/java/net/net_util.h -+++ jdk/src/share/native/java/net/net_util.h -@@ -53,10 +53,18 @@ - * i.e. psi_timeoutID is PlainSocketImpl's timeout field's ID. - */ - extern jclass ia_class; --extern jfieldID ia_addressID; --extern jfieldID ia_familyID; -+extern jfieldID iac_addressID; -+extern jfieldID iac_familyID; -+extern jfieldID iac_hostNameID; - extern jfieldID ia_preferIPv6AddressID; - -+extern void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address); -+extern void setInetAddress_family(JNIEnv *env, jobject iaObj, int family); -+extern void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject h); -+extern int getInetAddress_addr(JNIEnv *env, jobject iaObj); -+extern int getInetAddress_family(JNIEnv *env, jobject iaObj); -+extern jobject getInetAddress_hostName(JNIEnv *env, jobject iaObj); -+ - extern jclass ia4_class; - extern jmethodID ia4_ctrID; - -diff --git a/src/solaris/native/java/net/Inet4AddressImpl.c b/src/solaris/native/java/net/Inet4AddressImpl.c ---- jdk/src/solaris/native/java/net/Inet4AddressImpl.c -+++ jdk/src/solaris/native/java/net/Inet4AddressImpl.c -@@ -118,9 +118,6 @@ - static jclass ni_iacls; - static jclass ni_ia4cls; - static jmethodID ni_ia4ctrID; --static jfieldID ni_iaaddressID; --static jfieldID ni_iahostID; --static jfieldID ni_iafamilyID; - static int initialized = 0; - - /* -@@ -153,9 +150,6 @@ - ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address"); - ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls); - ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V"); -- ni_iaaddressID = (*env)->GetFieldID(env, ni_iacls, "address", "I"); -- ni_iafamilyID = (*env)->GetFieldID(env, ni_iacls, "family", "I"); -- ni_iahostID = (*env)->GetFieldID(env, ni_iacls, "hostName", "Ljava/lang/String;"); - initialized = 1; - } - -@@ -229,9 +223,8 @@ - ret = NULL; - goto cleanupAndReturn; - } -- (*env)->SetIntField(env, iaObj, ni_iaaddressID, -- ntohl((*addrp)->s_addr)); -- (*env)->SetObjectField(env, iaObj, ni_iahostID, name); -+ setInetAddress_addr(env, iaObj, ntohl((*addrp)->s_addr)); -+ setInetAddress_hostName(env, iaObj, name); - (*env)->SetObjectArrayElement(env, ret, i, iaObj); - addrp++; - i++; -diff --git a/src/solaris/native/java/net/Inet6AddressImpl.c b/src/solaris/native/java/net/Inet6AddressImpl.c ---- jdk/src/solaris/native/java/net/Inet6AddressImpl.c -+++ jdk/src/solaris/native/java/net/Inet6AddressImpl.c -@@ -120,9 +120,6 @@ - static jclass ni_ia6cls; - static jmethodID ni_ia4ctrID; - static jmethodID ni_ia6ctrID; --static jfieldID ni_iaaddressID; --static jfieldID ni_iahostID; --static jfieldID ni_iafamilyID; - static jfieldID ni_ia6ipaddressID; - static int initialized = 0; - -@@ -161,9 +158,6 @@ - ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls); - ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V"); - ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V"); -- ni_iaaddressID = (*env)->GetFieldID(env, ni_iacls, "address", "I"); -- ni_iafamilyID = (*env)->GetFieldID(env, ni_iacls, "family", "I"); -- ni_iahostID = (*env)->GetFieldID(env, ni_iacls, "hostName", "Ljava/lang/String;"); - ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B"); - initialized = 1; - } -@@ -322,9 +316,8 @@ - ret = NULL; - goto cleanupAndReturn; - } -- (*env)->SetIntField(env, iaObj, ni_iaaddressID, -- ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr)); -- (*env)->SetObjectField(env, iaObj, ni_iahostID, name); -+ setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr)); -+ setInetAddress_hostName(env, iaObj, name); - (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj); - inetIndex++; - } else if (iterator->ai_family == AF_INET6) { -@@ -355,7 +348,7 @@ - (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); - } - (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress); -- (*env)->SetObjectField(env, iaObj, ni_iahostID, name); -+ setInetAddress_hostName(env, iaObj, name); - (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj); - inet6Index++; - } -diff --git a/src/solaris/native/java/net/NetworkInterface.c b/src/solaris/native/java/net/NetworkInterface.c ---- jdk/src/solaris/native/java/net/NetworkInterface.c -+++ jdk/src/solaris/native/java/net/NetworkInterface.c -@@ -101,8 +101,6 @@ - static jmethodID ni_ia4ctrID; - static jmethodID ni_ia6ctrID; - static jmethodID ni_ibctrID; --static jfieldID ni_iaaddressID; --static jfieldID ni_iafamilyID; - static jfieldID ni_ia6ipaddressID; - static jfieldID ni_ibaddressID; - static jfieldID ni_ib4broadcastID; -@@ -153,8 +151,6 @@ - ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V"); - ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V"); - ni_ibctrID = (*env)->GetMethodID(env, ni_ibcls, "<init>", "()V"); -- ni_iaaddressID = (*env)->GetFieldID(env, ni_iacls, "address", "I"); -- ni_iafamilyID = (*env)->GetFieldID(env, ni_iacls, "family", "I"); - ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B"); - ni_ibaddressID = (*env)->GetFieldID(env, ni_ibcls, "address", "Ljava/net/InetAddress;"); - ni_ib4broadcastID = (*env)->GetFieldID(env, ni_ibcls, "broadcast", "Ljava/net/Inet4Address;"); -@@ -253,8 +249,7 @@ - (JNIEnv *env, jclass cls, jobject iaObj) { - - netif *ifs, *curr; -- int family = (*env)->GetIntField(env, iaObj, ni_iafamilyID) == IPv4? -- AF_INET : AF_INET6; -+ int family = (getInetAddress_family(env, iaObj) == IPv4) ? AF_INET : AF_INET6; - jobject obj = NULL; - jboolean match = JNI_FALSE; - -@@ -275,7 +270,7 @@ - if (family == addrP->family) { - if (family == AF_INET) { - int address1 = htonl(((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr); -- int address2 = (*env)->GetIntField(env, iaObj, ni_iaaddressID); -+ int address2 = getInetAddress_addr(env, iaObj); - - if (address1 == address2) { - match = JNI_TRUE; -@@ -450,8 +445,7 @@ - if (addrP->family == AF_INET) { - iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID); - if (iaObj) { -- (*env)->SetIntField(env, iaObj, ni_iaaddressID, -- htonl(((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr)); -+ setInetAddress_addr(env, iaObj, htonl(((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr)); - } - ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); - if (ibObj) { -@@ -460,8 +454,7 @@ - jobject ia2Obj = NULL; - ia2Obj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID); - if (ia2Obj) { -- (*env)->SetIntField(env, ia2Obj, ni_iaaddressID, -- htonl(((struct sockaddr_in*)addrP->brdcast)->sin_addr.s_addr)); -+ setInetAddress_addr(env, ia2Obj, htonl(((struct sockaddr_in*)addrP->brdcast)->sin_addr.s_addr)); - (*env)->SetObjectField(env, ibObj, ni_ib4broadcastID, ia2Obj); - (*env)->SetShortField(env, ibObj, ni_ib4maskID, addrP->mask); - } -diff --git a/src/solaris/native/java/net/PlainDatagramSocketImpl.c b/src/solaris/native/java/net/PlainDatagramSocketImpl.c ---- jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c -+++ jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c -@@ -610,11 +610,10 @@ - } - - iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&remote_addr, &port); -- family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4? -- AF_INET : AF_INET6; -+ family = getInetAddress_family(env, iaObj) == IPv4? AF_INET : AF_INET6; - if (family == AF_INET) { /* this api can't handle IPV6 addresses */ -- int address = (*env)->GetIntField(env, iaObj, ia_addressID); -- (*env)->SetIntField(env, addressObj, ia_addressID, address); -+ int address = getInetAddress_addr(env, iaObj); -+ setInetAddress_addr(env, addressObj, address); - } - return port; - } -@@ -1142,7 +1141,6 @@ - */ - static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject value) { - static jfieldID ni_addrsID; -- static jfieldID ia_addressID; - struct in_addr in; - jobjectArray addrArray; - jsize len; -@@ -1155,10 +1153,6 @@ - ni_addrsID = (*env)->GetFieldID(env, c, "addrs", - "[Ljava/net/InetAddress;"); - CHECK_NULL(ni_addrsID); -- c = (*env)->FindClass(env,"java/net/InetAddress"); -- CHECK_NULL(c); -- ia_addressID = (*env)->GetFieldID(env, c, "address", "I"); -- CHECK_NULL(ia_addressID); - } - - addrArray = (*env)->GetObjectField(env, value, ni_addrsID); -@@ -1179,8 +1173,8 @@ - */ - for (i = 0; i < len; i++) { - addr = (*env)->GetObjectArrayElement(env, addrArray, i); -- if ((*env)->GetIntField(env, addr, ia_familyID) == IPv4) { -- in.s_addr = htonl((*env)->GetIntField(env, addr, ia_addressID)); -+ if (getInetAddress_family(env, addr) == IPv4) { -+ in.s_addr = htonl(getInetAddress_addr(env, addr)); - break; - } - } -@@ -1238,17 +1232,9 @@ - * Throw exception if failed. - */ - static void mcast_set_if_by_addr_v4(JNIEnv *env, jobject this, int fd, jobject value) { -- static jfieldID ia_addressID; - struct in_addr in; - -- if (ia_addressID == NULL) { -- jclass c = (*env)->FindClass(env,"java/net/InetAddress"); -- CHECK_NULL(c); -- ia_addressID = (*env)->GetFieldID(env, c, "address", "I"); -- CHECK_NULL(ia_addressID); -- } -- -- in.s_addr = htonl( (*env)->GetIntField(env, value, ia_addressID) ); -+ in.s_addr = htonl( getInetAddress_addr(env, value) ); - - if (JVM_SetSockOpt(fd, IPPROTO_IP, IP_MULTICAST_IF, - (const char*)&in, sizeof(in)) < 0) { -@@ -1583,7 +1569,6 @@ - if (isIPV4) { - static jclass inet4_class; - static jmethodID inet4_ctrID; -- static jfieldID inet4_addrID; - - static jclass ni_class; - static jmethodID ni_ctrID; -@@ -1621,8 +1606,6 @@ - CHECK_NULL_RETURN(c, NULL); - inet4_ctrID = (*env)->GetMethodID(env, c, "<init>", "()V"); - CHECK_NULL_RETURN(inet4_ctrID, NULL); -- inet4_addrID = (*env)->GetFieldID(env, c, "address", "I"); -- CHECK_NULL_RETURN(inet4_addrID, NULL); - inet4_class = (*env)->NewGlobalRef(env, c); - CHECK_NULL_RETURN(inet4_class, NULL); - } -@@ -1630,10 +1613,10 @@ - CHECK_NULL_RETURN(addr, NULL); - - #ifdef __linux__ -- (*env)->SetIntField(env, addr, inet4_addrID, -- (isOldKernel ? ntohl(mreqn.imr_address.s_addr) : ntohl(in.s_addr)) ); -+ setInetAddress_addr(env, addr, (isOldKernel ? -+ ntohl(mreqn.imr_address.s_addr) : ntohl(in.s_addr))); - #else -- (*env)->SetIntField(env, addr, inet4_addrID, ntohl(in.s_addr)); -+ setInetAddress_addr(env, addr, ntohl(in.s_addr)); - #endif - - /* -@@ -2112,7 +2095,7 @@ - ipv6_join_leave = ipv6_available(); - - #ifdef __linux__ -- if ((*env)->GetIntField(env, iaObj, ia_familyID) == IPv4) { -+ if (getInetAddress_family(env, iaObj) == IPv4) { - ipv6_join_leave = JNI_FALSE; - } - #endif -@@ -2159,7 +2142,7 @@ - CHECK_NULL(ni_indexID); - } - -- mname.imr_multiaddr.s_addr = htonl((*env)->GetIntField(env, iaObj, ia_addressID)); -+ mname.imr_multiaddr.s_addr = htonl(getInetAddress_addr(env, iaObj)); - mname.imr_address.s_addr = 0; - mname.imr_ifindex = (*env)->GetIntField(env, niObj, ni_indexID); - mname_len = sizeof(struct ip_mreqn); -@@ -2177,11 +2160,11 @@ - } - addr = (*env)->GetObjectArrayElement(env, addrArray, 0); - -- mname.imr_multiaddr.s_addr = htonl((*env)->GetIntField(env, iaObj, ia_addressID)); -+ mname.imr_multiaddr.s_addr = htonl(getInetAddress_addr(env, iaObj)); - #ifdef __linux__ -- mname.imr_address.s_addr = htonl((*env)->GetIntField(env, addr, ia_addressID)); -+ mname.imr_address.s_addr = htonl(getInetAddress_addr(env, addr)); - #else -- mname.imr_interface.s_addr = htonl((*env)->GetIntField(env, addr, ia_addressID)); -+ mname.imr_interface.s_addr = htonl(getInetAddress_addr(env, addr)); - #endif - mname_len = sizeof(struct ip_mreq); - } -@@ -2220,7 +2203,7 @@ - } - } - -- mname.imr_multiaddr.s_addr = htonl((*env)->GetIntField(env, iaObj, ia_addressID)); -+ mname.imr_multiaddr.s_addr = htonl(getInetAddress_addr(env, iaObj)); - mname.imr_address.s_addr = 0 ; - mname.imr_ifindex = index; - mname_len = sizeof(struct ip_mreqn); -@@ -2250,7 +2233,7 @@ - #else - mname.imr_interface.s_addr = in.s_addr; - #endif -- mname.imr_multiaddr.s_addr = htonl((*env)->GetIntField(env, iaObj, ia_addressID)); -+ mname.imr_multiaddr.s_addr = htonl(getInetAddress_addr(env, iaObj)); - mname_len = sizeof(struct ip_mreq); - } - } -@@ -2315,10 +2298,10 @@ - jbyte caddr[16]; - jint family; - jint address; -- family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4? AF_INET : AF_INET6; -+ family = getInetAddress_family(env, iaObj) == IPv4? AF_INET : AF_INET6; - if (family == AF_INET) { /* will convert to IPv4-mapped address */ - memset((char *) caddr, 0, 16); -- address = (*env)->GetIntField(env, iaObj, ia_addressID); -+ address = getInetAddress_addr(env, iaObj); - - caddr[10] = 0xff; - caddr[11] = 0xff; -diff --git a/src/solaris/native/java/net/net_util_md.c b/src/solaris/native/java/net/net_util_md.c ---- jdk/src/solaris/native/java/net/net_util_md.c -+++ jdk/src/solaris/native/java/net/net_util_md.c -@@ -675,7 +675,7 @@ - NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr *him, - int *len, jboolean v4MappedAddress) { - jint family; -- family = (*env)->GetIntField(env, iaObj, ia_familyID); -+ family = getInetAddress_family(env, iaObj); - #ifdef AF_INET6 - /* needs work. 1. family 2. clean up him6 etc deallocate memory */ - if (ipv6_available() && !(family == IPv4 && v4MappedAddress == JNI_FALSE)) { -@@ -687,7 +687,7 @@ - - if (family == IPv4) { /* will convert to IPv4-mapped address */ - memset((char *) caddr, 0, 16); -- address = (*env)->GetIntField(env, iaObj, ia_addressID); -+ address = getInetAddress_addr(env, iaObj); - if (address == INADDR_ANY) { - /* we would always prefer IPv6 wildcard address - caddr[10] = 0xff; -@@ -794,7 +794,7 @@ - return -1; - } - memset((char *) him4, 0, sizeof(struct sockaddr_in)); -- address = (*env)->GetIntField(env, iaObj, ia_addressID); -+ address = getInetAddress_addr(env, iaObj); - him4->sin_port = htons((short) port); - him4->sin_addr.s_addr = (uint32_t) htonl(address); - him4->sin_family = AF_INET; -diff --git a/src/windows/native/java/net/Inet4AddressImpl.c b/src/windows/native/java/net/Inet4AddressImpl.c ---- jdk/src/windows/native/java/net/Inet4AddressImpl.c -+++ jdk/src/windows/native/java/net/Inet4AddressImpl.c -@@ -113,9 +113,6 @@ - static jclass ni_iacls; - static jclass ni_ia4cls; - static jmethodID ni_ia4ctrID; --static jfieldID ni_iaaddressID; --static jfieldID ni_iahostID; --static jfieldID ni_iafamilyID; - static int initialized = 0; - - /* -@@ -150,9 +147,6 @@ - ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address"); - ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls); - ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V"); -- ni_iaaddressID = (*env)->GetFieldID(env, ni_iacls, "address", "I"); -- ni_iafamilyID = (*env)->GetFieldID(env, ni_iacls, "family", "I"); -- ni_iahostID = (*env)->GetFieldID(env, ni_iacls, "hostName", "Ljava/lang/String;"); - initialized = 1; - } - -@@ -209,8 +203,7 @@ - ret = NULL; - goto cleanupAndReturn; - } -- (*env)->SetIntField(env, iaObj, ni_iaaddressID, -- ntohl(address)); -+ setInetAddress_addr(env, iaObj, ntohl(address)); - (*env)->SetObjectArrayElement(env, ret, 0, iaObj); - JNU_ReleaseStringPlatformChars(env, host, hostname); - return ret; -@@ -247,9 +240,8 @@ - ret = NULL; - goto cleanupAndReturn; - } -- (*env)->SetIntField(env, iaObj, ni_iaaddressID, -- ntohl((*addrp)->s_addr)); -- (*env)->SetObjectField(env, iaObj, ni_iahostID, name); -+ setInetAddress_addr(env, iaObj, ntohl((*addrp)->s_addr)); -+ setInetAddress_hostName(env, iaObj, name); - (*env)->SetObjectArrayElement(env, ret, i, iaObj); - addrp++; - i++; -diff --git a/src/windows/native/java/net/Inet6AddressImpl.c b/src/windows/native/java/net/Inet6AddressImpl.c ---- jdk/src/windows/native/java/net/Inet6AddressImpl.c -+++ jdk/src/windows/native/java/net/Inet6AddressImpl.c -@@ -76,9 +76,6 @@ - static jclass ni_ia6cls; - static jmethodID ni_ia4ctrID; - static jmethodID ni_ia6ctrID; --static jfieldID ni_iaaddressID; --static jfieldID ni_iahostID; --static jfieldID ni_iafamilyID; - static jfieldID ni_ia6ipaddressID; - static int initialized = 0; - -@@ -103,9 +100,6 @@ - ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls); - ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V"); - ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V"); -- ni_iaaddressID = (*env)->GetFieldID(env, ni_iacls, "address", "I"); -- ni_iafamilyID = (*env)->GetFieldID(env, ni_iacls, "family", "I"); -- ni_iahostID = (*env)->GetFieldID(env, ni_iacls, "hostName", "Ljava/lang/String;"); - ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B"); - initialized = 1; - } -@@ -250,9 +244,8 @@ - ret = NULL; - goto cleanupAndReturn; - } -- (*env)->SetIntField(env, iaObj, ni_iaaddressID, -- ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr)); -- (*env)->SetObjectField(env, iaObj, ni_iahostID, name); -+ setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr)); -+ setInetAddress_hostName(env, iaObj, name); - (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj); - inetIndex ++; - } else if (iterator->ai_family == AF_INET6) { -@@ -276,7 +269,7 @@ - (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); - } - (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress); -- (*env)->SetObjectField(env, iaObj, ni_iahostID, name); -+ setInetAddress_hostName(env, iaObj, name); - (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj); - inet6Index ++; - } -diff --git a/src/windows/native/java/net/NetworkInterface.c b/src/windows/native/java/net/NetworkInterface.c ---- jdk/src/windows/native/java/net/NetworkInterface.c -+++ jdk/src/windows/native/java/net/NetworkInterface.c -@@ -97,7 +97,6 @@ - jfieldID ni_displayNameID; /* NetworkInterface.displayName */ - jfieldID ni_childsID; /* NetworkInterface.childs */ - jclass ni_iacls; /* InetAddress */ --jfieldID ni_iaAddr; /* InetAddress.address */ - - jclass ni_ia4cls; /* Inet4Address */ - jmethodID ni_ia4Ctor; /* Inet4Address() */ -@@ -558,7 +557,6 @@ - - ni_iacls = (*env)->FindClass(env, "Ljava/net/InetAddress;"); - ni_iacls = (*env)->NewGlobalRef(env, ni_iacls); -- ni_iaAddr = (*env)->GetFieldID(env, ni_iacls, "address", "I"); - - ni_ia4cls = (*env)->FindClass(env, "Ljava/net/Inet4Address;"); - ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls); -@@ -645,7 +643,7 @@ - } - /* default ctor will set family to AF_INET */ - -- (*env)->SetIntField(env, iaObj, ni_iaAddr, ntohl(addrs->addr.him4.sin_addr.s_addr)); -+ setInetAddress_addr(env, iaObj, ntohl(addrs->addr.him4.sin_addr.s_addr)); - if (addrs->mask != -1) { - ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); - if (ibObj == NULL) { -@@ -658,8 +656,7 @@ - free_netaddr(netaddrP); - return NULL; - } -- (*env)->SetIntField(env, ia2Obj, ni_iaAddr, -- ntohl(addrs->brdcast.him4.sin_addr.s_addr)); -+ setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.him4.sin_addr.s_addr)); - (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj); - (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask); - (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj); -@@ -811,7 +808,7 @@ - (JNIEnv *env, jclass cls, jobject iaObj) - { - netif *ifList, *curr; -- jint addr = (*env)->GetIntField(env, iaObj, ni_iaAddr); -+ jint addr = getInetAddress_addr(env, iaObj); - jobject netifObj = NULL; - - if (os_supports_ipv6 && ipv6_available()) { -diff --git a/src/windows/native/java/net/NetworkInterface.h b/src/windows/native/java/net/NetworkInterface.h ---- jdk/src/windows/native/java/net/NetworkInterface.h -+++ jdk/src/windows/native/java/net/NetworkInterface.h -@@ -70,7 +70,6 @@ - extern jfieldID ni_childsID; /* NetworkInterface.childs */ - - extern jclass ni_iacls; /* InetAddress */ --extern jfieldID ni_iaAddr; /* InetAddress.address */ - - extern jclass ni_ia4cls; /* Inet4Address */ - extern jmethodID ni_ia4Ctor; /* Inet4Address() */ -diff --git a/src/windows/native/java/net/NetworkInterface_winXP.c b/src/windows/native/java/net/NetworkInterface_winXP.c ---- jdk/src/windows/native/java/net/NetworkInterface_winXP.c -+++ jdk/src/windows/native/java/net/NetworkInterface_winXP.c -@@ -33,6 +33,7 @@ - #include "jni_util.h" - - #include "NetworkInterface.h" -+#include "net_util.h" - - /* - * Windows implementation of the java.net.NetworkInterface native methods. -@@ -468,7 +469,7 @@ - } - /* default ctor will set family to AF_INET */ - -- (*env)->SetIntField(env, iaObj, ni_iaAddr, ntohl(addrs->addr.him4.sin_addr.s_addr)); -+ setInetAddress_addr(env, iaObj, ntohl(addrs->addr.him4.sin_addr.s_addr)); - - ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); - if (ibObj == NULL) { -@@ -481,8 +482,7 @@ - free_netaddr(netaddrP); - return NULL; - } -- (*env)->SetIntField(env, ia2Obj, ni_iaAddr, -- ntohl(addrs->brdcast.him4.sin_addr.s_addr)); -+ setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.him4.sin_addr.s_addr)); - (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj); - (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask); - (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj); -diff --git a/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c b/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c ---- jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c -+++ jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c -@@ -432,7 +432,7 @@ - int lcladdrlen; - int address; - -- family = (*env)->GetIntField(env, addressObj, ia_familyID); -+ family = getInetAddress_family(env, addressObj); - if (family == IPv6 && !ipv6_supported) { - JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", - "Protocol family not supported"); -@@ -452,7 +452,7 @@ - JNU_ThrowNullPointerException(env, "argument address"); - return; - } else { -- address = (*env)->GetIntField(env, addressObj, ia_addressID); -+ address = getInetAddress_addr(env, addressObj); - } - - if (NET_InetAddressToSockaddr(env, addressObj, port, (struct sockaddr *)&lcladdr, &lcladdrlen, JNI_FALSE) != 0) { -@@ -552,9 +552,9 @@ - return; - } - -- addr = (*env)->GetIntField(env, address, ia_addressID); -+ addr = getInetAddress_addr(env, address); - -- family = (*env)->GetIntField(env, address, ia_familyID); -+ family = getInetAddress_family(env, address); - if (family == IPv6 && !ipv6_supported) { - JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", - "Protocol family not supported"); -@@ -671,7 +671,7 @@ - return; - } - -- family = (*env)->GetIntField(env, iaObj, ia_familyID); -+ family = getInetAddress_family(env, iaObj); - if (family == IPv4) { - fdObj = (*env)->GetObjectField(env, this, pdsi_fdID); - } else { -@@ -715,7 +715,7 @@ - if (!w2k_or_later) { /* avoid this check on Win 2K or better. Does not work with IPv6. - * Check is not necessary on these OSes */ - if (connected) { -- address = (*env)->GetIntField(env, iaObj, ia_addressID); -+ address = getInetAddress_addr(env, iaObj); - } else { - address = ntohl(rmtaddr.him4.sin_addr.s_addr); - } -@@ -824,7 +824,7 @@ - if (IS_NULL(addressObj)) { - JNU_ThrowNullPointerException(env, "Null address in peek()"); - } else { -- address = (*env)->GetIntField(env, addressObj, ia_addressID); -+ address = getInetAddress_addr(env, addressObj); - /* We only handle IPv4 for now. Will support IPv6 once its in the os */ - family = AF_INET; - } -@@ -906,9 +906,8 @@ - JNU_ThrowByName(env, JNU_JAVAIOPKG "InterruptedIOException", 0); - return 0; - } -- (*env)->SetIntField(env, addressObj, ia_addressID, -- ntohl(remote_addr.sin_addr.s_addr)); -- (*env)->SetIntField(env, addressObj, ia_familyID, IPv4); -+ setInetAddress_addr(env, addressObj, ntohl(remote_addr.sin_addr.s_addr)); -+ setInetAddress_family(env, addressObj, IPv4); - - /* return port */ - return ntohs(remote_addr.sin_port); -@@ -1578,7 +1577,6 @@ - { - jobjectArray addrArray; - static jfieldID ni_addrsID=0; -- static jfieldID ia_familyID=0; - jsize len; - jobject addr; - int i; -@@ -1589,10 +1587,6 @@ - ni_addrsID = (*env)->GetFieldID(env, c, "addrs", - "[Ljava/net/InetAddress;"); - CHECK_NULL_RETURN (ni_addrsID, -1); -- c = (*env)->FindClass(env,"java/net/InetAddress"); -- CHECK_NULL_RETURN (c, -1); -- ia_familyID = (*env)->GetFieldID(env, c, "family", "I"); -- CHECK_NULL_RETURN (ia_familyID, -1); - } - - addrArray = (*env)->GetObjectField(env, nif, ni_addrsID); -@@ -1610,7 +1604,7 @@ - for (i=0; i<len; i++) { - int fam; - addr = (*env)->GetObjectArrayElement(env, addrArray, i); -- fam = (*env)->GetIntField(env, addr, ia_familyID); -+ fam = getInetAddress_family(env, addr); - if (fam == family) { - *iaddr = addr; - return 0; -@@ -1622,20 +1616,13 @@ - static int getInet4AddrFromIf (JNIEnv *env, jobject nif, struct in_addr *iaddr) - { - jobject addr; -- static jfieldID ia_addressID; - - int ret = getInetAddrFromIf (env, IPv4, nif, &addr); - if (ret == -1) { - return -1; - } - -- if (ia_addressID == 0) { -- jclass c = (*env)->FindClass(env,"java/net/InetAddress"); -- CHECK_NULL_RETURN (c, -1); -- ia_addressID = (*env)->GetFieldID(env, c, "address", "I"); -- CHECK_NULL_RETURN (ia_addressID, -1); -- } -- iaddr->s_addr = htonl((*env)->GetIntField(env, addr, ia_addressID)); -+ iaddr->s_addr = htonl(getInetAddress_addr(env, addr)); - return 0; - } - -@@ -1710,17 +1697,9 @@ - } - opt = java_net_SocketOptions_IP_MULTICAST_IF2; - } else { -- static jfieldID ia_addressID; - struct in_addr in; - -- if (ia_addressID == NULL) { -- jclass c = (*env)->FindClass(env,"java/net/InetAddress"); -- CHECK_NULL(c); -- ia_addressID = (*env)->GetFieldID(env, c, "address", "I"); -- CHECK_NULL(ia_addressID); -- } -- -- in.s_addr = htonl((*env)->GetIntField(env, value, ia_addressID)); -+ in.s_addr = htonl(getInetAddress_addr(env, value)); - - if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, - (const char*)&in, sizeof(in)) < 0) { -@@ -1949,7 +1928,6 @@ - if (isIPV4) { - static jclass inet4_class; - static jmethodID inet4_ctrID; -- static jfieldID inet4_addrID; - - static jclass ni_class; - static jmethodID ni_ctrID; -@@ -1979,15 +1957,13 @@ - CHECK_NULL_RETURN(c, NULL); - inet4_ctrID = (*env)->GetMethodID(env, c, "<init>", "()V"); - CHECK_NULL_RETURN(inet4_ctrID, NULL); -- inet4_addrID = (*env)->GetFieldID(env, c, "address", "I"); -- CHECK_NULL_RETURN(inet4_addrID, NULL); - inet4_class = (*env)->NewGlobalRef(env, c); - CHECK_NULL_RETURN(inet4_class, NULL); - } - addr = (*env)->NewObject(env, inet4_class, inet4_ctrID, 0); - CHECK_NULL_RETURN(addr, NULL); - -- (*env)->SetIntField(env, addr, inet4_addrID, ntohl(in.s_addr)); -+ setInetAddress_addr(env, addr, ntohl(in.s_addr)); - - /* - * For IP_MULTICAST_IF return InetAddress -diff --git a/src/windows/native/java/net/TwoStacksPlainSocketImpl.c b/src/windows/native/java/net/TwoStacksPlainSocketImpl.c ---- jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c -+++ jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c -@@ -410,7 +410,7 @@ - fdObj = (*env)->GetObjectField(env, this, psi_fdID); - fd1Obj = (*env)->GetObjectField(env, this, psi_fd1ID); - -- family = (*env)->GetIntField(env, iaObj, ia_familyID); -+ family = getInetAddress_family(env, iaObj); - - if (family == IPv6 && !ipv6_supported) { - JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", -@@ -722,9 +722,8 @@ - return; - } - -- (*env)->SetIntField(env, socketAddressObj, ia_addressID, -- ntohl(him.him4.sin_addr.s_addr)); -- (*env)->SetIntField(env, socketAddressObj, ia_familyID, IPv4); -+ setInetAddress_addr(env, socketAddressObj, ntohl(him.him4.sin_addr.s_addr)); -+ setInetAddress_family(env, socketAddressObj, IPv4); - (*env)->SetObjectField(env, socket, psi_addressID, socketAddressObj); - } else { - jbyteArray addr; -@@ -752,7 +751,7 @@ - } - addr = (*env)->GetObjectField (env, socketAddressObj, ia6_ipaddressID); - (*env)->SetByteArrayRegion (env, addr, 0, 16, (const char *)&him.him6.sin6_addr); -- (*env)->SetIntField(env, socketAddressObj, ia_familyID, IPv6); -+ setInetAddress_family(env, socketAddressObj, IPv6); - (*env)->SetIntField(env, socketAddressObj, ia6_scopeidID, him.him6.sin6_scope_id); - } - /* fields common to AF_INET and AF_INET6 */ -diff --git a/src/windows/native/java/net/net_util_md.c b/src/windows/native/java/net/net_util_md.c ---- jdk/src/windows/native/java/net/net_util_md.c -+++ jdk/src/windows/native/java/net/net_util_md.c -@@ -832,7 +832,7 @@ - NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr *him, - int *len, jboolean v4MappedAddress) { - jint family, iafam; -- iafam = (*env)->GetIntField(env, iaObj, ia_familyID); -+ iafam = getInetAddress_family(env, iaObj); - family = (iafam == IPv4)? AF_INET : AF_INET6; - if (ipv6_available() && !(family == AF_INET && v4MappedAddress == JNI_FALSE)) { - struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him; -@@ -843,7 +843,7 @@ - - if (family == AF_INET) { /* will convert to IPv4-mapped address */ - memset((char *) caddr, 0, 16); -- address = (*env)->GetIntField(env, iaObj, ia_addressID); -+ address = getInetAddress_addr(env, iaObj); - if (address == INADDR_ANY) { - /* we would always prefer IPv6 wildcard address - caddr[10] = 0xff; -@@ -882,7 +882,7 @@ - return -1; - } - memset((char *) him4, 0, sizeof(struct sockaddr_in)); -- address = (int)(*env)->GetIntField(env, iaObj, ia_addressID); -+ address = getInetAddress_addr(env, iaObj); - him4->sin_port = htons((short) port); - him4->sin_addr.s_addr = (u_long) htonl(address); - him4->sin_family = AF_INET; diff --git a/java/openjdk6/files/icedtea/security/20130416/8001031.patch b/java/openjdk6/files/icedtea/security/20130416/8001031.patch deleted file mode 100644 index 288c0e749436..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8001031.patch +++ /dev/null @@ -1,5457 +0,0 @@ -# HG changeset patch -# User andrew -# Date 1365744917 -3600 -# Node ID d79bfc0c6371d1174209585a8d2bf08e3f3625f9 -# Parent ec8a935f0737e033e4ffd401c4d554cd73739c39 -8001031: Better font processing. -Reviewed-by: vadim, prr, mschoene - -diff --git a/src/share/native/sun/font/FontInstanceAdapter.cpp b/src/share/native/sun/font/FontInstanceAdapter.cpp ---- jdk/src/share/native/sun/font/FontInstanceAdapter.cpp -+++ jdk/src/share/native/sun/font/FontInstanceAdapter.cpp -@@ -66,8 +66,21 @@ - yScalePixelsToUnits = upem / yppem; - }; - -+ - const void *FontInstanceAdapter::getFontTable(LETag tableTag) const - { -+ size_t ignored = 0; -+ return getFontTable(tableTag, ignored); -+} -+ -+static const LETag cacheMap[LAYOUTCACHE_ENTRIES] = { -+ GPOS_TAG, GDEF_TAG, GSUB_TAG, MORT_TAG, MORX_TAG, KERN_TAG -+}; -+ -+const void *FontInstanceAdapter::getFontTable(LETag tableTag, size_t &length) const -+{ -+ length = 0; -+ - if (!layoutTables) { // t1 font - return 0; - } -@@ -75,14 +88,19 @@ - // cache in font's pscaler object - // font disposer will handle for us - -- switch(tableTag) { -- case GSUB_TAG: if (layoutTables->gsub_len != -1) return (void*)layoutTables->gsub; break; -- case GPOS_TAG: if (layoutTables->gpos_len != -1) return (void*)layoutTables->gpos; break; -- case GDEF_TAG: if (layoutTables->gdef_len != -1) return (void*)layoutTables->gdef; break; -- case MORT_TAG: if (layoutTables->mort_len != -1) return (void*)layoutTables->mort; break; -- case KERN_TAG: if (layoutTables->kern_len != -1) return (void*)layoutTables->kern; break; -- default: -- //fprintf(stderr, "unexpected table request from font instance adapter: %x\n", tableTag); -+ int cacheIdx; -+ for (cacheIdx=0;cacheIdx<LAYOUTCACHE_ENTRIES;cacheIdx++) { -+ if (tableTag==cacheMap[cacheIdx]) break; -+ } -+ -+ if (cacheIdx<LAYOUTCACHE_ENTRIES) { // if found -+ if (layoutTables->entries[cacheIdx].len != -1) { -+ length = layoutTables->entries[cacheIdx].len; -+ return layoutTables->entries[cacheIdx].ptr; -+ } -+ } else { -+ //fprintf(stderr, "unexpected table request from font instance adapter: %x\n", tableTag); -+ // (don't load any other tables) - return 0; - } - -@@ -96,16 +114,13 @@ - env->GetByteArrayRegion(tableBytes, 0, len, result); - } - -- switch(tableTag) { -- case GSUB_TAG: layoutTables->gsub = (void*)result; layoutTables->gsub_len = len; break; -- case GPOS_TAG: layoutTables->gpos = (void*)result; layoutTables->gpos_len = len; break; -- case GDEF_TAG: layoutTables->gdef = (void*)result; layoutTables->gdef_len = len; break; -- case MORT_TAG: layoutTables->mort = (void*)result; layoutTables->mort_len = len; break; -- case KERN_TAG: layoutTables->kern = (void*)result; layoutTables->kern_len = len; break; -- default: break; -+ if (cacheIdx<LAYOUTCACHE_ENTRIES) { // if cacheable table -+ layoutTables->entries[cacheIdx].len = len; -+ layoutTables->entries[cacheIdx].ptr = (const void*)result; - } - -- return (void*)result; -+ length = len; -+ return (const void*)result; - }; - - LEGlyphID FontInstanceAdapter::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const -diff --git a/src/share/native/sun/font/FontInstanceAdapter.h b/src/share/native/sun/font/FontInstanceAdapter.h ---- jdk/src/share/native/sun/font/FontInstanceAdapter.h -+++ jdk/src/share/native/sun/font/FontInstanceAdapter.h -@@ -86,6 +86,7 @@ - // tables are cached with the native font scaler data - // only supports gsub, gpos, gdef, mort tables at present - virtual const void *getFontTable(LETag tableTag) const; -+ virtual const void *getFontTable(LETag tableTag, size_t &len) const; - - virtual void *getKernPairs() const { - return layoutTables->kernPairs; -diff --git a/src/share/native/sun/font/fontscalerdefs.h b/src/share/native/sun/font/fontscalerdefs.h ---- jdk/src/share/native/sun/font/fontscalerdefs.h -+++ jdk/src/share/native/sun/font/fontscalerdefs.h -@@ -107,20 +107,19 @@ - #define GPOS_TAG 0x47504F53 /* 'GPOS' */ - #define GDEF_TAG 0x47444546 /* 'GDEF' */ - #define MORT_TAG 0x6D6F7274 /* 'mort' */ -+#define MORX_TAG 0x6D6F7278 /* 'morx' */ - #define KERN_TAG 0x6B65726E /* 'kern' */ - -+typedef struct TTLayoutTableCacheEntry { -+ const void* ptr; -+ int len; -+} TTLayoutTableCacheEntry; -+ -+#define LAYOUTCACHE_ENTRIES 6 -+ - typedef struct TTLayoutTableCache { -- void* gsub; -- void* gpos; -- void* gdef; -- void* mort; -- void* kern; -- void* kernPairs; -- int gsub_len; -- int gpos_len; -- int gdef_len; -- int mort_len; -- int kern_len; -+ TTLayoutTableCacheEntry entries[LAYOUTCACHE_ENTRIES]; -+ void* kernPairs; - } TTLayoutTableCache; - - #include "sunfontids.h" -diff --git a/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp b/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp ---- jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp -@@ -39,19 +39,20 @@ - - U_NAMESPACE_BEGIN - --le_uint32 AlternateSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const -+le_uint32 AlternateSubstitutionSubtable::process(const LEReferenceTo<AlternateSubstitutionSubtable> &base, -+ GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const - { - // NOTE: For now, we'll just pick the first alternative... - LEGlyphID glyph = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(glyph); -+ le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); - -- if (coverageIndex >= 0) { -+ if (coverageIndex >= 0 && LE_SUCCESS(success)) { - le_uint16 altSetCount = SWAPW(alternateSetCount); - - if (coverageIndex < altSetCount) { - Offset alternateSetTableOffset = SWAPW(alternateSetTableOffsetArray[coverageIndex]); -- const AlternateSetTable *alternateSetTable = -- (const AlternateSetTable *) ((char *) this + alternateSetTableOffset); -+ const LEReferenceTo<AlternateSetTable> alternateSetTable(base, success, -+ (const AlternateSetTable *) ((char *) this + alternateSetTableOffset)); - TTGlyphID alternate = SWAPW(alternateSetTable->alternateArray[0]); - - if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, alternate))) { -diff --git a/src/share/native/sun/font/layout/AlternateSubstSubtables.h b/src/share/native/sun/font/layout/AlternateSubstSubtables.h ---- jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.h -+++ jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.h -@@ -51,13 +51,17 @@ - TTGlyphID alternateArray[ANY_NUMBER]; - }; - -+LE_VAR_ARRAY(AlternateSetTable, alternateArray) -+ - struct AlternateSubstitutionSubtable : GlyphSubstitutionSubtable - { - le_uint16 alternateSetCount; - Offset alternateSetTableOffsetArray[ANY_NUMBER]; - -- le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; -+ le_uint32 process(const LEReferenceTo<AlternateSubstitutionSubtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter = NULL) const; - }; - -+LE_VAR_ARRAY(AlternateSubstitutionSubtable, alternateSetTableOffsetArray) -+ - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp b/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp -@@ -58,15 +58,18 @@ - - UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ArabicOpenTypeLayoutEngine) - --ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success) -+ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, -+ le_int32 languageCode, le_int32 typoFlags, -+ const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, -+ LEErrorCode &success) - : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success) - { - fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount); - fFeatureOrder = TRUE; - } - --ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -+ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, -+ le_int32 languageCode, - le_int32 typoFlags, LEErrorCode &success) - : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success) - { -@@ -88,8 +91,9 @@ - // Input: characters - // Output: characters, char indices, tags - // Returns: output character count --le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, -- LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) -+le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, -+ le_int32 max, le_bool rightToLeft, LEUnicode *&outChars, -+ LEGlyphStorage &glyphStorage, LEErrorCode &success) - { - if (LE_FAILURE(success)) { - return 0; -@@ -137,22 +141,21 @@ - return; - } - -- if (fGPOSTable != NULL) { -+ if (!fGPOSTable.isEmpty()) { - OpenTypeLayoutEngine::adjustGlyphPositions(chars, offset, count, reverse, glyphStorage, success); -- } else if (fGDEFTable != NULL) { -- GDEFMarkFilter filter(fGDEFTable); -- -+ } else if (!fGDEFTable.isEmpty()) { -+ GDEFMarkFilter filter(fGDEFTable, success); - adjustMarkGlyphs(glyphStorage, &filter, success); - } else { -- GlyphDefinitionTableHeader *gdefTable = (GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable; -- GDEFMarkFilter filter(gdefTable); -+ LEReferenceTo<GlyphDefinitionTableHeader> gdefTable(CanonShaping::glyphDefinitionTable, CanonShaping::glyphDefinitionTableLen); -+ GDEFMarkFilter filter(gdefTable, success); - - adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success); - } - } - - UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success) -- : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG, success) -+ : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG, success) - { - fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable; - fGDEFTable = (const GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable; -@@ -232,7 +235,7 @@ - return; - } - -- GDEFMarkFilter filter(fGDEFTable); -+ GDEFMarkFilter filter(fGDEFTable, success); - - adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success); - } -diff --git a/src/share/native/sun/font/layout/ArabicLayoutEngine.h b/src/share/native/sun/font/layout/ArabicLayoutEngine.h ---- jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h -+++ jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h -@@ -75,7 +75,7 @@ - * @internal - */ - ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success); -+ le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success); - - /** - * This constructor is used when the font requires a "canned" GSUB table which can't be known -diff --git a/src/share/native/sun/font/layout/ArabicShaping.cpp b/src/share/native/sun/font/layout/ArabicShaping.cpp ---- jdk/src/share/native/sun/font/layout/ArabicShaping.cpp -+++ jdk/src/share/native/sun/font/layout/ArabicShaping.cpp -@@ -58,14 +58,16 @@ - */ - ArabicShaping::ShapeType ArabicShaping::getShapeType(LEUnicode c) - { -- const ClassDefinitionTable *joiningTypes = (const ClassDefinitionTable *) ArabicShaping::shapingTypeTable; -- le_int32 joiningType = joiningTypes->getGlyphClass(c); -+ LEErrorCode success = LE_NO_ERROR; -+ const LEReferenceTo<ClassDefinitionTable> joiningTypes((const ClassDefinitionTable *) ArabicShaping::shapingTypeTable, -+ ArabicShaping::shapingTypeTableLen); -+ le_int32 joiningType = joiningTypes->getGlyphClass(joiningTypes, c, success); - -- if (joiningType >= 0 && joiningType < ArabicShaping::JT_COUNT) { -- return ArabicShaping::shapeTypes[joiningType]; -- } -+ if (joiningType >= 0 && joiningType < ArabicShaping::JT_COUNT && LE_SUCCESS(success)) { -+ return ArabicShaping::shapeTypes[joiningType]; -+ } - -- return ArabicShaping::ST_NOSHAPE_NONE; -+ return ArabicShaping::ST_NOSHAPE_NONE; - } - - #define isolFeatureTag LE_ISOL_FEATURE_TAG -diff --git a/src/share/native/sun/font/layout/ArabicShaping.h b/src/share/native/sun/font/layout/ArabicShaping.h ---- jdk/src/share/native/sun/font/layout/ArabicShaping.h -+++ jdk/src/share/native/sun/font/layout/ArabicShaping.h -@@ -93,6 +93,8 @@ - static ShapeType getShapeType(LEUnicode c); - - static const le_uint8 shapingTypeTable[]; -+ static const size_t shapingTypeTableLen; -+ - static const ShapeType shapeTypes[]; - - static void adjustTags(le_int32 outIndex, le_int32 shapeOffset, LEGlyphStorage &glyphStorage); -diff --git a/src/share/native/sun/font/layout/AttachmentPosnSubtables.h b/src/share/native/sun/font/layout/AttachmentPosnSubtables.h ---- jdk/src/share/native/sun/font/layout/AttachmentPosnSubtables.h -+++ jdk/src/share/native/sun/font/layout/AttachmentPosnSubtables.h -@@ -52,14 +52,14 @@ - Offset markArrayOffset; - Offset baseArrayOffset; - -- inline le_int32 getBaseCoverage(LEGlyphID baseGlyphId) const; -+ inline le_int32 getBaseCoverage(const LETableReference &base, LEGlyphID baseGlyphId, LEErrorCode &success) const; - - le_uint32 process(GlyphIterator *glyphIterator) const; - }; - --inline le_int32 AttachmentPositioningSubtable::getBaseCoverage(LEGlyphID baseGlyphID) const -+inline le_int32 AttachmentPositioningSubtable::getBaseCoverage(const LETableReference &base, LEGlyphID baseGlyphID, LEErrorCode &success) const - { -- return getGlyphCoverage(baseCoverageTableOffset, baseGlyphID); -+ return getGlyphCoverage(base, baseCoverageTableOffset, baseGlyphID, success); - } - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/CanonData.cpp b/src/share/native/sun/font/layout/CanonData.cpp ---- jdk/src/share/native/sun/font/layout/CanonData.cpp -+++ jdk/src/share/native/sun/font/layout/CanonData.cpp -@@ -3641,4 +3641,9 @@ - 0x00, 0xE6, 0xD2, 0x42, 0xD2, 0x44, 0x00, 0xE6 - }; - -+ -+const size_t CanonShaping::glyphSubstitutionTableLen = sizeof(glyphSubstitutionTable)/sizeof(glyphSubstitutionTable[0]); -+ -+const size_t CanonShaping::glyphDefinitionTableLen = sizeof(glyphDefinitionTable)/sizeof(glyphDefinitionTable[0]); -+ - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/CanonShaping.cpp b/src/share/native/sun/font/layout/CanonShaping.cpp ---- jdk/src/share/native/sun/font/layout/CanonShaping.cpp -+++ jdk/src/share/native/sun/font/layout/CanonShaping.cpp -@@ -59,15 +59,15 @@ - void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft, - LEUnicode *outChars, LEGlyphStorage &glyphStorage) - { -- const GlyphDefinitionTableHeader *gdefTable = (const GlyphDefinitionTableHeader *) glyphDefinitionTable; -- const ClassDefinitionTable *classTable = gdefTable->getMarkAttachClassDefinitionTable(); -+ LEErrorCode success = LE_NO_ERROR; -+ LEReferenceTo<GlyphDefinitionTableHeader> gdefTable(CanonShaping::glyphDefinitionTable, CanonShaping::glyphDefinitionTableLen); -+ LEReferenceTo<ClassDefinitionTable> classTable = gdefTable->getMarkAttachClassDefinitionTable(gdefTable, success); - le_int32 *combiningClasses = LE_NEW_ARRAY(le_int32, charCount); - le_int32 *indices = LE_NEW_ARRAY(le_int32, charCount); -- LEErrorCode status = LE_NO_ERROR; - le_int32 i; - - for (i = 0; i < charCount; i += 1) { -- combiningClasses[i] = classTable->getGlyphClass((LEGlyphID) inChars[i]); -+ combiningClasses[i] = classTable->getGlyphClass(classTable, (LEGlyphID) inChars[i], success); - indices[i] = i; - } - -@@ -96,7 +96,7 @@ - le_int32 index = indices[i]; - - outChars[i] = inChars[index]; -- glyphStorage.setCharIndex(out, index, status); -+ glyphStorage.setCharIndex(out, index, success); - } - - LE_DELETE_ARRAY(indices); -diff --git a/src/share/native/sun/font/layout/CanonShaping.h b/src/share/native/sun/font/layout/CanonShaping.h ---- jdk/src/share/native/sun/font/layout/CanonShaping.h -+++ jdk/src/share/native/sun/font/layout/CanonShaping.h -@@ -42,7 +42,9 @@ - { - public: - static const le_uint8 glyphSubstitutionTable[]; -+ static const size_t glyphSubstitutionTableLen; - static const le_uint8 glyphDefinitionTable[]; -+ static const size_t glyphDefinitionTableLen; - - static void reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft, - LEUnicode *outChars, LEGlyphStorage &glyphStorage); -diff --git a/src/share/native/sun/font/layout/ClassDefinitionTables.cpp b/src/share/native/sun/font/layout/ClassDefinitionTables.cpp ---- jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp -+++ jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp -@@ -37,24 +37,51 @@ - - U_NAMESPACE_BEGIN - --le_int32 ClassDefinitionTable::getGlyphClass(LEGlyphID glyphID) const -+le_int32 ClassDefinitionTable::getGlyphClass(const LETableReference& base, LEGlyphID glyphID, LEErrorCode &success) const - { -+ LEReferenceTo<ClassDefinitionTable> thisRef(base, success); -+ if (LE_FAILURE(success)) return 0; -+ -+ switch(SWAPW(classFormat)) { -+ case 0: -+ return 0; -+ -+ case 1: -+ { -+ const LEReferenceTo<ClassDefFormat1Table> f1Table(thisRef, success); -+ return f1Table->getGlyphClass(f1Table, glyphID, success); -+ } -+ -+ case 2: -+ { -+ const LEReferenceTo<ClassDefFormat2Table> f2Table(thisRef, success); -+ return f2Table->getGlyphClass(f2Table, glyphID, success); -+ } -+ -+ default: -+ return 0; -+ } -+} -+ -+le_bool ClassDefinitionTable::hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const -+{ -+ LEReferenceTo<ClassDefinitionTable> thisRef(base, success); -+ if (LE_FAILURE(success)) return 0; -+ - switch(SWAPW(classFormat)) { - case 0: - return 0; - - case 1: - { -- const ClassDefFormat1Table *f1Table = (const ClassDefFormat1Table *) this; -- -- return f1Table->getGlyphClass(glyphID); -+ const LEReferenceTo<ClassDefFormat1Table> f1Table(thisRef, success); -+ return f1Table->hasGlyphClass(f1Table, glyphClass, success); - } - - case 2: - { -- const ClassDefFormat2Table *f2Table = (const ClassDefFormat2Table *) this; -- -- return f2Table->getGlyphClass(glyphID); -+ const LEReferenceTo<ClassDefFormat2Table> f2Table(thisRef, success); -+ return f2Table->hasGlyphClass(f2Table, glyphClass, success); - } - - default: -@@ -62,51 +89,32 @@ - } - } - --le_bool ClassDefinitionTable::hasGlyphClass(le_int32 glyphClass) const -+le_int32 ClassDefFormat1Table::getGlyphClass(const LETableReference& base, LEGlyphID glyphID, LEErrorCode &success) const - { -- switch(SWAPW(classFormat)) { -- case 0: -- return 0; -+ if(LE_FAILURE(success)) return 0; - -- case 1: -- { -- const ClassDefFormat1Table *f1Table = (const ClassDefFormat1Table *) this; -- -- return f1Table->hasGlyphClass(glyphClass); -- } -- -- case 2: -- { -- const ClassDefFormat2Table *f2Table = (const ClassDefFormat2Table *) this; -- -- return f2Table->hasGlyphClass(glyphClass); -- } -- -- default: -- return 0; -- } --} -- --le_int32 ClassDefFormat1Table::getGlyphClass(LEGlyphID glyphID) const --{ -+ le_uint16 count = SWAPW(glyphCount); -+ LEReferenceToArrayOf<le_uint16> classValueArrayRef(base, success, &classValueArray[0], count); - TTGlyphID ttGlyphID = (TTGlyphID) LE_GET_GLYPH(glyphID); - TTGlyphID firstGlyph = SWAPW(startGlyph); -- TTGlyphID lastGlyph = firstGlyph + SWAPW(glyphCount); -+ TTGlyphID lastGlyph = firstGlyph + count; - -- if (ttGlyphID >= firstGlyph && ttGlyphID < lastGlyph) { -- return SWAPW(classValueArray[ttGlyphID - firstGlyph]); -+ if (LE_SUCCESS(success) && ttGlyphID >= firstGlyph && ttGlyphID < lastGlyph) { -+ return SWAPW( classValueArrayRef(ttGlyphID - firstGlyph, success) ); - } - - return 0; - } - --le_bool ClassDefFormat1Table::hasGlyphClass(le_int32 glyphClass) const -+le_bool ClassDefFormat1Table::hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const - { -- le_uint16 count = SWAPW(glyphCount); -+ if(LE_FAILURE(success)) return 0; -+ le_uint16 count = SWAPW(glyphCount); -+ LEReferenceToArrayOf<le_uint16> classValueArrayRef(base, success, &classValueArray[0], count); - int i; - -- for (i = 0; i < count; i += 1) { -- if (SWAPW(classValueArray[i]) == glyphClass) { -+ for (i = 0; LE_SUCCESS(success)&& (i < count); i += 1) { -+ if (SWAPW(classValueArrayRef(i,success)) == glyphClass) { - return TRUE; - } - } -@@ -114,27 +122,31 @@ - return FALSE; - } - --le_int32 ClassDefFormat2Table::getGlyphClass(LEGlyphID glyphID) const -+le_int32 ClassDefFormat2Table::getGlyphClass(const LETableReference& base, LEGlyphID glyphID, LEErrorCode &success) const - { -+ if(LE_FAILURE(success)) return 0; - TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(glyphID); - le_uint16 rangeCount = SWAPW(classRangeCount); -+ LEReferenceToArrayOf<GlyphRangeRecord> classRangeRecordArrayRef(base, success, &classRangeRecordArray[0], rangeCount); - le_int32 rangeIndex = -- OpenTypeUtilities::getGlyphRangeIndex(ttGlyph, classRangeRecordArray, rangeCount); -+ OpenTypeUtilities::getGlyphRangeIndex(ttGlyph, classRangeRecordArrayRef, success); - -- if (rangeIndex < 0) { -+ if (rangeIndex < 0 || LE_FAILURE(success)) { - return 0; - } - -- return SWAPW(classRangeRecordArray[rangeIndex].rangeValue); -+ return SWAPW(classRangeRecordArrayRef(rangeIndex, success).rangeValue); - } - --le_bool ClassDefFormat2Table::hasGlyphClass(le_int32 glyphClass) const -+le_bool ClassDefFormat2Table::hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const - { -+ if(LE_FAILURE(success)) return 0; - le_uint16 rangeCount = SWAPW(classRangeCount); -+ LEReferenceToArrayOf<GlyphRangeRecord> classRangeRecordArrayRef(base, success, &classRangeRecordArray[0], rangeCount); - int i; - -- for (i = 0; i < rangeCount; i += 1) { -- if (SWAPW(classRangeRecordArray[i].rangeValue) == glyphClass) { -+ for (i = 0; i < rangeCount && LE_SUCCESS(success); i += 1) { -+ if (SWAPW(classRangeRecordArrayRef(i,success).rangeValue) == glyphClass) { - return TRUE; - } - } -diff --git a/src/share/native/sun/font/layout/ClassDefinitionTables.h b/src/share/native/sun/font/layout/ClassDefinitionTables.h ---- jdk/src/share/native/sun/font/layout/ClassDefinitionTables.h -+++ jdk/src/share/native/sun/font/layout/ClassDefinitionTables.h -@@ -46,8 +46,20 @@ - { - le_uint16 classFormat; - -- le_int32 getGlyphClass(LEGlyphID glyphID) const; -- le_bool hasGlyphClass(le_int32 glyphClass) const; -+ le_int32 getGlyphClass(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const; -+ le_bool hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const; -+ -+ le_int32 getGlyphClass(LEGlyphID glyphID) const { -+ LETableReference base((const le_uint8*)this); -+ LEErrorCode ignored = LE_NO_ERROR; -+ return getGlyphClass(base,glyphID,ignored); -+ } -+ -+ le_bool hasGlyphClass(le_int32 glyphClass) const { -+ LETableReference base((const le_uint8*)this); -+ LEErrorCode ignored = LE_NO_ERROR; -+ return hasGlyphClass(base,glyphClass,ignored); -+ } - }; - - struct ClassDefFormat1Table : ClassDefinitionTable -@@ -56,9 +68,11 @@ - le_uint16 glyphCount; - le_uint16 classValueArray[ANY_NUMBER]; - -- le_int32 getGlyphClass(LEGlyphID glyphID) const; -- le_bool hasGlyphClass(le_int32 glyphClass) const; -+ le_int32 getGlyphClass(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const; -+ le_bool hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const; - }; -+LE_VAR_ARRAY(ClassDefFormat1Table, classValueArray) -+ - - struct ClassRangeRecord - { -@@ -72,9 +86,10 @@ - le_uint16 classRangeCount; - GlyphRangeRecord classRangeRecordArray[ANY_NUMBER]; - -- le_int32 getGlyphClass(LEGlyphID glyphID) const; -- le_bool hasGlyphClass(le_int32 glyphClass) const; -+ le_int32 getGlyphClass(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const; -+ le_bool hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const; - }; -+LE_VAR_ARRAY(ClassDefFormat2Table, classRangeRecordArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp b/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp ---- jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp -+++ jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp -@@ -43,13 +43,18 @@ - - UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ContextualGlyphSubstitutionProcessor) - --ContextualGlyphSubstitutionProcessor::ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader) -- : StateTableProcessor(morphSubtableHeader) -+ContextualGlyphSubstitutionProcessor::ContextualGlyphSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) -+ : StateTableProcessor(morphSubtableHeader, success), entryTable(), contextualGlyphSubstitutionHeader(morphSubtableHeader, success) - { -- contextualGlyphSubstitutionHeader = (const ContextualGlyphSubstitutionHeader *) morphSubtableHeader; -- substitutionTableOffset = SWAPW(contextualGlyphSubstitutionHeader->substitutionTableOffset); -+ contextualGlyphSubstitutionHeader.orphan(); -+ substitutionTableOffset = SWAPW(contextualGlyphSubstitutionHeader->substitutionTableOffset); - -- entryTable = (const ContextualGlyphSubstitutionStateEntry *) ((char *) &stateTableHeader->stHeader + entryTableOffset); -+ -+ entryTable = LEReferenceToArrayOf<ContextualGlyphSubstitutionStateEntry>(stateTableHeader, success, -+ (const ContextualGlyphSubstitutionStateEntry*)(&stateTableHeader->stHeader), -+ entryTableOffset, LE_UNBOUNDED_ARRAY); -+ int16Table = LEReferenceToArrayOf<le_int16>(stateTableHeader, success, (const le_int16*)(&stateTableHeader->stHeader), -+ 0, LE_UNBOUNDED_ARRAY); // rest of the table as le_int16s - } - - ContextualGlyphSubstitutionProcessor::~ContextualGlyphSubstitutionProcessor() -@@ -63,27 +68,26 @@ - - ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index) - { -- const ContextualGlyphSubstitutionStateEntry *entry = &entryTable[index]; -- ByteOffset newState = SWAPW(entry->newStateOffset); -- le_int16 flags = SWAPW(entry->flags); -- WordOffset markOffset = SWAPW(entry->markOffset); -- WordOffset currOffset = SWAPW(entry->currOffset); -+ LEErrorCode success = LE_NO_ERROR; -+ const ContextualGlyphSubstitutionStateEntry *entry = entryTable.getAlias(index, success); -+ ByteOffset newState = SWAPW(entry->newStateOffset); -+ le_int16 flags = SWAPW(entry->flags); -+ WordOffset markOffset = SWAPW(entry->markOffset); -+ WordOffset currOffset = SWAPW(entry->currOffset); - -- if (markOffset != 0) { -- const le_int16 *table = (const le_int16 *) ((char *) &stateTableHeader->stHeader + markOffset * 2); -- LEGlyphID mGlyph = glyphStorage[markGlyph]; -- TTGlyphID newGlyph = SWAPW(table[LE_GET_GLYPH(mGlyph)]); -+ if (markOffset != 0 && LE_SUCCESS(success)) { -+ LEGlyphID mGlyph = glyphStorage[markGlyph]; -+ TTGlyphID newGlyph = SWAPW(int16Table.getObject(markOffset + LE_GET_GLYPH(mGlyph), success)); // whew. - -- glyphStorage[markGlyph] = LE_SET_GLYPH(mGlyph, newGlyph); -- } -+ glyphStorage[markGlyph] = LE_SET_GLYPH(mGlyph, newGlyph); -+ } - -- if (currOffset != 0) { -- const le_int16 *table = (const le_int16 *) ((char *) &stateTableHeader->stHeader + currOffset * 2); -- LEGlyphID thisGlyph = glyphStorage[currGlyph]; -- TTGlyphID newGlyph = SWAPW(table[LE_GET_GLYPH(thisGlyph)]); -+ if (currOffset != 0) { -+ LEGlyphID thisGlyph = glyphStorage[currGlyph]; -+ TTGlyphID newGlyph = SWAPW(int16Table.getObject(currOffset + LE_GET_GLYPH(thisGlyph), success)); // whew. - -- glyphStorage[currGlyph] = LE_SET_GLYPH(thisGlyph, newGlyph); -- } -+ glyphStorage[currGlyph] = LE_SET_GLYPH(thisGlyph, newGlyph); -+ } - - if (flags & cgsSetMark) { - markGlyph = currGlyph; -diff --git a/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h b/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h ---- jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h -+++ jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h -@@ -56,7 +56,7 @@ - - virtual void endStateTable(); - -- ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader); -+ ContextualGlyphSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success); - virtual ~ContextualGlyphSubstitutionProcessor(); - - /** -@@ -78,11 +78,11 @@ - - protected: - ByteOffset substitutionTableOffset; -- const ContextualGlyphSubstitutionStateEntry *entryTable; -- -+ LEReferenceToArrayOf<ContextualGlyphSubstitutionStateEntry> entryTable; -+ LEReferenceToArrayOf<le_int16> int16Table; - le_int32 markGlyph; - -- const ContextualGlyphSubstitutionHeader *contextualGlyphSubstitutionHeader; -+ LEReferenceTo<ContextualGlyphSubstitutionHeader> contextualGlyphSubstitutionHeader; - - }; - -diff --git a/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp b/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp ---- jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp -@@ -217,7 +217,7 @@ - } - - LEGlyphID glyph = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(glyph); -+ le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success); - - if (coverageIndex >= 0) { - le_uint16 srSetCount = SWAPW(subRuleSetCount); -@@ -266,7 +266,7 @@ - } - - LEGlyphID glyph = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(glyph); -+ le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success); - - if (coverageIndex >= 0) { - const ClassDefinitionTable *classDefinitionTable = -@@ -394,7 +394,7 @@ - } - - LEGlyphID glyph = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(glyph); -+ le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success); - - if (coverageIndex >= 0) { - le_uint16 srSetCount = SWAPW(chainSubRuleSetCount); -@@ -465,7 +465,7 @@ - } - - LEGlyphID glyph = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(glyph); -+ le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success); - - if (coverageIndex >= 0) { - const ClassDefinitionTable *backtrackClassDefinitionTable = -diff --git a/src/share/native/sun/font/layout/ContextualSubstSubtables.h b/src/share/native/sun/font/layout/ContextualSubstSubtables.h ---- jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h -+++ jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h -@@ -43,6 +43,7 @@ - #include "GlyphSubstitutionTables.h" - #include "GlyphIterator.h" - #include "LookupProcessor.h" -+#include "LETableReference.h" - - U_NAMESPACE_BEGIN - -@@ -88,6 +89,8 @@ - - le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; - }; -+LE_VAR_ARRAY(ContextualSubstitutionFormat1Subtable, subRuleSetTableOffsetArray) -+ - - struct SubRuleSetTable - { -@@ -95,6 +98,7 @@ - Offset subRuleTableOffsetArray[ANY_NUMBER]; - - }; -+LE_VAR_ARRAY(SubRuleSetTable, subRuleTableOffsetArray) - - // NOTE: Multiple variable size arrays!! - struct SubRuleTable -@@ -104,6 +108,7 @@ - TTGlyphID inputGlyphArray[ANY_NUMBER]; - //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(SubRuleTable, inputGlyphArray) - - struct ContextualSubstitutionFormat2Subtable : ContextualSubstitutionSubtable - { -@@ -113,12 +118,16 @@ - - le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; - }; -+LE_VAR_ARRAY(ContextualSubstitutionFormat2Subtable, subClassSetTableOffsetArray) -+ - - struct SubClassSetTable - { - le_uint16 subClassRuleCount; - Offset subClassRuleTableOffsetArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(SubClassSetTable, subClassRuleTableOffsetArray) -+ - - // NOTE: Multiple variable size arrays!! - struct SubClassRuleTable -@@ -128,6 +137,8 @@ - le_uint16 classArray[ANY_NUMBER]; - //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(SubClassRuleTable, classArray) -+ - - // NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause - // it has an array of coverage tables instead of a single coverage table... -@@ -143,6 +154,7 @@ - - le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; - }; -+LE_VAR_ARRAY(ContextualSubstitutionFormat3Subtable, coverageTableOffsetArray) - - struct ChainingContextualSubstitutionSubtable : ContextualSubstitutionBase - { -@@ -156,6 +168,8 @@ - - le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; - }; -+LE_VAR_ARRAY(ChainingContextualSubstitutionFormat1Subtable, chainSubRuleSetTableOffsetArray) -+ - - struct ChainSubRuleSetTable - { -@@ -163,6 +177,7 @@ - Offset chainSubRuleTableOffsetArray[ANY_NUMBER]; - - }; -+LE_VAR_ARRAY(ChainSubRuleSetTable, chainSubRuleTableOffsetArray) - - // NOTE: Multiple variable size arrays!! - struct ChainSubRuleTable -@@ -176,6 +191,7 @@ - //le_uint16 substCount; - //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(ChainSubRuleTable, backtrackGlyphArray) - - struct ChainingContextualSubstitutionFormat2Subtable : ChainingContextualSubstitutionSubtable - { -@@ -187,12 +203,15 @@ - - le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; - }; -+LE_VAR_ARRAY(ChainingContextualSubstitutionFormat2Subtable, chainSubClassSetTableOffsetArray) - - struct ChainSubClassSetTable - { - le_uint16 chainSubClassRuleCount; - Offset chainSubClassRuleTableOffsetArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(ChainSubClassSetTable, chainSubClassRuleTableOffsetArray) -+ - - // NOTE: Multiple variable size arrays!! - struct ChainSubClassRuleTable -@@ -206,6 +225,7 @@ - //le_uint16 substCount; - //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(ChainSubClassRuleTable, backtrackClassArray) - - // NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause - // it has arrays of coverage tables instead of a single coverage table... -@@ -225,6 +245,8 @@ - - le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; - }; -+LE_VAR_ARRAY(ChainingContextualSubstitutionFormat3Subtable, backtrackCoverageTableOffsetArray) -+ - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/CoverageTables.h b/src/share/native/sun/font/layout/CoverageTables.h ---- jdk/src/share/native/sun/font/layout/CoverageTables.h -+++ jdk/src/share/native/sun/font/layout/CoverageTables.h -@@ -56,6 +56,8 @@ - - le_int32 getGlyphCoverage(LEGlyphID glyphID) const; - }; -+LE_VAR_ARRAY(CoverageFormat1Table, glyphArray) -+ - - struct CoverageFormat2Table : CoverageTable - { -@@ -64,6 +66,7 @@ - - le_int32 getGlyphCoverage(LEGlyphID glyphID) const; - }; -+LE_VAR_ARRAY(CoverageFormat2Table, rangeRecordArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp b/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp ---- jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp -@@ -39,10 +39,10 @@ - - U_NAMESPACE_BEGIN - --le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const -+le_uint32 CursiveAttachmentSubtable::process(const LEReferenceTo<CursiveAttachmentSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const - { - LEGlyphID glyphID = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(glyphID); -+ le_int32 coverageIndex = getGlyphCoverage(base, glyphID, success); - le_uint16 eeCount = SWAPW(entryExitCount); - - if (coverageIndex < 0 || coverageIndex >= eeCount) { -@@ -51,7 +51,7 @@ - } - - LEPoint entryAnchor, exitAnchor; -- Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor); -+ Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor); // TODO - Offset exitOffset = SWAPW(entryExitRecords[coverageIndex].exitAnchor); - - if (entryOffset != 0) { -diff --git a/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h b/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h ---- jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h -+++ jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h -@@ -57,8 +57,9 @@ - le_uint16 entryExitCount; - EntryExitRecord entryExitRecords[ANY_NUMBER]; - -- le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; -+ le_uint32 process(const LEReferenceTo<CursiveAttachmentSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const; - }; -+LE_VAR_ARRAY(CursiveAttachmentSubtable, entryExitRecords) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/DeviceTables.h b/src/share/native/sun/font/layout/DeviceTables.h ---- jdk/src/share/native/sun/font/layout/DeviceTables.h -+++ jdk/src/share/native/sun/font/layout/DeviceTables.h -@@ -57,6 +57,7 @@ - static const le_uint16 fieldSignBits[]; - static const le_uint16 fieldBits[]; - }; -+LE_VAR_ARRAY(DeviceTable, deltaValues) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/ExtensionSubtables.cpp b/src/share/native/sun/font/layout/ExtensionSubtables.cpp ---- jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp -@@ -47,6 +47,8 @@ - le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType, - GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const - { -+ const LEReferenceTo<ExtensionSubtable> thisRef(lookupProcessor->getReference(), success); // create a reference to this -+ - if (LE_FAILURE(success)) { - return 0; - } -@@ -55,9 +57,11 @@ - - if (elt != lookupType) { - le_uint32 extOffset = READ_LONG(extensionOffset); -- LookupSubtable *subtable = (LookupSubtable *) ((char *) this + extOffset); -+ LEReferenceTo<LookupSubtable> subtable(thisRef, success, extOffset); - -- return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance, success); -+ if(LE_SUCCESS(success)) { -+ return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance, success); -+ } - } - - return 0; -diff --git a/src/share/native/sun/font/layout/Features.cpp b/src/share/native/sun/font/layout/Features.cpp ---- jdk/src/share/native/sun/font/layout/Features.cpp -+++ jdk/src/share/native/sun/font/layout/Features.cpp -@@ -38,19 +38,20 @@ - - U_NAMESPACE_BEGIN - --const FeatureTable *FeatureListTable::getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const -+LEReferenceTo<FeatureTable> FeatureListTable::getFeatureTable(const LETableReference &base, le_uint16 featureIndex, LETag *featureTag, LEErrorCode &success) const - { -- if (featureIndex >= SWAPW(featureCount)) { -- return 0; -- } -+ if (featureIndex >= SWAPW(featureCount) || LE_FAILURE(success)) { -+ return LEReferenceTo<FeatureTable>(); -+ } - - Offset featureTableOffset = featureRecordArray[featureIndex].featureTableOffset; - - *featureTag = SWAPT(featureRecordArray[featureIndex].featureTag); - -- return (const FeatureTable *) ((char *) this + SWAPW(featureTableOffset)); -+ return LEReferenceTo<FeatureTable>(base, success, SWAPW(featureTableOffset)); - } - -+#if 0 - /* - * Note: according to the OpenType Spec. v 1.4, the entries in the Feature - * List Table are sorted alphabetically by feature tag; however, there seem -@@ -82,5 +83,6 @@ - return 0; - #endif - } -+#endif - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/GDEFMarkFilter.cpp b/src/share/native/sun/font/layout/GDEFMarkFilter.cpp ---- jdk/src/share/native/sun/font/layout/GDEFMarkFilter.cpp -+++ jdk/src/share/native/sun/font/layout/GDEFMarkFilter.cpp -@@ -36,9 +36,12 @@ - - U_NAMESPACE_BEGIN - --GDEFMarkFilter::GDEFMarkFilter(const GlyphDefinitionTableHeader *gdefTable) -+GDEFMarkFilter::GDEFMarkFilter(const LEReferenceTo<GlyphDefinitionTableHeader> &gdefTable, LEErrorCode &success) -+ : classDefTable(gdefTable->getGlyphClassDefinitionTable(gdefTable, success)) - { -- classDefTable = gdefTable->getGlyphClassDefinitionTable(); -+ if(!classDefTable.isValid()) { -+ success = LE_INTERNAL_ERROR; -+ } - } - - GDEFMarkFilter::~GDEFMarkFilter() -diff --git a/src/share/native/sun/font/layout/GDEFMarkFilter.h b/src/share/native/sun/font/layout/GDEFMarkFilter.h ---- jdk/src/share/native/sun/font/layout/GDEFMarkFilter.h -+++ jdk/src/share/native/sun/font/layout/GDEFMarkFilter.h -@@ -46,13 +46,13 @@ - class GDEFMarkFilter : public UMemory, public LEGlyphFilter - { - private: -- const GlyphClassDefinitionTable *classDefTable; -+ const LEReferenceTo<GlyphClassDefinitionTable> classDefTable; - - GDEFMarkFilter(const GDEFMarkFilter &other); // forbid copying of this class - GDEFMarkFilter &operator=(const GDEFMarkFilter &other); // forbid copying of this class - - public: -- GDEFMarkFilter(const GlyphDefinitionTableHeader *gdefTable); -+ GDEFMarkFilter(const LEReferenceTo<GlyphDefinitionTableHeader> &gdefTable, LEErrorCode &success); - virtual ~GDEFMarkFilter(); - - virtual le_bool accept(LEGlyphID glyph) const; -diff --git a/src/share/native/sun/font/layout/GXLayoutEngine.cpp b/src/share/native/sun/font/layout/GXLayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp -@@ -41,9 +41,10 @@ - - UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine) - --GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable, LEErrorCode &success) -+ GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const LEReferenceTo<MorphTableHeader> &morphTable, LEErrorCode &success) - : LayoutEngine(fontInstance, scriptCode, languageCode, 0, success), fMorphTable(morphTable) - { -+ fMorphTable.orphan(); - // nothing else to do? - } - -@@ -70,7 +71,7 @@ - return 0; - } - -- fMorphTable->process(glyphStorage); -+ fMorphTable->process(fMorphTable, glyphStorage, success); - - return count; - } -diff --git a/src/share/native/sun/font/layout/GXLayoutEngine.h b/src/share/native/sun/font/layout/GXLayoutEngine.h ---- jdk/src/share/native/sun/font/layout/GXLayoutEngine.h -+++ jdk/src/share/native/sun/font/layout/GXLayoutEngine.h -@@ -74,7 +74,7 @@ - * - * @internal - */ -- GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable, LEErrorCode &success); -+ GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const LEReferenceTo<MorphTableHeader> &morphTable, LEErrorCode &success); - - /** - * The destructor, virtual for correct polymorphic invocation. -@@ -104,7 +104,7 @@ - * - * @internal - */ -- const MorphTableHeader *fMorphTable; -+ LEReferenceTo<MorphTableHeader> fMorphTable; - - /** - * This method does GX layout using the font's 'mort' table. It converts the -diff --git a/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp b/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp ---- jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp -+++ jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp -@@ -36,24 +36,36 @@ - - U_NAMESPACE_BEGIN - --const GlyphClassDefinitionTable *GlyphDefinitionTableHeader::getGlyphClassDefinitionTable() const -+const LEReferenceTo<GlyphClassDefinitionTable> -+GlyphDefinitionTableHeader::getGlyphClassDefinitionTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base, -+ LEErrorCode &success) const - { -- return (const GlyphClassDefinitionTable *) ((char *) this + SWAPW(glyphClassDefOffset)); -+ if(LE_FAILURE(success)) return LEReferenceTo<GlyphClassDefinitionTable>(); -+ return LEReferenceTo<GlyphClassDefinitionTable>(base, success, SWAPW(glyphClassDefOffset)); - } - --const AttachmentListTable *GlyphDefinitionTableHeader::getAttachmentListTable() const -+const LEReferenceTo<AttachmentListTable> -+GlyphDefinitionTableHeader::getAttachmentListTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base, -+ LEErrorCode &success) const - { -- return (const AttachmentListTable *) ((char *) this + SWAPW(attachListOffset)); -+ if(LE_FAILURE(success)) return LEReferenceTo<AttachmentListTable>(); -+ return LEReferenceTo<AttachmentListTable>(base, success, SWAPW(attachListOffset)); - } - --const LigatureCaretListTable *GlyphDefinitionTableHeader::getLigatureCaretListTable() const -+const LEReferenceTo<LigatureCaretListTable> -+GlyphDefinitionTableHeader::getLigatureCaretListTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base, -+ LEErrorCode &success) const - { -- return (const LigatureCaretListTable *) ((char *) this + SWAPW(ligCaretListOffset)); -+ if(LE_FAILURE(success)) return LEReferenceTo<LigatureCaretListTable>(); -+ return LEReferenceTo<LigatureCaretListTable>(base, success, SWAPW(ligCaretListOffset)); - } - --const MarkAttachClassDefinitionTable *GlyphDefinitionTableHeader::getMarkAttachClassDefinitionTable() const -+const LEReferenceTo<MarkAttachClassDefinitionTable> -+GlyphDefinitionTableHeader::getMarkAttachClassDefinitionTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base, -+ LEErrorCode &success) const - { -- return (const MarkAttachClassDefinitionTable *) ((char *) this + SWAPW(MarkAttachClassDefOffset)); -+ if(LE_FAILURE(success)) return LEReferenceTo<MarkAttachClassDefinitionTable>(); -+ return LEReferenceTo<MarkAttachClassDefinitionTable>(base, success, SWAPW(MarkAttachClassDefOffset)); - } - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/GlyphDefinitionTables.h b/src/share/native/sun/font/layout/GlyphDefinitionTables.h ---- jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.h -+++ jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.h -@@ -60,12 +60,14 @@ - le_uint16 glyphCount; - Offset attachPointTableOffsetArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(AttachmentListTable, attachPointTableOffsetArray) - - struct AttachPointTable - { - le_uint16 pointCount; - le_uint16 pointIndexArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(AttachPointTable, pointIndexArray) - - struct LigatureCaretListTable - { -@@ -73,12 +75,14 @@ - le_uint16 ligGlyphCount; - Offset ligGlyphTableOffsetArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(LigatureCaretListTable, ligGlyphTableOffsetArray) - - struct LigatureGlyphTable - { - le_uint16 caretCount; - Offset caretValueTableOffsetArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(LigatureGlyphTable, caretValueTableOffsetArray) - - struct CaretValueTable - { -@@ -111,10 +115,18 @@ - Offset ligCaretListOffset; - Offset MarkAttachClassDefOffset; - -- const GlyphClassDefinitionTable *getGlyphClassDefinitionTable() const; -- const AttachmentListTable *getAttachmentListTable()const ; -- const LigatureCaretListTable *getLigatureCaretListTable() const; -- const MarkAttachClassDefinitionTable *getMarkAttachClassDefinitionTable() const; -+ const LEReferenceTo<GlyphClassDefinitionTable> -+ getGlyphClassDefinitionTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base, -+ LEErrorCode &success) const; -+ const LEReferenceTo<AttachmentListTable> -+ getAttachmentListTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base, -+ LEErrorCode &success)const ; -+ const LEReferenceTo<LigatureCaretListTable> -+ getLigatureCaretListTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base, -+ LEErrorCode &success) const; -+ const LEReferenceTo<MarkAttachClassDefinitionTable> -+ getMarkAttachClassDefinitionTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base, -+ LEErrorCode &success) const; - }; - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/GlyphIterator.cpp b/src/share/native/sun/font/layout/GlyphIterator.cpp ---- jdk/src/share/native/sun/font/layout/GlyphIterator.cpp -+++ jdk/src/share/native/sun/font/layout/GlyphIterator.cpp -@@ -41,18 +41,21 @@ - U_NAMESPACE_BEGIN - - GlyphIterator::GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags, -- FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader) -+ FeatureMask theFeatureMask, const LEReferenceTo<GlyphDefinitionTableHeader> &theGlyphDefinitionTableHeader) - : direction(1), position(-1), nextLimit(-1), prevLimit(-1), - glyphStorage(theGlyphStorage), glyphPositionAdjustments(theGlyphPositionAdjustments), - srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask), glyphGroup(0), -- glyphClassDefinitionTable(NULL), markAttachClassDefinitionTable(NULL) -+ glyphClassDefinitionTable(), markAttachClassDefinitionTable() - - { -+ LEErrorCode success = LE_NO_ERROR; // TODO - le_int32 glyphCount = glyphStorage.getGlyphCount(); - -- if (theGlyphDefinitionTableHeader != NULL) { -- glyphClassDefinitionTable = theGlyphDefinitionTableHeader->getGlyphClassDefinitionTable(); -- markAttachClassDefinitionTable = theGlyphDefinitionTableHeader->getMarkAttachClassDefinitionTable(); -+ if (theGlyphDefinitionTableHeader.isValid()) { -+ glyphClassDefinitionTable = theGlyphDefinitionTableHeader -+ -> getGlyphClassDefinitionTable(theGlyphDefinitionTableHeader, success); -+ markAttachClassDefinitionTable = theGlyphDefinitionTableHeader -+ ->getMarkAttachClassDefinitionTable(theGlyphDefinitionTableHeader, success); - } - - nextLimit = glyphCount; -@@ -380,6 +383,7 @@ - - le_bool GlyphIterator::filterGlyph(le_uint32 index) const - { -+ LEErrorCode success = LE_NO_ERROR; - LEGlyphID glyphID = glyphStorage[index]; - le_int32 glyphClass = gcdNoGlyphClass; - -@@ -387,8 +391,8 @@ - return TRUE; - } - -- if (glyphClassDefinitionTable != NULL) { -- glyphClass = glyphClassDefinitionTable->getGlyphClass(glyphID); -+ if (glyphClassDefinitionTable.isValid()) { -+ glyphClass = glyphClassDefinitionTable->getGlyphClass(glyphClassDefinitionTable, glyphID, success); - } - - switch (glyphClass) -@@ -410,8 +414,9 @@ - - le_uint16 markAttachType = (lookupFlags & lfMarkAttachTypeMask) >> lfMarkAttachTypeShift; - -- if ((markAttachType != 0) && (markAttachClassDefinitionTable != NULL)) { -- return markAttachClassDefinitionTable->getGlyphClass(glyphID) != markAttachType; -+ if ((markAttachType != 0) && (markAttachClassDefinitionTable.isValid())) { -+ return markAttachClassDefinitionTable -+ -> getGlyphClass(markAttachClassDefinitionTable, glyphID, success) != markAttachType; - } - - return FALSE; -@@ -461,6 +466,7 @@ - while (newPosition != nextLimit && delta > 0) { - do { - newPosition += direction; -+ //fprintf(stderr,"%s:%d:%s: newPosition = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, newPosition, delta); - } while (newPosition != nextLimit && filterGlyph(newPosition)); - - delta -= 1; -@@ -468,6 +474,7 @@ - - position = newPosition; - -+ //fprintf(stderr,"%s:%d:%s: exit position = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, position, delta); - return position != nextLimit; - } - -@@ -483,6 +490,7 @@ - while (newPosition != prevLimit && delta > 0) { - do { - newPosition -= direction; -+ //fprintf(stderr,"%s:%d:%s: newPosition = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, newPosition, delta); - } while (newPosition != prevLimit && filterGlyph(newPosition)); - - delta -= 1; -@@ -490,6 +498,7 @@ - - position = newPosition; - -+ //fprintf(stderr,"%s:%d:%s: exit position = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, position, delta); - return position != prevLimit; - } - -diff --git a/src/share/native/sun/font/layout/GlyphIterator.h b/src/share/native/sun/font/layout/GlyphIterator.h ---- jdk/src/share/native/sun/font/layout/GlyphIterator.h -+++ jdk/src/share/native/sun/font/layout/GlyphIterator.h -@@ -49,7 +49,7 @@ - class GlyphIterator : public UMemory { - public: - GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags, -- FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader); -+ FeatureMask theFeatureMask, const LEReferenceTo<GlyphDefinitionTableHeader> &theGlyphDefinitionTableHeader); - - GlyphIterator(GlyphIterator &that); - -@@ -117,8 +117,8 @@ - FeatureMask featureMask; - le_int32 glyphGroup; - -- const GlyphClassDefinitionTable *glyphClassDefinitionTable; -- const MarkAttachClassDefinitionTable *markAttachClassDefinitionTable; -+ LEReferenceTo<GlyphClassDefinitionTable> glyphClassDefinitionTable; -+ LEReferenceTo<MarkAttachClassDefinitionTable> markAttachClassDefinitionTable; - - GlyphIterator &operator=(const GlyphIterator &other); // forbid copying of this class - }; -diff --git a/src/share/native/sun/font/layout/GlyphLookupTables.cpp b/src/share/native/sun/font/layout/GlyphLookupTables.cpp ---- jdk/src/share/native/sun/font/layout/GlyphLookupTables.cpp -+++ jdk/src/share/native/sun/font/layout/GlyphLookupTables.cpp -@@ -37,21 +37,22 @@ - - U_NAMESPACE_BEGIN - --le_bool GlyphLookupTableHeader::coversScript(LETag scriptTag) const -+le_bool GlyphLookupTableHeader::coversScript(const LETableReference &base, LETag scriptTag, LEErrorCode &success) const - { -- const ScriptListTable *scriptListTable = (const ScriptListTable *) ((char *)this + SWAPW(scriptListOffset)); -+ LEReferenceTo<ScriptListTable> scriptListTable(base, success, SWAPW(scriptListOffset)); - -- return scriptListOffset != 0 && scriptListTable->findScript(scriptTag) != NULL; -+ return (scriptListOffset != 0) && scriptListTable->findScript(scriptListTable, scriptTag, success) .isValid(); - } - --le_bool GlyphLookupTableHeader::coversScriptAndLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch) const -+le_bool GlyphLookupTableHeader::coversScriptAndLanguage(const LETableReference &base, LETag scriptTag, LETag languageTag, LEErrorCode &success, le_bool exactMatch) const - { -- const ScriptListTable *scriptListTable = (const ScriptListTable *) ((char *)this + SWAPW(scriptListOffset)); -- const LangSysTable *langSysTable = scriptListTable->findLanguage(scriptTag, languageTag, exactMatch); -+ LEReferenceTo<ScriptListTable> scriptListTable(base, success, SWAPW(scriptListOffset)); -+ LEReferenceTo<LangSysTable> langSysTable = scriptListTable->findLanguage(scriptListTable, -+ scriptTag, languageTag, success, exactMatch); - - // FIXME: could check featureListOffset, lookupListOffset, and lookup count... - // Note: don't have to SWAPW langSysTable->featureCount to check for non-zero. -- return langSysTable != NULL && langSysTable->featureCount != 0; -+ return LE_SUCCESS(success)&&langSysTable.isValid() && langSysTable->featureCount != 0; - } - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/GlyphLookupTables.h b/src/share/native/sun/font/layout/GlyphLookupTables.h ---- jdk/src/share/native/sun/font/layout/GlyphLookupTables.h -+++ jdk/src/share/native/sun/font/layout/GlyphLookupTables.h -@@ -49,8 +49,8 @@ - Offset featureListOffset; - Offset lookupListOffset; - -- le_bool coversScript(LETag scriptTag) const; -- le_bool coversScriptAndLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch = FALSE) const; -+ le_bool coversScript(const LETableReference &base, LETag scriptTag, LEErrorCode &success) const; -+ le_bool coversScriptAndLanguage(const LETableReference &base, LETag scriptTag, LETag languageTag, LEErrorCode &success, le_bool exactMatch = FALSE) const; - }; - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/GlyphPositioningTables.cpp b/src/share/native/sun/font/layout/GlyphPositioningTables.cpp ---- jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp -+++ jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp -@@ -41,16 +41,16 @@ - - U_NAMESPACE_BEGIN - --void GlyphPositioningTableHeader::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft, -+void GlyphPositioningTableHeader::process(const LEReferenceTo<GlyphPositioningTableHeader> &base, LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft, - LETag scriptTag, LETag languageTag, -- const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, LEErrorCode &success, -+ const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader, LEErrorCode &success, - const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const - { - if (LE_FAILURE(success)) { - return; - } - -- GlyphPositioningLookupProcessor processor(this, scriptTag, languageTag, featureMap, featureMapCount, featureOrder, success); -+ GlyphPositioningLookupProcessor processor(base, scriptTag, languageTag, featureMap, featureMapCount, featureOrder, success); - if (LE_FAILURE(success)) { - return; - } -diff --git a/src/share/native/sun/font/layout/GlyphPositioningTables.h b/src/share/native/sun/font/layout/GlyphPositioningTables.h ---- jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h -+++ jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h -@@ -40,6 +40,7 @@ - #include "OpenTypeTables.h" - #include "Lookups.h" - #include "GlyphLookupTables.h" -+#include "LETableReference.h" - - U_NAMESPACE_BEGIN - -@@ -51,9 +52,9 @@ - - struct GlyphPositioningTableHeader : public GlyphLookupTableHeader - { -- void process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, -+ void process(const LEReferenceTo<GlyphPositioningTableHeader> &base, LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, - le_bool rightToLeft, LETag scriptTag, LETag languageTag, -- const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, LEErrorCode &success, -+ const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader, LEErrorCode &success, - const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const; - }; - -diff --git a/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp b/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp ---- jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp -+++ jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp -@@ -57,7 +57,7 @@ - typedef ChainingContextualSubstitutionSubtable ChainingContextualPositioningSubtable; - - GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor( -- const GlyphPositioningTableHeader *glyphPositioningTableHeader, -+ const LEReferenceTo<GlyphPositioningTableHeader> &glyphPositioningTableHeader, - LETag scriptTag, - LETag languageTag, - const FeatureMap *featureMap, -@@ -65,7 +65,7 @@ - le_bool featureOrder, - LEErrorCode& success) - : LookupProcessor( -- (char *) glyphPositioningTableHeader, -+ glyphPositioningTableHeader, - SWAPW(glyphPositioningTableHeader->scriptListOffset), - SWAPW(glyphPositioningTableHeader->featureListOffset), - SWAPW(glyphPositioningTableHeader->lookupListOffset), -@@ -84,7 +84,7 @@ - { - } - --le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType, -+le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType, - GlyphIterator *glyphIterator, - const LEFontInstance *fontInstance, - LEErrorCode& success) const -@@ -102,55 +102,55 @@ - - case gpstSingle: - { -- const SinglePositioningSubtable *subtable = (const SinglePositioningSubtable *) lookupSubtable; -+ LEReferenceTo<SinglePositioningSubtable> subtable(lookupSubtable, success); - -- delta = subtable->process(glyphIterator, fontInstance); -+ delta = subtable->process(subtable, glyphIterator, fontInstance, success); - break; - } - - case gpstPair: - { -- const PairPositioningSubtable *subtable = (const PairPositioningSubtable *) lookupSubtable; -+ LEReferenceTo<PairPositioningSubtable> subtable(lookupSubtable, success); - -- delta = subtable->process(glyphIterator, fontInstance); -+ delta = subtable->process(subtable, glyphIterator, fontInstance, success); - break; - } - - case gpstCursive: - { -- const CursiveAttachmentSubtable *subtable = (const CursiveAttachmentSubtable *) lookupSubtable; -+ LEReferenceTo<CursiveAttachmentSubtable> subtable(lookupSubtable, success); - -- delta = subtable->process(glyphIterator, fontInstance); -+ delta = subtable->process(subtable, glyphIterator, fontInstance, success); - break; - } - - case gpstMarkToBase: - { -- const MarkToBasePositioningSubtable *subtable = (const MarkToBasePositioningSubtable *) lookupSubtable; -+ LEReferenceTo<MarkToBasePositioningSubtable> subtable(lookupSubtable, success); - -- delta = subtable->process(glyphIterator, fontInstance); -+ delta = subtable->process(subtable, glyphIterator, fontInstance, success); - break; - } - - case gpstMarkToLigature: - { -- const MarkToLigaturePositioningSubtable *subtable = (const MarkToLigaturePositioningSubtable *) lookupSubtable; -+ LEReferenceTo<MarkToLigaturePositioningSubtable> subtable(lookupSubtable, success); - -- delta = subtable->process(glyphIterator, fontInstance); -+ delta = subtable->process(subtable, glyphIterator, fontInstance, success); - break; - } - - case gpstMarkToMark: - { -- const MarkToMarkPositioningSubtable *subtable = (const MarkToMarkPositioningSubtable *) lookupSubtable; -+ LEReferenceTo<MarkToMarkPositioningSubtable> subtable(lookupSubtable, success); - -- delta = subtable->process(glyphIterator, fontInstance); -+ delta = subtable->process(subtable, glyphIterator, fontInstance, success); - break; - } - - case gpstContext: - { -- const ContextualPositioningSubtable *subtable = (const ContextualPositioningSubtable *) lookupSubtable; -+ LEReferenceTo<ContextualPositioningSubtable> subtable(lookupSubtable, success); - - delta = subtable->process(this, glyphIterator, fontInstance, success); - break; -@@ -158,7 +158,7 @@ - - case gpstChainedContext: - { -- const ChainingContextualPositioningSubtable *subtable = (const ChainingContextualPositioningSubtable *) lookupSubtable; -+ LEReferenceTo<ChainingContextualPositioningSubtable> subtable(lookupSubtable, success); - - delta = subtable->process(this, glyphIterator, fontInstance, success); - break; -@@ -166,7 +166,7 @@ - - case gpstExtension: - { -- const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable; -+ LEReferenceTo<ExtensionSubtable> subtable(lookupSubtable, success); - - delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success); - break; -diff --git a/src/share/native/sun/font/layout/GlyphPosnLookupProc.h b/src/share/native/sun/font/layout/GlyphPosnLookupProc.h ---- jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h -+++ jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h -@@ -51,7 +51,7 @@ - class GlyphPositioningLookupProcessor : public LookupProcessor - { - public: -- GlyphPositioningLookupProcessor(const GlyphPositioningTableHeader *glyphPositioningTableHeader, -+ GlyphPositioningLookupProcessor(const LEReferenceTo<GlyphPositioningTableHeader> &glyphPositioningTableHeader, - LETag scriptTag, - LETag languageTag, - const FeatureMap *featureMap, -@@ -61,7 +61,7 @@ - - virtual ~GlyphPositioningLookupProcessor(); - -- virtual le_uint32 applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType, GlyphIterator *glyphIterator, -+ virtual le_uint32 applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType, GlyphIterator *glyphIterator, - const LEFontInstance *fontInstance, LEErrorCode& success) const; - - protected: -diff --git a/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp b/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp ---- jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp -+++ jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp -@@ -51,7 +51,7 @@ - U_NAMESPACE_BEGIN - - GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor( -- const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader, -+ const LEReferenceTo<GlyphSubstitutionTableHeader> &glyphSubstitutionTableHeader, - LETag scriptTag, - LETag languageTag, - const LEGlyphFilter *filter, -@@ -60,7 +60,7 @@ - le_bool featureOrder, - LEErrorCode& success) - : LookupProcessor( -- (char *) glyphSubstitutionTableHeader, -+ glyphSubstitutionTableHeader, - SWAPW(glyphSubstitutionTableHeader->scriptListOffset), - SWAPW(glyphSubstitutionTableHeader->featureListOffset), - SWAPW(glyphSubstitutionTableHeader->lookupListOffset), -@@ -73,7 +73,7 @@ - { - } - --le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType, -+le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType, - GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const - { - if (LE_FAILURE(success)) { -@@ -89,39 +89,39 @@ - - case gsstSingle: - { -- const SingleSubstitutionSubtable *subtable = (const SingleSubstitutionSubtable *) lookupSubtable; -+ const LEReferenceTo<SingleSubstitutionSubtable> subtable(lookupSubtable, success); - -- delta = subtable->process(glyphIterator, fFilter); -+ delta = subtable->process(subtable, glyphIterator, success, fFilter); - break; - } - - case gsstMultiple: - { -- const MultipleSubstitutionSubtable *subtable = (const MultipleSubstitutionSubtable *) lookupSubtable; -+ const LEReferenceTo<MultipleSubstitutionSubtable> subtable(lookupSubtable, success); - -- delta = subtable->process(glyphIterator, success, fFilter); -+ delta = subtable->process(subtable, glyphIterator, success, fFilter); - break; - } - - case gsstAlternate: - { -- const AlternateSubstitutionSubtable *subtable = (const AlternateSubstitutionSubtable *) lookupSubtable; -+ const LEReferenceTo<AlternateSubstitutionSubtable> subtable(lookupSubtable, success); - -- delta = subtable->process(glyphIterator, fFilter); -+ delta = subtable->process(subtable, glyphIterator, success, fFilter); - break; - } - - case gsstLigature: - { -- const LigatureSubstitutionSubtable *subtable = (const LigatureSubstitutionSubtable *) lookupSubtable; -+ const LEReferenceTo<LigatureSubstitutionSubtable> subtable(lookupSubtable, success); - -- delta = subtable->process(glyphIterator, fFilter); -+ delta = subtable->process(subtable, glyphIterator, success, fFilter); - break; - } - - case gsstContext: - { -- const ContextualSubstitutionSubtable *subtable = (const ContextualSubstitutionSubtable *) lookupSubtable; -+ const LEReferenceTo<ContextualSubstitutionSubtable> subtable(lookupSubtable, success); - - delta = subtable->process(this, glyphIterator, fontInstance, success); - break; -@@ -129,7 +129,7 @@ - - case gsstChainingContext: - { -- const ChainingContextualSubstitutionSubtable *subtable = (const ChainingContextualSubstitutionSubtable *) lookupSubtable; -+ const LEReferenceTo<ChainingContextualSubstitutionSubtable> subtable(lookupSubtable, success); - - delta = subtable->process(this, glyphIterator, fontInstance, success); - break; -@@ -137,7 +137,7 @@ - - case gsstExtension: - { -- const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable; -+ const LEReferenceTo<ExtensionSubtable> subtable(lookupSubtable, success); - - delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success); - break; -diff --git a/src/share/native/sun/font/layout/GlyphSubstLookupProc.h b/src/share/native/sun/font/layout/GlyphSubstLookupProc.h ---- jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h -+++ jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h -@@ -52,7 +52,7 @@ - class GlyphSubstitutionLookupProcessor : public LookupProcessor - { - public: -- GlyphSubstitutionLookupProcessor(const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader, -+ GlyphSubstitutionLookupProcessor(const LEReferenceTo<GlyphSubstitutionTableHeader> &glyphSubstitutionTableHeader, - LETag scriptTag, - LETag languageTag, - const LEGlyphFilter *filter, -@@ -63,7 +63,7 @@ - - virtual ~GlyphSubstitutionLookupProcessor(); - -- virtual le_uint32 applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType, GlyphIterator *glyphIterator, -+ virtual le_uint32 applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType, GlyphIterator *glyphIterator, - const LEFontInstance *fontInstance, LEErrorCode& success) const; - - protected: -diff --git a/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp b/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp ---- jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp -+++ jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp -@@ -42,11 +42,12 @@ - - U_NAMESPACE_BEGIN - --le_int32 GlyphSubstitutionTableHeader::process(LEGlyphStorage &glyphStorage, -+le_int32 GlyphSubstitutionTableHeader::process(const LEReferenceTo<GlyphSubstitutionTableHeader> &base, -+ LEGlyphStorage &glyphStorage, - le_bool rightToLeft, - LETag scriptTag, - LETag languageTag, -- const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, -+ const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader, - const LEGlyphFilter *filter, - const FeatureMap *featureMap, - le_int32 featureMapCount, -@@ -57,7 +58,7 @@ - return 0; - } - -- GlyphSubstitutionLookupProcessor processor(this, scriptTag, languageTag, filter, featureMap, featureMapCount, featureOrder, success); -+ GlyphSubstitutionLookupProcessor processor(base, scriptTag, languageTag, filter, featureMap, featureMapCount, featureOrder, success); - return processor.process(glyphStorage, NULL, rightToLeft, glyphDefinitionTableHeader, NULL, success); - } - -diff --git a/src/share/native/sun/font/layout/GlyphSubstitutionTables.h b/src/share/native/sun/font/layout/GlyphSubstitutionTables.h ---- jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h -+++ jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h -@@ -50,11 +50,12 @@ - - struct GlyphSubstitutionTableHeader : public GlyphLookupTableHeader - { -- le_int32 process(LEGlyphStorage &glyphStorage, -+ le_int32 process(const LEReferenceTo<GlyphSubstitutionTableHeader> &base, -+ LEGlyphStorage &glyphStorage, - le_bool rightToLeft, - LETag scriptTag, - LETag languageTag, -- const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, -+ const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader, - const LEGlyphFilter *filter, - const FeatureMap *featureMap, - le_int32 featureMapCount, -diff --git a/src/share/native/sun/font/layout/HanLayoutEngine.cpp b/src/share/native/sun/font/layout/HanLayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp -@@ -64,7 +64,7 @@ - #define features (loclFeatureMask) - - HanOpenTypeLayoutEngine::HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success) -+ le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success) - : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success) - { - fFeatureMap = featureMap; -diff --git a/src/share/native/sun/font/layout/HanLayoutEngine.h b/src/share/native/sun/font/layout/HanLayoutEngine.h ---- jdk/src/share/native/sun/font/layout/HanLayoutEngine.h -+++ jdk/src/share/native/sun/font/layout/HanLayoutEngine.h -@@ -73,7 +73,7 @@ - * @internal - */ - HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTablem, LEErrorCode &success); -+ le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTablem, LEErrorCode &success); - - - /** -diff --git a/src/share/native/sun/font/layout/HangulLayoutEngine.cpp b/src/share/native/sun/font/layout/HangulLayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp -@@ -209,7 +209,7 @@ - } - - HangulOpenTypeLayoutEngine::HangulOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 /*languageCode*/, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success) -+ le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success) - : OpenTypeLayoutEngine(fontInstance, scriptCode, korLanguageCode, typoFlags, gsubTable, success) - { - fFeatureMap = featureMap; -diff --git a/src/share/native/sun/font/layout/HangulLayoutEngine.h b/src/share/native/sun/font/layout/HangulLayoutEngine.h ---- jdk/src/share/native/sun/font/layout/HangulLayoutEngine.h -+++ jdk/src/share/native/sun/font/layout/HangulLayoutEngine.h -@@ -79,7 +79,7 @@ - * @internal - */ - HangulOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success); -+ le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success); - - /** - * This constructor is used when the font requires a "canned" GSUB table which can't be known -diff --git a/src/share/native/sun/font/layout/ICUFeatures.h b/src/share/native/sun/font/layout/ICUFeatures.h ---- jdk/src/share/native/sun/font/layout/ICUFeatures.h -+++ jdk/src/share/native/sun/font/layout/ICUFeatures.h -@@ -54,16 +54,21 @@ - le_uint16 lookupCount; - le_uint16 lookupListIndexArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(FeatureTable, lookupListIndexArray) - - struct FeatureListTable - { - le_uint16 featureCount; - FeatureRecord featureRecordArray[ANY_NUMBER]; - -- const FeatureTable *getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const; -+ LEReferenceTo<FeatureTable> getFeatureTable(const LETableReference &base, le_uint16 featureIndex, LETag *featureTag, LEErrorCode &success) const; - -- const FeatureTable *getFeatureTable(LETag featureTag) const; -+#if 0 -+ const LEReferenceTo<FeatureTable> getFeatureTable(const LETableReference &base, LETag featureTag, LEErrorCode &success) const; -+#endif - }; - -+LE_VAR_ARRAY(FeatureListTable, featureRecordArray) -+ - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/IndicLayoutEngine.cpp b/src/share/native/sun/font/layout/IndicLayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp -@@ -50,7 +50,7 @@ - UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicOpenTypeLayoutEngine) - - IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, le_bool version2, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success) -+ le_int32 typoFlags, le_bool version2, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success) - : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success), fMPreFixups(NULL) - { - if ( version2 ) { -diff --git a/src/share/native/sun/font/layout/IndicLayoutEngine.h b/src/share/native/sun/font/layout/IndicLayoutEngine.h ---- jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h -+++ jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h -@@ -81,7 +81,7 @@ - * @internal - */ - IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, le_bool version2, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success); -+ le_int32 typoFlags, le_bool version2, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success); - - /** - * This constructor is used when the font requires a "canned" GSUB table which can't be known -diff --git a/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp b/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp ---- jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp -+++ jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp -@@ -43,11 +43,14 @@ - - UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicRearrangementProcessor) - --IndicRearrangementProcessor::IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader) -- : StateTableProcessor(morphSubtableHeader) -+ IndicRearrangementProcessor::IndicRearrangementProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) -+ : StateTableProcessor(morphSubtableHeader, success), -+ indicRearrangementSubtableHeader(morphSubtableHeader, success), -+ entryTable(stateTableHeader, success, (const IndicRearrangementStateEntry*)(&stateTableHeader->stHeader), -+ entryTableOffset, LE_UNBOUNDED_ARRAY), -+ int16Table(stateTableHeader, success, (const le_int16*)entryTable.getAlias(), 0, LE_UNBOUNDED_ARRAY) -+ - { -- indicRearrangementSubtableHeader = (const IndicRearrangementSubtableHeader *) morphSubtableHeader; -- entryTable = (const IndicRearrangementStateEntry *) ((char *) &stateTableHeader->stHeader + entryTableOffset); - } - - IndicRearrangementProcessor::~IndicRearrangementProcessor() -@@ -62,7 +65,8 @@ - - ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index) - { -- const IndicRearrangementStateEntry *entry = &entryTable[index]; -+ LEErrorCode success = LE_NO_ERROR; // todo- make a param? -+ const IndicRearrangementStateEntry *entry = entryTable.getAlias(index,success); - ByteOffset newState = SWAPW(entry->newStateOffset); - IndicRearrangementFlags flags = (IndicRearrangementFlags) SWAPW(entry->flags); - -diff --git a/src/share/native/sun/font/layout/IndicRearrangementProcessor.h b/src/share/native/sun/font/layout/IndicRearrangementProcessor.h ---- jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.h -+++ jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.h -@@ -58,7 +58,7 @@ - - void doRearrangementAction(LEGlyphStorage &glyphStorage, IndicRearrangementVerb verb) const; - -- IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader); -+ IndicRearrangementProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success); - virtual ~IndicRearrangementProcessor(); - - /** -@@ -79,8 +79,9 @@ - le_int32 firstGlyph; - le_int32 lastGlyph; - -- const IndicRearrangementStateEntry *entryTable; -- const IndicRearrangementSubtableHeader *indicRearrangementSubtableHeader; -+ LEReferenceTo<IndicRearrangementSubtableHeader> indicRearrangementSubtableHeader; -+ LEReferenceToArrayOf<IndicRearrangementStateEntry> entryTable; -+ LEReferenceToArrayOf<le_int16> int16Table; - - }; - -diff --git a/src/share/native/sun/font/layout/IndicReordering.cpp b/src/share/native/sun/font/layout/IndicReordering.cpp ---- jdk/src/share/native/sun/font/layout/IndicReordering.cpp -+++ jdk/src/share/native/sun/font/layout/IndicReordering.cpp -@@ -658,6 +658,11 @@ - MPreFixups *mpreFixups = NULL; - const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode); - -+ if(classTable==NULL) { -+ success = LE_MEMORY_ALLOCATION_ERROR; -+ return 0; -+ } -+ - if (classTable->scriptFlags & SF_MPRE_FIXUP) { - mpreFixups = new MPreFixups(charCount); - if (mpreFixups == NULL) { -diff --git a/src/share/native/sun/font/layout/KernTable.cpp b/src/share/native/sun/font/layout/KernTable.cpp ---- jdk/src/share/native/sun/font/layout/KernTable.cpp -+++ jdk/src/share/native/sun/font/layout/KernTable.cpp -@@ -92,16 +92,16 @@ - * TODO: support multiple subtables - * TODO: respect header flags - */ --KernTable::KernTable(const LEFontInstance* font_, const void* tableData) -- : pairs(0), font(font_) -+KernTable::KernTable(const LETableReference &table, LEErrorCode &success) -+ : pairs(table, success), pairsSwapped(NULL), fTable(table) - { -- const KernTableHeader* header = (const KernTableHeader*)tableData; -- if (header == 0) { -+ if(LE_FAILURE(success) || (fTable.isEmpty())) { - #if DEBUG - fprintf(stderr, "no kern data\n"); - #endif - return; - } -+ LEReferenceTo<KernTableHeader> header(fTable, success); - - #if DEBUG - // dump first 32 bytes of header -@@ -115,12 +115,17 @@ - } - #endif - -- if (header->version == 0 && SWAPW(header->nTables) > 0) { -- const SubtableHeader* subhead = (const SubtableHeader*)((char*)tableData + KERN_TABLE_HEADER_SIZE); -- if (subhead->version == 0) { -+ if(LE_FAILURE(success)) return; -+ -+ if (!header.isEmpty() && header->version == 0 && SWAPW(header->nTables) > 0) { -+ LEReferenceTo<SubtableHeader> subhead(header, success, KERN_TABLE_HEADER_SIZE); -+ -+ if (LE_SUCCESS(success) && !subhead.isEmpty() && subhead->version == 0) { - coverage = SWAPW(subhead->coverage); - if (coverage & COVERAGE_HORIZONTAL) { // only handle horizontal kerning -- const Subtable_0* table = (const Subtable_0*)((char*)subhead + KERN_SUBTABLE_HEADER_SIZE); -+ LEReferenceTo<Subtable_0> table(subhead, success, KERN_SUBTABLE_HEADER_SIZE); -+ -+ if(table.isEmpty() || LE_FAILURE(success)) return; - - nPairs = SWAPW(table->nPairs); - -@@ -134,17 +139,17 @@ - rangeShift = (nPairs * KERN_PAIRINFO_SIZE) - searchRange; - #endif - -- pairs = (PairInfo*)font->getKernPairs(); -- if (pairs == NULL) { -- char *pairData = (char*)table + KERN_SUBTABLE_0_HEADER_SIZE; -- char *pptr = pairData; -- pairs = (PairInfo*)(malloc(nPairs*sizeof(PairInfo))); -- PairInfo *p = (PairInfo*)pairs; -- for (int i = 0; i < nPairs; i++, pptr += KERN_PAIRINFO_SIZE, p++) { -- memcpy(p, pptr, KERN_PAIRINFO_SIZE); -+ if(LE_SUCCESS(success) && nPairs>0) { -+ pairs.setToOffsetInParent(table, KERN_SUBTABLE_0_HEADER_SIZE, nPairs, success); -+ } -+ if (LE_SUCCESS(success) && pairs.isValid()) { -+ pairsSwapped = (PairInfo*)(malloc(nPairs*sizeof(PairInfo))); -+ PairInfo *p = (PairInfo*)pairsSwapped; -+ for (int i = 0; LE_SUCCESS(success) && i < nPairs; i++, p++) { -+ memcpy(p, pairs.getAlias(i,success), KERN_PAIRINFO_SIZE); - p->key = SWAPL(p->key); - } -- font->setKernPairs((void*)pairs); -+ fTable.getFont()->setKernPairs((void*)pairsSwapped); // store it - } - - #if DEBUG -@@ -162,7 +167,7 @@ - ids[id] = (char)i; - } - } -- PairInfo *p = pairs; -+ PairInfo* p = pairs; - for (int i = 0; i < nPairs; ++i, p++) { - le_uint32 k = p->key; - le_uint16 left = (k >> 16) & 0xffff; -@@ -194,10 +199,12 @@ - * Process the glyph positions. The positions array has two floats for each - * glyph, plus a trailing pair to mark the end of the last glyph. - */ --void KernTable::process(LEGlyphStorage& storage) -+void KernTable::process(LEGlyphStorage& storage, LEErrorCode &success) - { -- if (pairs) { -- LEErrorCode success = LE_NO_ERROR; -+ if(LE_FAILURE(success)) return; -+ -+ if (pairsSwapped) { -+ success = LE_NO_ERROR; - - le_uint32 key = storage[0]; // no need to mask off high bits - float adjust = 0; -@@ -209,7 +216,7 @@ - // so either I have to swap the element each time I examine it, or I have to swap - // all the elements ahead of time and store them in the font - -- const PairInfo* p = pairs; -+ const PairInfo* p = pairsSwapped; - const PairInfo* tp = (const PairInfo*)(p + rangeShift); - if (key > tp->key) { - p = tp; -@@ -225,7 +232,7 @@ - tp = (const PairInfo*)(p + probe); - le_uint32 tkey = tp->key; - #if DEBUG -- fprintf(stdout, " %.3d (%0.8x)\n", (tp - pairs), tkey); -+ fprintf(stdout, " %.3d (%0.8x)\n", (tp - pairsSwapped), tkey); - #endif - if (tkey <= key) { - if (tkey == key) { -@@ -240,10 +247,10 @@ - // device transform, or a faster way, such as moving the - // entire kern table up to Java. - LEPoint pt; -- pt.fX = font->xUnitsToPoints(value); -+ pt.fX = fTable.getFont()->xUnitsToPoints(value); - pt.fY = 0; - -- font->getKerningAdjustment(pt); -+ fTable.getFont()->getKerningAdjustment(pt); - adjust += pt.fX; - break; - } -diff --git a/src/share/native/sun/font/layout/KernTable.h b/src/share/native/sun/font/layout/KernTable.h ---- jdk/src/share/native/sun/font/layout/KernTable.h -+++ jdk/src/share/native/sun/font/layout/KernTable.h -@@ -26,7 +26,7 @@ - /* - * - * -- * (C) Copyright IBM Corp. 2004-2005 - All Rights Reserved -+ * (C) Copyright IBM Corp. 2004-2013 - All Rights Reserved - * - */ - -@@ -38,6 +38,7 @@ - #endif - - #include "LETypes.h" -+#include "LETableReference.h" - //#include "LEFontInstance.h" - //#include "LEGlyphStorage.h" - -@@ -56,19 +57,20 @@ - private: - le_uint16 coverage; - le_uint16 nPairs; -- const PairInfo* pairs; -- const LEFontInstance* font; -+ LEReferenceToArrayOf<PairInfo> pairs; -+ PairInfo *pairsSwapped; -+ const LETableReference &fTable; - le_uint16 searchRange; - le_uint16 entrySelector; - le_uint16 rangeShift; - - public: -- KernTable(const LEFontInstance* font, const void* tableData); -+ KernTable(const LETableReference &table, LEErrorCode &success); - - /* - * Process the glyph positions. - */ -- void process(LEGlyphStorage& storage); -+ void process(LEGlyphStorage& storage, LEErrorCode &success); - }; - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp b/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp -@@ -43,7 +43,7 @@ - UOBJECT_DEFINE_RTTI_IMPLEMENTATION(KhmerOpenTypeLayoutEngine) - - KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success) -+ le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success) - : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success) - { - fFeatureMap = KhmerReordering::getFeatureMap(fFeatureMapCount); -diff --git a/src/share/native/sun/font/layout/KhmerLayoutEngine.h b/src/share/native/sun/font/layout/KhmerLayoutEngine.h ---- jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h -+++ jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h -@@ -83,7 +83,7 @@ - * @internal - */ - KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success); -+ le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success); - - /** - * This constructor is used when the font requires a "canned" GSUB table which can't be known -diff --git a/src/share/native/sun/font/layout/LEFontInstance.h b/src/share/native/sun/font/layout/LEFontInstance.h ---- jdk/src/share/native/sun/font/layout/LEFontInstance.h -+++ jdk/src/share/native/sun/font/layout/LEFontInstance.h -@@ -194,6 +194,25 @@ - virtual void setKernPairs(void *pairs) const = 0; - - /** -+ * This method reads a table from the font. Note that in general, -+ * it only makes sense to call this method on an <code>LEFontInstance</code> -+ * which represents a physical font - i.e. one which has been returned by -+ * <code>getSubFont()</code>. This is because each subfont in a composite font -+ * will have different tables, and there's no way to know which subfont to access. -+ * -+ * Subclasses which represent composite fonts should always return <code>NULL</code>. -+ * -+ * This version sets a length, for range checking. -+ * -+ * @param tableTag - the four byte table tag. (e.g. 'cmap') -+ * @param length - ignored on entry, on exit will be the length of the table if known, or -1 if unknown. -+ * @return the address of the table in memory, or <code>NULL</code> -+ * if the table doesn't exist. -+ * @internal -+ */ -+ virtual const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); } /* -1 = unknown length */ -+ -+ /** - * This method is used to determine if the font can - * render the given character. This can usually be done - * by looking the character up in the font's character -diff --git a/src/share/native/sun/font/layout/LEScripts.h b/src/share/native/sun/font/layout/LEScripts.h ---- jdk/src/share/native/sun/font/layout/LEScripts.h -+++ jdk/src/share/native/sun/font/layout/LEScripts.h -@@ -241,8 +241,28 @@ - palmScriptCode = 144, - sindScriptCode = 145, - waraScriptCode = 146, -+/** -+ * @stable ICU 4.8 -+ */ - -- scriptCodeCount = 147 -+ afakScriptCode = 147, -+ jurcScriptCode = 148, -+ mrooScriptCode = 149, -+ nshuScriptCode = 150, -+ shrdScriptCode = 151, -+ soraScriptCode = 152, -+ takrScriptCode = 153, -+ tangScriptCode = 154, -+ woleScriptCode = 155, -+/** -+ * @stable ICU 49 -+ */ -+ -+ hluwScriptCode = 156, /* bump to match current ICU */ -+ khojScriptCode = 157, -+ tirhScriptCode = 158, -+ -+ scriptCodeCount = 159 - }; - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/LETableReference.h b/src/share/native/sun/font/layout/LETableReference.h -new file mode 100644 ---- /dev/null -+++ jdk/src/share/native/sun/font/layout/LETableReference.h -@@ -0,0 +1,497 @@ -+/* -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. Oracle designates this -+ * particular file as subject to the "Classpath" exception as provided -+ * by Oracle in the LICENSE file that accompanied this code. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+/* -+ * -*- c++ -*- -+ * -+ * (C) Copyright IBM Corp. and others 2013 - All Rights Reserved -+ * -+ * Range checking -+ * -+ */ -+ -+#ifndef __LETABLEREFERENCE_H -+#define __LETABLEREFERENCE_H -+ -+#include "LETypes.h" -+#include "LEFontInstance.h" -+ -+ -+#define kQuestionmarkTableTag 0x3F3F3F3FUL -+#define kTildeTableTag 0x7e7e7e7eUL -+#ifdef __cplusplus -+ -+// internal - interface for range checking -+U_NAMESPACE_BEGIN -+ -+#if LE_ASSERT_BAD_FONT -+class LETableReference; // fwd -+/** -+ * defined in OpenTypeUtilities.cpp -+ * @internal -+ */ -+U_INTERNAL void U_EXPORT2 _debug_LETableReference(const char *f, int l, const char *msg, const LETableReference *what, const void *ptr, size_t len); -+ -+#define LE_DEBUG_TR(x) _debug_LETableReference(__FILE__, __LINE__, x, this, NULL, 0); -+#define LE_DEBUG_TR3(x,y,z) _debug_LETableReference(__FILE__, __LINE__, x, this, (const void*)y, (size_t)z); -+#if 0 -+#define LE_TRACE_TR(x) _debug_LETableReference(__FILE__, __LINE__, x, this, NULL, 0); -+#else -+#define LE_TRACE_TR(x) -+#endif -+ -+#else -+#define LE_DEBUG_TR(x) -+#define LE_DEBUG_TR3(x,y,z) -+#define LE_TRACE_TR(x) -+#endif -+ -+/** -+ * @internal -+ */ -+class LETableReference { -+public: -+/** -+ * @internal -+ * Construct from a specific tag -+ */ -+ LETableReference(const LEFontInstance* font, LETag tableTag, LEErrorCode &success) : -+ fFont(font), fTag(tableTag), fParent(NULL), fStart(NULL),fLength(LE_UINTPTR_MAX) { -+ loadTable(success); -+ LE_TRACE_TR("INFO: new table load") -+ } -+ -+ LETableReference(const LETableReference &parent, LEErrorCode &success) : fFont(parent.fFont), fTag(parent.fTag), fParent(&parent), fStart(parent.fStart), fLength(parent.fLength) { -+ if(LE_FAILURE(success)) { -+ clear(); -+ } -+ LE_TRACE_TR("INFO: new clone") -+ } -+ -+ LETableReference(const le_uint8* data, size_t length = LE_UINTPTR_MAX) : -+ fFont(NULL), fTag(kQuestionmarkTableTag), fParent(NULL), fStart(data), fLength(length) { -+ LE_TRACE_TR("INFO: new raw") -+ } -+ LETableReference() : -+ fFont(NULL), fTag(kQuestionmarkTableTag), fParent(NULL), fStart(NULL), fLength(0) { -+ LE_TRACE_TR("INFO: new empty") -+ } -+ -+ ~LETableReference() { -+ fTag=kTildeTableTag; -+ LE_TRACE_TR("INFO: new dtor") -+ } -+ -+ /** -+ * @internal -+ * @param length if LE_UINTPTR_MAX means "whole table" -+ * subset -+ */ -+ LETableReference(const LETableReference &parent, size_t offset, size_t length, -+ LEErrorCode &err) : -+ fFont(parent.fFont), fTag(parent.fTag), fParent(&parent), -+ fStart((parent.fStart)+offset), fLength(length) { -+ if(LE_SUCCESS(err)) { -+ if(isEmpty()) { -+ //err = LE_MISSING_FONT_TABLE_ERROR; -+ clear(); // it's just empty. Not an error. -+ } else if(offset >= fParent->fLength) { -+ LE_DEBUG_TR3("offset out of range: (%p) +%d", NULL, offset); -+ err = LE_INDEX_OUT_OF_BOUNDS_ERROR; -+ clear(); -+ } else { -+ if(fLength == LE_UINTPTR_MAX && -+ fParent->fLength != LE_UINTPTR_MAX) { -+ fLength = (fParent->fLength) - offset; // decrement length as base address is incremented -+ } -+ if(fLength != LE_UINTPTR_MAX) { // if we have bounds: -+ if(offset+fLength > fParent->fLength) { -+ LE_DEBUG_TR3("offset+fLength out of range: (%p) +%d", NULL, offset+fLength); -+ err = LE_INDEX_OUT_OF_BOUNDS_ERROR; // exceeded -+ clear(); -+ } -+ } -+ } -+ } else { -+ clear(); -+ } -+ LE_TRACE_TR("INFO: new subset") -+ } -+ -+ const void* getAlias() const { return (const void*)fStart; } -+ const void* getAliasTODO() const { LE_DEBUG_TR("getAliasTODO()"); return (const void*)fStart; } -+ le_bool isEmpty() const { return fStart==NULL || fLength==0; } -+ le_bool isValid() const { return !isEmpty(); } -+ le_bool hasBounds() const { return fLength!=LE_UINTPTR_MAX; } -+ void clear() { fLength=0; fStart=NULL; } -+ size_t getLength() const { return fLength; } -+ const LEFontInstance* getFont() const { return fFont; } -+ LETag getTag() const { return fTag; } -+ const LETableReference* getParent() const { return fParent; } -+ -+ void addOffset(size_t offset, LEErrorCode &success) { -+ if(hasBounds()) { -+ if(offset > fLength) { -+ LE_DEBUG_TR("addOffset off end"); -+ success = LE_INDEX_OUT_OF_BOUNDS_ERROR; -+ return; -+ } else { -+ fLength -= offset; -+ } -+ } -+ fStart += offset; -+ } -+ -+ size_t ptrToOffset(const void *atPtr, LEErrorCode &success) const { -+ if(atPtr==NULL) return 0; -+ if(LE_FAILURE(success)) return LE_UINTPTR_MAX; -+ if((atPtr < fStart) || -+ (hasBounds() && (atPtr > fStart+fLength))) { -+ LE_DEBUG_TR3("ptrToOffset args out of range: %p", atPtr, 0); -+ success = LE_INDEX_OUT_OF_BOUNDS_ERROR; -+ return LE_UINTPTR_MAX; -+ } -+ return ((const le_uint8*)atPtr)-fStart; -+ } -+ -+ /** -+ * Clamp down the length, for range checking. -+ */ -+ size_t contractLength(size_t newLength) { -+ if(fLength!=LE_UINTPTR_MAX&&newLength>0&&newLength<=fLength) { -+ fLength = newLength; -+ } -+ return fLength; -+ } -+ -+ /** -+ * Throw an error if offset+length off end -+ */ -+public: -+ size_t verifyLength(size_t offset, size_t length, LEErrorCode &success) { -+ if(isValid()&& -+ LE_SUCCESS(success) && -+ fLength!=LE_UINTPTR_MAX && length!=LE_UINTPTR_MAX && offset!=LE_UINTPTR_MAX && -+ (offset+length)>fLength) { -+ LE_DEBUG_TR3("verifyLength failed (%p) %d",NULL, offset+length); -+ success = LE_INDEX_OUT_OF_BOUNDS_ERROR; -+#if LE_ASSERT_BAD_FONT -+ fprintf(stderr, "offset=%lu, len=%lu, would be at %p, (%lu) off end. End at %p\n", offset,length, fStart+offset+length, (offset+length-fLength), (offset+length-fLength)+fStart); -+#endif -+ } -+ return fLength; -+ } -+ -+ le_bool isSubsetOf(const LETableReference& base) const { -+ if(this == &base) return true; -+ if(fStart < base.fStart) return false; -+ if(base.hasBounds()) { -+ if(fStart >= base.fStart + base.fLength) return false; -+ if(hasBounds()) { -+ if(fStart + fLength > base.fStart + base.fLength) return false; -+ } -+ } -+ return true; -+ } -+ -+ /** -+ * Change parent link to another -+ */ -+ LETableReference &reparent(const LETableReference &base) { -+ fParent = &base; -+ return *this; -+ } -+ -+ /** -+ * remove parent link. Factory functions should do this. -+ */ -+ void orphan(void) { -+ fParent=NULL; -+ } -+ -+protected: -+ const LEFontInstance* fFont; -+ LETag fTag; -+ const LETableReference *fParent; -+ const le_uint8 *fStart; // keep as 8 bit internally, for pointer math -+ size_t fLength; -+ -+ void loadTable(LEErrorCode &success) { -+ if(LE_SUCCESS(success)) { -+ fStart = (const le_uint8*)(fFont->getFontTable(fTag, fLength)); // note - a null table is not an error. -+ } -+ } -+ -+ void setRaw(const void *data, size_t length = LE_UINTPTR_MAX) { -+ fFont = NULL; -+ fTag = kQuestionmarkTableTag; -+ fParent = NULL; -+ fStart = (const le_uint8*)data; -+ fLength = length; -+ } -+}; -+ -+ -+template<class T> -+class LETableVarSizer { -+ public: -+ inline static size_t getSize(); -+}; -+ -+// base definition- could override for adjustments -+template<class T> inline -+size_t LETableVarSizer<T>::getSize() { -+ return sizeof(T); -+} -+ -+/** -+ * \def LE_VAR_ARRAY -+ * @param x Type (T) -+ * @param y some member that is of length ANY_NUMBER -+ * Call this after defining a class, for example: -+ * LE_VAR_ARRAY(FeatureListTable,featureRecordArray) -+ * this is roughly equivalent to: -+ * template<> inline size_t LETableVarSizer<FeatureListTable>::getSize() { return sizeof(FeatureListTable) - (sizeof(le_uint16)*ANY_NUMBER); } -+ * it's a specialization that informs the LETableReference subclasses to NOT include the variable array in the size. -+ * dereferencing NULL is valid here because we never actually dereference it, just inside sizeof. -+ */ -+#define LE_VAR_ARRAY(x,y) template<> inline size_t LETableVarSizer<x>::getSize() { return sizeof(x) - (sizeof(((const x*)0)->y)); } -+ -+/** -+ * Open a new entry based on an existing table -+ */ -+ -+/** -+ * \def LE_UNBOUNDED_ARRAY -+ * define an array with no *known* bound. Will trim to available size. -+ * @internal -+ */ -+#define LE_UNBOUNDED_ARRAY LE_UINT32_MAX -+ -+template<class T> -+class LEReferenceToArrayOf : public LETableReference { -+public: -+ LEReferenceToArrayOf(const LETableReference &parent, LEErrorCode &success, size_t offset, le_uint32 count) -+ : LETableReference(parent, offset, LE_UINTPTR_MAX, success), fCount(count) { -+ LE_TRACE_TR("INFO: new RTAO by offset") -+ if(LE_SUCCESS(success)) { -+ if(count == LE_UNBOUNDED_ARRAY) { // not a known length -+ count = getLength()/LETableVarSizer<T>::getSize(); // fit to max size -+ } -+ LETableReference::verifyLength(0, LETableVarSizer<T>::getSize()*count, success); -+ } -+ if(LE_FAILURE(success)) { -+ fCount=0; -+ clear(); -+ } -+ } -+ -+ LEReferenceToArrayOf(const LETableReference &parent, LEErrorCode &success, const T* array, le_uint32 count) -+ : LETableReference(parent, parent.ptrToOffset(array, success), LE_UINTPTR_MAX, success), fCount(count) { -+LE_TRACE_TR("INFO: new RTAO") -+ if(LE_SUCCESS(success)) { -+ if(count == LE_UNBOUNDED_ARRAY) { // not a known length -+ count = getLength()/LETableVarSizer<T>::getSize(); // fit to max size -+ } -+ LETableReference::verifyLength(0, LETableVarSizer<T>::getSize()*count, success); -+ } -+ if(LE_FAILURE(success)) clear(); -+ } -+ LEReferenceToArrayOf(const LETableReference &parent, LEErrorCode &success, const T* array, size_t offset, le_uint32 count) -+ : LETableReference(parent, parent.ptrToOffset(array, success)+offset, LE_UINTPTR_MAX, success), fCount(count) { -+LE_TRACE_TR("INFO: new RTAO") -+ if(LE_SUCCESS(success)) { -+ if(count == LE_UNBOUNDED_ARRAY) { // not a known length -+ count = getLength()/LETableVarSizer<T>::getSize(); // fit to max size -+ } -+ LETableReference::verifyLength(0, LETableVarSizer<T>::getSize()*count, success); -+ } -+ if(LE_FAILURE(success)) clear(); -+ } -+ -+ LEReferenceToArrayOf() :LETableReference(), fCount(0) {} -+ -+ le_uint32 getCount() const { return fCount; } -+ -+ using LETableReference::getAlias; -+ -+ const T *getAlias(le_uint32 i, LEErrorCode &success) const { -+ if(LE_SUCCESS(success)&& i<getCount()) { -+ return ((const T*)getAlias())+i; -+ } else { -+ if(LE_SUCCESS(success)) { -+ LE_DEBUG_TR("getAlias(subscript) out of range"); -+ success = LE_INDEX_OUT_OF_BOUNDS_ERROR; -+ } -+ return ((const T*)getAlias()); // return first item, so there's no crash -+ } -+ } -+ -+ const T *getAliasTODO() const { LE_DEBUG_TR("getAliasTODO<>"); return (const T*)fStart; } -+ -+ const T& getObject(le_uint32 i, LEErrorCode &success) const { -+ return *getAlias(i,success); -+ } -+ -+ const T& operator()(le_uint32 i, LEErrorCode &success) const { -+ return *getAlias(i,success); -+ } -+ -+ size_t getOffsetFor(le_uint32 i, LEErrorCode &success) const { -+ if(LE_SUCCESS(success)&&i<getCount()) { -+ return LETableVarSizer<T>::getSize()*i; -+ } else { -+ success = LE_INDEX_OUT_OF_BOUNDS_ERROR; -+ } -+ return 0; -+ } -+ -+ LEReferenceToArrayOf<T> &reparent(const LETableReference &base) { -+ fParent = &base; -+ return *this; -+ } -+ -+ LEReferenceToArrayOf(const LETableReference& parent, LEErrorCode & success) : LETableReference(parent,0, LE_UINTPTR_MAX, success), fCount(0) { -+ LE_TRACE_TR("INFO: null RTAO") -+ } -+ -+ /** -+ * set this to point within our fParent, but based on 'base' as a subtable. -+ */ -+ void setToOffsetInParent(const LETableReference& base, size_t offset, le_uint32 count, LEErrorCode &success) { -+LE_TRACE_TR("INFO: sTOIP") -+ if(LE_FAILURE(success)) return; -+ if(!fParent->isSubsetOf(base)) { // Ensure that 'base' is containable within our parent. -+ clear(); // otherwise, it's not a subtable of our parent. -+ LE_DEBUG_TR("setToOffsetInParents called on non subsets"); -+ success = LE_ILLEGAL_ARGUMENT_ERROR; return; -+ } -+ size_t baseOffset = fParent->ptrToOffset(((const le_uint8*)base.getAlias())+offset, success); -+ if(LE_FAILURE(success)) return; // base was outside of parent's range -+ if(fParent->hasBounds()) { -+ if((baseOffset >= fParent->getLength()) || // start off end of parent -+ (baseOffset+(count*LETableVarSizer<T>::getSize()) >= fParent->getLength()) || // or off end of parent -+ count > LE_UINTPTR_MAX/LETableVarSizer<T>::getSize()) { // or more than would fit in memory -+ LE_DEBUG_TR("setToOffsetInParent called with bad length"); -+ success = LE_INDEX_OUT_OF_BOUNDS_ERROR; -+ clear(); -+ return; // start would go off end of parent -+ } -+ } -+ fStart = (const le_uint8*)(fParent->getAlias()) + baseOffset; -+ //fLength = count*LETableVarSizer<T>::getSize(); - no- do not shrink fLength. -+ if(fParent->hasBounds()) { -+ fLength = (fParent->getLength() - (fStart-(const le_uint8*)fParent->getAlias())); // reduces fLength accordingly. -+ } else { -+ fLength = LE_UINTPTR_MAX; // unbounded -+ } -+ if((fStart < fParent->getAlias()) || -+ (hasBounds()&&(fStart+fLength < fStart))) { // wrapped -+ LE_DEBUG_TR("setToOffsetInParent called with bad length"); -+ success = LE_INDEX_OUT_OF_BOUNDS_ERROR; -+ clear(); -+ return; // start would go off end of parent -+ } -+ fCount = count; -+ } -+ -+private: -+ le_uint32 fCount; -+}; -+ -+ -+template<class T> -+class LEReferenceTo : public LETableReference { -+public: -+ /** -+ * open a sub reference. -+ * @param parent parent reference -+ * @param success error status -+ * @param atPtr location of reference - if NULL, will be at offset zero (i.e. downcast of parent). Otherwise must be a pointer within parent's bounds. -+ */ -+ LEReferenceTo(const LETableReference &parent, LEErrorCode &success, const void* atPtr) -+ : LETableReference(parent, parent.ptrToOffset(atPtr, success), LE_UINTPTR_MAX, success) { -+ verifyLength(parent.ptrToOffset(atPtr,success), LETableVarSizer<T>::getSize(), success); -+ if(LE_FAILURE(success)) clear(); -+ } -+ /** -+ * ptr plus offset -+ */ -+ LEReferenceTo(const LETableReference &parent, LEErrorCode &success, const void* atPtr, size_t offset) -+ : LETableReference(parent, parent.ptrToOffset(atPtr, success)+offset, LE_UINTPTR_MAX, success) { -+ verifyLength(0, LETableVarSizer<T>::getSize(), success); -+ if(LE_FAILURE(success)) clear(); -+ } -+ LEReferenceTo(const LETableReference &parent, LEErrorCode &success, size_t offset) -+ : LETableReference(parent, offset, LE_UINTPTR_MAX, success) { -+ verifyLength(0, LETableVarSizer<T>::getSize(), success); -+ if(LE_FAILURE(success)) clear(); -+ } -+ LEReferenceTo(const LETableReference &parent, LEErrorCode &success) -+ : LETableReference(parent, 0, LE_UINTPTR_MAX, success) { -+ verifyLength(0, LETableVarSizer<T>::getSize(), success); -+ if(LE_FAILURE(success)) clear(); -+ } -+ LEReferenceTo(const LEFontInstance *font, LETag tableTag, LEErrorCode &success) -+ : LETableReference(font, tableTag, success) { -+ verifyLength(0, LETableVarSizer<T>::getSize(), success); -+ if(LE_FAILURE(success)) clear(); -+ } -+ LEReferenceTo(const le_uint8 *data, size_t length = LE_UINTPTR_MAX) : LETableReference(data, length) {} -+ LEReferenceTo(const T *data, size_t length = LE_UINTPTR_MAX) : LETableReference((const le_uint8*)data, length) {} -+ LEReferenceTo() : LETableReference(NULL) {} -+ -+ LEReferenceTo<T>& operator=(const T* other) { -+ setRaw(other); -+ return *this; -+ } -+ -+ LEReferenceTo<T> &reparent(const LETableReference &base) { -+ fParent = &base; -+ return *this; -+ } -+ -+ /** -+ * roll forward by one <T> size. -+ * same as addOffset(LETableVarSizer<T>::getSize(),success) -+ */ -+ void addObject(LEErrorCode &success) { -+ addOffset(LETableVarSizer<T>::getSize(), success); -+ } -+ void addObject(size_t count, LEErrorCode &success) { -+ addOffset(LETableVarSizer<T>::getSize()*count, success); -+ } -+ -+ const T *operator->() const { return getAlias(); } -+ const T *getAlias() const { return (const T*)fStart; } -+ const T *getAliasTODO() const { LE_DEBUG_TR("getAliasTODO<>"); return (const T*)fStart; } -+}; -+ -+ -+U_NAMESPACE_END -+ -+#endif -+ -+#endif -diff --git a/src/share/native/sun/font/layout/LETypes.h b/src/share/native/sun/font/layout/LETypes.h ---- jdk/src/share/native/sun/font/layout/LETypes.h -+++ jdk/src/share/native/sun/font/layout/LETypes.h -@@ -245,12 +245,15 @@ - /** - * Max value representable by a uintptr - */ -+ -+#ifndef UINT32_MAX -+#define LE_UINT32_MAX 0xFFFFFFFFU -+#else -+#define LE_UINT32_MAX UINT32_MAX -+#endif -+ - #ifndef UINTPTR_MAX --#ifndef UINT32_MAX --#define LE_UINTPTR_MAX 0xFFFFFFFFU --#else --#define LE_UINTPTR_MAX UINT32_MAX --#endif -+#define LE_UINTPTR_MAX LE_UINT32_MAX - #else - #define LE_UINTPTR_MAX UINTPTR_MAX - #endif -diff --git a/src/share/native/sun/font/layout/LayoutEngine.cpp b/src/share/native/sun/font/layout/LayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/LayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/LayoutEngine.cpp -@@ -141,21 +141,21 @@ - class CanonMarkFilter : public UMemory, public LEGlyphFilter - { - private: -- const GlyphClassDefinitionTable *classDefTable; -+ const LEReferenceTo<GlyphClassDefinitionTable> classDefTable; - - CanonMarkFilter(const CanonMarkFilter &other); // forbid copying of this class - CanonMarkFilter &operator=(const CanonMarkFilter &other); // forbid copying of this class - - public: -- CanonMarkFilter(const GlyphDefinitionTableHeader *gdefTable); -+ CanonMarkFilter(const LEReferenceTo<GlyphDefinitionTableHeader> &gdefTable, LEErrorCode &success); - virtual ~CanonMarkFilter(); - - virtual le_bool accept(LEGlyphID glyph) const; - }; - --CanonMarkFilter::CanonMarkFilter(const GlyphDefinitionTableHeader *gdefTable) -+CanonMarkFilter::CanonMarkFilter(const LEReferenceTo<GlyphDefinitionTableHeader> &gdefTable, LEErrorCode &success) -+ : classDefTable(gdefTable->getMarkAttachClassDefinitionTable(gdefTable, success)) - { -- classDefTable = gdefTable->getMarkAttachClassDefinitionTable(); - } - - CanonMarkFilter::~CanonMarkFilter() -@@ -165,9 +165,10 @@ - - le_bool CanonMarkFilter::accept(LEGlyphID glyph) const - { -- le_int32 glyphClass = classDefTable->getGlyphClass(glyph); -- -- return glyphClass != 0; -+ LEErrorCode success = LE_NO_ERROR; -+ le_int32 glyphClass = classDefTable->getGlyphClass(classDefTable, glyph, success); -+ if(LE_FAILURE(success)) return false; -+ return glyphClass != 0; - } - - UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LayoutEngine) -@@ -252,20 +253,20 @@ - return 0; - } - -- const GlyphSubstitutionTableHeader *canonGSUBTable = (GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable; -+ LEReferenceTo<GlyphSubstitutionTableHeader> canonGSUBTable((GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable); - LETag scriptTag = OpenTypeLayoutEngine::getScriptTag(fScriptCode); - LETag langSysTag = OpenTypeLayoutEngine::getLangSysTag(fLanguageCode); - le_int32 i, dir = 1, out = 0, outCharCount = count; - -- if (canonGSUBTable->coversScript(scriptTag)) { -+ if (canonGSUBTable->coversScript(canonGSUBTable,scriptTag, success) || LE_SUCCESS(success)) { - CharSubstitutionFilter *substitutionFilter = new CharSubstitutionFilter(fFontInstance); - if (substitutionFilter == NULL) { - success = LE_MEMORY_ALLOCATION_ERROR; - return 0; - } - -- const LEUnicode *inChars = &chars[offset]; -- LEUnicode *reordered = NULL; -+ const LEUnicode *inChars = &chars[offset]; -+ LEUnicode *reordered = NULL; - LEGlyphStorage fakeGlyphStorage; - - fakeGlyphStorage.allocateGlyphArray(count, rightToLeft, success); -@@ -275,20 +276,20 @@ - return 0; - } - -- // This is the cheapest way to get mark reordering only for Hebrew. -- // We could just do the mark reordering for all scripts, but most -- // of them probably don't need it... -- if (fScriptCode == hebrScriptCode) { -- reordered = LE_NEW_ARRAY(LEUnicode, count); -+ // This is the cheapest way to get mark reordering only for Hebrew. -+ // We could just do the mark reordering for all scripts, but most -+ // of them probably don't need it... -+ if (fScriptCode == hebrScriptCode) { -+ reordered = LE_NEW_ARRAY(LEUnicode, count); - -- if (reordered == NULL) { -- delete substitutionFilter; -- success = LE_MEMORY_ALLOCATION_ERROR; -- return 0; -- } -+ if (reordered == NULL) { -+ delete substitutionFilter; -+ success = LE_MEMORY_ALLOCATION_ERROR; -+ return 0; -+ } - -- CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, reordered, fakeGlyphStorage); -- inChars = reordered; -+ CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, reordered, fakeGlyphStorage); -+ inChars = reordered; - } - - fakeGlyphStorage.allocateAuxData(success); -@@ -308,11 +309,11 @@ - fakeGlyphStorage.setAuxData(out, canonFeatures, success); - } - -- if (reordered != NULL) { -- LE_DELETE_ARRAY(reordered); -- } -+ if (reordered != NULL) { -+ LE_DELETE_ARRAY(reordered); -+ } - -- outCharCount = canonGSUBTable->process(fakeGlyphStorage, rightToLeft, scriptTag, langSysTag, NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE, success); -+ outCharCount = canonGSUBTable->process(canonGSUBTable, fakeGlyphStorage, rightToLeft, scriptTag, langSysTag, (const GlyphDefinitionTableHeader*)NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE, success); - - if (LE_FAILURE(success)) { - delete substitutionFilter; -@@ -413,16 +414,16 @@ - return; - } - -- GlyphDefinitionTableHeader *gdefTable = (GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable; -- CanonMarkFilter filter(gdefTable); -+ LEReferenceTo<GlyphDefinitionTableHeader> gdefTable((GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable, -+ CanonShaping::glyphDefinitionTableLen); -+ CanonMarkFilter filter(gdefTable, success); - - adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success); - - if (fTypoFlags & LE_Kerning_FEATURE_FLAG) { /* kerning enabled */ -- static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG; -- -- KernTable kt(fFontInstance, getFontTable(kernTableTag)); -- kt.process(glyphStorage); -+ LETableReference kernTable(fFontInstance, LE_KERN_TABLE_TAG, success); -+ KernTable kt(kernTable, success); -+ kt.process(glyphStorage, success); - } - - // default is no adjustments -@@ -507,9 +508,9 @@ - glyphStorage.adjustPosition(glyphCount, xAdjust, 0, success); - } - --const void *LayoutEngine::getFontTable(LETag tableTag) const -+const void *LayoutEngine::getFontTable(LETag tableTag, size_t &length) const - { -- return fFontInstance->getFontTable(tableTag); -+ return fFontInstance->getFontTable(tableTag, length); - } - - void LayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, -@@ -556,7 +557,10 @@ - - void LayoutEngine::reset() - { -+ if(fGlyphStorage!=NULL) { - fGlyphStorage->reset(); -+ fGlyphStorage = NULL; -+ } - } - - LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success) -@@ -574,19 +578,19 @@ - return NULL; - } - -- const GlyphSubstitutionTableHeader *gsubTable = (const GlyphSubstitutionTableHeader *) fontInstance->getFontTable(gsubTableTag); -+ LEReferenceTo<GlyphSubstitutionTableHeader> gsubTable(fontInstance,gsubTableTag,success); - LayoutEngine *result = NULL; - LETag scriptTag = 0x00000000; - LETag languageTag = 0x00000000; -- LETag v2ScriptTag = OpenTypeLayoutEngine::getV2ScriptTag(scriptCode); -+ LETag v2ScriptTag = OpenTypeLayoutEngine::getV2ScriptTag(scriptCode); - - // Right now, only invoke V2 processing for Devanagari. TODO: Allow more V2 scripts as they are - // properly tested. - -- if ( v2ScriptTag == dev2ScriptTag && gsubTable != NULL && gsubTable->coversScript( v2ScriptTag )) { -- result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, TRUE, gsubTable, success); -- } -- else if (gsubTable != NULL && gsubTable->coversScript(scriptTag = OpenTypeLayoutEngine::getScriptTag(scriptCode))) { -+ if ( v2ScriptTag == dev2ScriptTag && gsubTable.isValid() && gsubTable->coversScript(gsubTable, v2ScriptTag, success )) { -+ result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, TRUE, gsubTable, success); -+ } -+ else if (gsubTable.isValid() && gsubTable->coversScript(gsubTable, scriptTag = OpenTypeLayoutEngine::getScriptTag(scriptCode), success)) { - switch (scriptCode) { - case bengScriptCode: - case devaScriptCode: -@@ -617,10 +621,10 @@ - case janLanguageCode: - case zhtLanguageCode: - case zhsLanguageCode: -- if (gsubTable->coversScriptAndLanguage(scriptTag, languageTag, TRUE)) { -+ if (gsubTable->coversScriptAndLanguage(gsubTable, scriptTag, languageTag, success, TRUE)) { - result = new HanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success); - break; -- } -+ } - - // note: falling through to default case. - default: -@@ -643,10 +647,10 @@ - break; - } - } else { -- const MorphTableHeader *morphTable = (MorphTableHeader *) fontInstance->getFontTable(mortTableTag); -+ LEReferenceTo<MorphTableHeader> mortTable(fontInstance, mortTableTag, success); - -- if (morphTable != NULL && SWAPL(morphTable->version)==0x00010000) { -- result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, morphTable, success); -+ if (LE_SUCCESS(success) && mortTable.isValid() && SWAPL(mortTable->version)==0x00010000) { // mort -+ result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, mortTable, success); - } else { - switch (scriptCode) { - case bengScriptCode: -diff --git a/src/share/native/sun/font/layout/LayoutEngine.h b/src/share/native/sun/font/layout/LayoutEngine.h ---- jdk/src/share/native/sun/font/layout/LayoutEngine.h -+++ jdk/src/share/native/sun/font/layout/LayoutEngine.h -@@ -268,12 +268,18 @@ - * some other way must override this method. - * - * @param tableTag - the four byte table tag. -+ * @param length - length to use - * - * @return the address of the table. - * - * @internal - */ -- virtual const void *getFontTable(LETag tableTag) const; -+ virtual const void *getFontTable(LETag tableTag, size_t &length) const; -+ -+ /** -+ * @deprecated -+ */ -+ virtual const void *getFontTable(LETag tableTag) const { size_t ignored; return getFontTable(tableTag, ignored); } - - /** - * This method does character to glyph mapping. The default implementation -diff --git a/src/share/native/sun/font/layout/LigatureSubstProc.cpp b/src/share/native/sun/font/layout/LigatureSubstProc.cpp ---- jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp -+++ jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp -@@ -47,15 +47,15 @@ - - UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LigatureSubstitutionProcessor) - --LigatureSubstitutionProcessor::LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader) -- : StateTableProcessor(morphSubtableHeader) -+ LigatureSubstitutionProcessor::LigatureSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) -+: StateTableProcessor(morphSubtableHeader, success), ligatureSubstitutionHeader(morphSubtableHeader, success) - { -- ligatureSubstitutionHeader = (const LigatureSubstitutionHeader *) morphSubtableHeader; -+ if(LE_FAILURE(success)) return; - ligatureActionTableOffset = SWAPW(ligatureSubstitutionHeader->ligatureActionTableOffset); - componentTableOffset = SWAPW(ligatureSubstitutionHeader->componentTableOffset); - ligatureTableOffset = SWAPW(ligatureSubstitutionHeader->ligatureTableOffset); - -- entryTable = (const LigatureSubstitutionStateEntry *) ((char *) &stateTableHeader->stHeader + entryTableOffset); -+ entryTable = LEReferenceToArrayOf<LigatureSubstitutionStateEntry>(stHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY); - } - - LigatureSubstitutionProcessor::~LigatureSubstitutionProcessor() -@@ -69,7 +69,9 @@ - - ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index) - { -- const LigatureSubstitutionStateEntry *entry = &entryTable[index]; -+ LEErrorCode success = LE_NO_ERROR; -+ const LigatureSubstitutionStateEntry *entry = entryTable.getAlias(index, success); -+ - ByteOffset newState = SWAPW(entry->newStateOffset); - le_int16 flags = SWAPW(entry->flags); - -@@ -88,7 +90,7 @@ - ByteOffset actionOffset = flags & lsfActionOffsetMask; - - if (actionOffset != 0) { -- const LigatureActionEntry *ap = (const LigatureActionEntry *) ((char *) &ligatureSubstitutionHeader->stHeader + actionOffset); -+ LEReferenceTo<LigatureActionEntry> ap(stHeader, success, actionOffset); - LigatureActionEntry action; - le_int32 offset, i = 0; - le_int32 stack[nComponents]; -@@ -97,7 +99,8 @@ - do { - le_uint32 componentGlyph = componentStack[m--]; - -- action = SWAPL(*ap++); -+ action = SWAPL(*ap.getAlias()); -+ ap.addObject(success); // ap++ - - if (m < 0) { - m = nComponents - 1; -@@ -105,37 +108,33 @@ - - offset = action & lafComponentOffsetMask; - if (offset != 0) { -- const le_int16 *offsetTable = (const le_int16 *)((char *) &ligatureSubstitutionHeader->stHeader + 2 * SignExtend(offset, lafComponentOffsetMask)); -- const le_int16 *tableEnd = (const le_int16 *)((char *) &ligatureSubstitutionHeader + 1 * SWAPW(ligatureSubstitutionHeader->length)); -+ LEReferenceToArrayOf<le_int16> offsetTable(stHeader, success, 2 * SignExtend(offset, lafComponentOffsetMask), LE_UNBOUNDED_ARRAY); - -- // Check if the font is internally consistent -- if(tableEnd < (const le_int16*)&ligatureSubstitutionHeader // stated end wrapped around? -- || offsetTable > tableEnd) { // offset past end of stated length? -+ if(LE_FAILURE(success)) { - currGlyph++; - LE_DEBUG_BAD_FONT("off end of ligature substitution header"); - return newState; // get out! bad font -- } -- -- if(componentGlyph > glyphStorage.getGlyphCount()) { -- LE_DEBUG_BAD_FONT("preposterous componentGlyph"); -- currGlyph++; -- return newState; // get out! bad font -- } -- i += SWAPW(offsetTable[LE_GET_GLYPH(glyphStorage[componentGlyph])]); -+ } -+ if(componentGlyph > glyphStorage.getGlyphCount()) { -+ LE_DEBUG_BAD_FONT("preposterous componentGlyph"); -+ currGlyph++; -+ return newState; // get out! bad font -+ } -+ i += SWAPW(offsetTable.getObject(LE_GET_GLYPH(glyphStorage[componentGlyph]), success)); - - if (action & (lafLast | lafStore)) { -- const TTGlyphID *ligatureOffset = (const TTGlyphID *) ((char *) &ligatureSubstitutionHeader->stHeader + i); -- TTGlyphID ligatureGlyph = SWAPW(*ligatureOffset); -+ LEReferenceTo<TTGlyphID> ligatureOffset(stHeader, success, i); -+ TTGlyphID ligatureGlyph = SWAPW(*ligatureOffset.getAlias()); - -- glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], ligatureGlyph); -- if(mm==nComponents) { -- LE_DEBUG_BAD_FONT("exceeded nComponents"); -- mm--; // don't overrun the stack. -- } -- stack[++mm] = componentGlyph; -- i = 0; -+ glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], ligatureGlyph); -+ if(mm==nComponents) { -+ LE_DEBUG_BAD_FONT("exceeded nComponents"); -+ mm--; // don't overrun the stack. -+ } -+ stack[++mm] = componentGlyph; -+ i = 0; - } else { -- glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], 0xFFFF); -+ glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], 0xFFFF); - } - } - #if LE_ASSERT_BAD_FONT -@@ -146,11 +145,11 @@ - } while (!(action & lafLast) && (m>=0) ); // stop if last bit is set, or if run out of items - - while (mm >= 0) { -- if (++m >= nComponents) { -- m = 0; -- } -+ if (++m >= nComponents) { -+ m = 0; -+ } - -- componentStack[m] = stack[mm--]; -+ componentStack[m] = stack[mm--]; - } - } - -diff --git a/src/share/native/sun/font/layout/LigatureSubstProc.h b/src/share/native/sun/font/layout/LigatureSubstProc.h ---- jdk/src/share/native/sun/font/layout/LigatureSubstProc.h -+++ jdk/src/share/native/sun/font/layout/LigatureSubstProc.h -@@ -58,7 +58,7 @@ - - virtual void endStateTable(); - -- LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader); -+ LigatureSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success); - virtual ~LigatureSubstitutionProcessor(); - - /** -@@ -83,12 +83,12 @@ - ByteOffset componentTableOffset; - ByteOffset ligatureTableOffset; - -- const LigatureSubstitutionStateEntry *entryTable; -+ LEReferenceToArrayOf<LigatureSubstitutionStateEntry> entryTable; - - le_int32 componentStack[nComponents]; - le_int16 m; - -- const LigatureSubstitutionHeader *ligatureSubstitutionHeader; -+ LEReferenceTo<LigatureSubstitutionHeader> ligatureSubstitutionHeader; - - }; - -diff --git a/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp b/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp ---- jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp -@@ -40,10 +40,10 @@ - - U_NAMESPACE_BEGIN - --le_uint32 LigatureSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const -+le_uint32 LigatureSubstitutionSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const - { - LEGlyphID glyph = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(glyph); -+ le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); - - if (coverageIndex >= 0) { - Offset ligSetTableOffset = SWAPW(ligSetTableOffsetArray[coverageIndex]); -diff --git a/src/share/native/sun/font/layout/LigatureSubstSubtables.h b/src/share/native/sun/font/layout/LigatureSubstSubtables.h ---- jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.h -+++ jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.h -@@ -50,6 +50,7 @@ - le_uint16 ligatureCount; - Offset ligatureTableOffsetArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(LigatureSetTable, ligatureTableOffsetArray) - - struct LigatureTable - { -@@ -57,14 +58,16 @@ - le_uint16 compCount; - TTGlyphID componentArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(LigatureTable, componentArray) - - struct LigatureSubstitutionSubtable : GlyphSubstitutionSubtable - { - le_uint16 ligSetCount; - Offset ligSetTableOffsetArray[ANY_NUMBER]; - -- le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; -+ le_uint32 process(const LETableReference &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter = NULL) const; - }; -+LE_VAR_ARRAY(LigatureSubstitutionSubtable, ligSetTableOffsetArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/LookupProcessor.cpp b/src/share/native/sun/font/layout/LookupProcessor.cpp ---- jdk/src/share/native/sun/font/layout/LookupProcessor.cpp -+++ jdk/src/share/native/sun/font/layout/LookupProcessor.cpp -@@ -44,7 +44,7 @@ - - U_NAMESPACE_BEGIN - --le_uint32 LookupProcessor::applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator, -+le_uint32 LookupProcessor::applyLookupTable(const LEReferenceTo<LookupTable> &lookupTable, GlyphIterator *glyphIterator, - const LEFontInstance *fontInstance, LEErrorCode& success) const - { - if (LE_FAILURE(success)) { -@@ -57,7 +57,7 @@ - le_uint32 delta; - - for (le_uint16 subtable = 0; subtable < subtableCount; subtable += 1) { -- const LookupSubtable *lookupSubtable = lookupTable->getLookupSubtable(subtable); -+ LEReferenceTo<LookupSubtable> lookupSubtable = lookupTable->getLookupSubtable(lookupTable, subtable, success); - - delta = applySubtable(lookupSubtable, lookupType, glyphIterator, fontInstance, success); - -@@ -72,7 +72,7 @@ - } - - le_int32 LookupProcessor::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, -- le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, -+ le_bool rightToLeft, const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader, - const LEFontInstance *fontInstance, LEErrorCode& success) const - { - if (LE_FAILURE(success)) { -@@ -89,22 +89,21 @@ - rightToLeft, 0, 0, glyphDefinitionTableHeader); - le_int32 newGlyphCount = glyphCount; - -- for (le_uint16 order = 0; order < lookupOrderCount; order += 1) { -+ for (le_uint16 order = 0; order < lookupOrderCount && LE_SUCCESS(success); order += 1) { - le_uint16 lookup = lookupOrderArray[order]; - FeatureMask selectMask = lookupSelectArray[lookup]; - - if (selectMask != 0) { -- const LookupTable *lookupTable = lookupListTable->getLookupTable(lookup); -- -- if (!lookupTable) -- continue; -- -- le_uint16 lookupFlags = SWAPW(lookupTable->lookupFlags); -+ const LEReferenceTo<LookupTable> lookupTable = lookupListTable->getLookupTable(lookupListTable, lookup, success); -+ if (!lookupTable.isValid() ||LE_FAILURE(success) ) { -+ continue; -+ } -+ le_uint16 lookupFlags = SWAPW(lookupTable->lookupFlags); - - glyphIterator.reset(lookupFlags, selectMask); - - while (glyphIterator.findFeatureTag()) { -- applyLookupTable(lookupTable, &glyphIterator, fontInstance, success); -+ applyLookupTable(lookupTable, &glyphIterator, fontInstance, success); // TODO - if (LE_FAILURE(success)) { - return 0; - } -@@ -124,7 +123,11 @@ - return 0; - } - -- const LookupTable *lookupTable = lookupListTable->getLookupTable(lookupTableIndex); -+ const LEReferenceTo<LookupTable> lookupTable = lookupListTable->getLookupTable(lookupListTable, lookupTableIndex, success); -+ if (!lookupTable.isValid()) { -+ success = LE_INTERNAL_ERROR; -+ return 0; -+ } - le_uint16 lookupFlags = SWAPW(lookupTable->lookupFlags); - GlyphIterator tempIterator(*glyphIterator, lookupFlags); - le_uint32 delta = applyLookupTable(lookupTable, &tempIterator, fontInstance, success); -@@ -132,33 +135,35 @@ - return delta; - } - --le_int32 LookupProcessor::selectLookups(const FeatureTable *featureTable, FeatureMask featureMask, le_int32 order) -+le_int32 LookupProcessor::selectLookups(const LEReferenceTo<FeatureTable> &featureTable, FeatureMask featureMask, le_int32 order, LEErrorCode &success) - { -- le_uint16 lookupCount = featureTable? SWAPW(featureTable->lookupCount) : 0; -+ le_uint16 lookupCount = featureTable.isValid()? SWAPW(featureTable->lookupCount) : 0; - le_int32 store = order; - -- for (le_uint16 lookup = 0; lookup < lookupCount; lookup += 1) { -- le_uint16 lookupListIndex = SWAPW(featureTable->lookupListIndexArray[lookup]); -+ LEReferenceToArrayOf<le_uint16> lookupListIndexArray(featureTable, success, featureTable->lookupListIndexArray, lookupCount); - -- if (lookupListIndex >= lookupSelectCount) -- continue; -+ for (le_uint16 lookup = 0; LE_SUCCESS(success) && lookup < lookupCount; lookup += 1) { -+ le_uint16 lookupListIndex = SWAPW(lookupListIndexArray.getObject(lookup,success)); -+ if (lookupListIndex >= lookupSelectCount) { -+ continue; -+ } - -- lookupSelectArray[lookupListIndex] |= featureMask; -- lookupOrderArray[store++] = lookupListIndex; -+ lookupSelectArray[lookupListIndex] |= featureMask; -+ lookupOrderArray[store++] = lookupListIndex; - } - - return store - order; - } - --LookupProcessor::LookupProcessor(const char *baseAddress, -+LookupProcessor::LookupProcessor(const LETableReference &baseAddress, - Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset, - LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool orderFeatures, - LEErrorCode& success) -- : lookupListTable(NULL), featureListTable(NULL), lookupSelectArray(NULL), lookupSelectCount(0), -- lookupOrderArray(NULL), lookupOrderCount(0) -+ : lookupListTable(), featureListTable(), lookupSelectArray(NULL), lookupSelectCount(0), -+ lookupOrderArray(NULL), lookupOrderCount(0), fReference(baseAddress) - { -- const ScriptListTable *scriptListTable = NULL; -- const LangSysTable *langSysTable = NULL; -+ LEReferenceTo<ScriptListTable> scriptListTable; -+ LEReferenceTo<LangSysTable> langSysTable; - le_uint16 featureCount = 0; - le_uint16 lookupListCount = 0; - le_uint16 requiredFeatureIndex; -@@ -168,29 +173,33 @@ - } - - if (scriptListOffset != 0) { -- scriptListTable = (const ScriptListTable *) (baseAddress + scriptListOffset); -- langSysTable = scriptListTable->findLanguage(scriptTag, languageTag); -+ scriptListTable = LEReferenceTo<ScriptListTable>(baseAddress, success, scriptListOffset); -+ langSysTable = scriptListTable->findLanguage(scriptListTable, scriptTag, languageTag, success); - -- if (langSysTable != 0) { -- featureCount = SWAPW(langSysTable->featureCount); -- } -+ if (langSysTable.isValid() && LE_SUCCESS(success)) { -+ featureCount = SWAPW(langSysTable->featureCount); -+ } - } - - if (featureListOffset != 0) { -- featureListTable = (const FeatureListTable *) (baseAddress + featureListOffset); -+ featureListTable = LEReferenceTo<FeatureListTable>(baseAddress, success, featureListOffset); - } - - if (lookupListOffset != 0) { -- lookupListTable = (const LookupListTable *) (baseAddress + lookupListOffset); -+ lookupListTable = LEReferenceTo<LookupListTable>(baseAddress,success, lookupListOffset); -+ if(LE_SUCCESS(success) && lookupListTable.isValid()) { - lookupListCount = SWAPW(lookupListTable->lookupCount); -+ } - } - -- if (langSysTable == NULL || featureListTable == NULL || lookupListTable == NULL || -+ if (langSysTable.isEmpty() || featureListTable.isEmpty() || lookupListTable.isEmpty() || - featureCount == 0 || lookupListCount == 0) { - return; - } - -- requiredFeatureIndex = SWAPW(langSysTable->reqFeatureIndex); -+ if(langSysTable.isValid()) { -+ requiredFeatureIndex = SWAPW(langSysTable->reqFeatureIndex); -+ } - - lookupSelectArray = LE_NEW_ARRAY(FeatureMask, lookupListCount); - if (lookupSelectArray == NULL) { -@@ -206,30 +215,38 @@ - - le_int32 count, order = 0; - le_uint32 featureReferences = 0; -- const FeatureTable *featureTable = NULL; -+ LEReferenceTo<FeatureTable> featureTable; - LETag featureTag; - -- const FeatureTable *requiredFeatureTable = NULL; -+ LEReferenceTo<FeatureTable> requiredFeatureTable; - LETag requiredFeatureTag = 0x00000000U; - - // Count the total number of lookups referenced by all features. This will - // be the maximum number of entries in the lookupOrderArray. We can't use - // lookupListCount because some lookups might be referenced by more than - // one feature. -- for (le_uint32 feature = 0; feature < featureCount; feature += 1) { -- le_uint16 featureIndex = SWAPW(langSysTable->featureIndexArray[feature]); -+ if(featureListTable.isValid() && LE_SUCCESS(success)) { -+ LEReferenceToArrayOf<le_uint16> featureIndexArray(langSysTable, success, langSysTable->featureIndexArray, featureCount); - -- featureTable = featureListTable->getFeatureTable(featureIndex, &featureTag); -+ for (le_uint32 feature = 0; LE_SUCCESS(success)&&(feature < featureCount); feature += 1) { -+ le_uint16 featureIndex = SWAPW(featureIndexArray.getObject(feature, success)); - -- if (!featureTable) -- continue; -+ featureTable = featureListTable->getFeatureTable(featureListTable, featureIndex, &featureTag, success); -+ if (!featureTable.isValid() || LE_FAILURE(success)) { -+ continue; -+ } -+ featureReferences += SWAPW(featureTable->lookupCount); -+ } -+ } - -- featureReferences += SWAPW(featureTable->lookupCount); -+ if (!featureTable.isValid() || LE_FAILURE(success)) { -+ success = LE_INTERNAL_ERROR; -+ return; - } - - if (requiredFeatureIndex != 0xFFFF) { -- requiredFeatureTable = featureListTable->getFeatureTable(requiredFeatureIndex, &requiredFeatureTag); -- featureReferences += SWAPW(featureTable->lookupCount); -+ requiredFeatureTable = featureListTable->getFeatureTable(featureListTable, requiredFeatureIndex, &requiredFeatureTag, success); -+ featureReferences += SWAPW(featureTable->lookupCount); - } - - lookupOrderArray = LE_NEW_ARRAY(le_uint16, featureReferences); -@@ -244,7 +261,7 @@ - - // If this is the required feature, add its lookups - if (requiredFeatureTag == fm.tag) { -- count += selectLookups(requiredFeatureTable, fm.mask, order); -+ count += selectLookups(requiredFeatureTable, fm.mask, order, success); - } - - if (orderFeatures) { -@@ -254,7 +271,8 @@ - } - - for (le_uint16 feature = 0; feature < featureCount; feature += 1) { -- le_uint16 featureIndex = SWAPW(langSysTable->featureIndexArray[feature]); -+ LEReferenceToArrayOf<le_uint16> featureIndexArray(langSysTable, success, langSysTable->featureIndexArray, featureCount); -+ le_uint16 featureIndex = SWAPW(featureIndexArray.getObject(feature,success)); - - // don't add the required feature to the list more than once... - // TODO: Do we need this check? (Spec. says required feature won't be in feature list...) -@@ -262,10 +280,10 @@ - continue; - } - -- featureTable = featureListTable->getFeatureTable(featureIndex, &featureTag); -+ featureTable = featureListTable->getFeatureTable(featureListTable, featureIndex, &featureTag, success); - - if (featureTag == fm.tag) { -- count += selectLookups(featureTable, fm.mask, order + count); -+ count += selectLookups(featureTable, fm.mask, order + count, success); - } - } - -@@ -274,9 +292,10 @@ - } - - order += count; -- } else { -- for (le_uint16 feature = 0; feature < featureCount; feature += 1) { -- le_uint16 featureIndex = SWAPW(langSysTable->featureIndexArray[feature]); -+ } else if(langSysTable.isValid()) { -+ LEReferenceToArrayOf<le_uint16> featureIndexArray(langSysTable, success, langSysTable->featureIndexArray, featureCount); -+ for (le_uint16 feature = 0; LE_SUCCESS(success)&& (feature < featureCount); feature += 1) { -+ le_uint16 featureIndex = SWAPW(featureIndexArray.getObject(feature,success)); - - // don't add the required feature to the list more than once... - // NOTE: This check is commented out because the spec. says that -@@ -288,10 +307,10 @@ - } - #endif - -- featureTable = featureListTable->getFeatureTable(featureIndex, &featureTag); -+ featureTable = featureListTable->getFeatureTable(featureListTable, featureIndex, &featureTag, success); - - if (featureTag == fm.tag) { -- order += selectLookups(featureTable, fm.mask, order); -+ order += selectLookups(featureTable, fm.mask, order, success); - } - } - } -diff --git a/src/share/native/sun/font/layout/LookupProcessor.h b/src/share/native/sun/font/layout/LookupProcessor.h ---- jdk/src/share/native/sun/font/layout/LookupProcessor.h -+++ jdk/src/share/native/sun/font/layout/LookupProcessor.h -@@ -41,6 +41,7 @@ - #include "LETypes.h" - #include "LEFontInstance.h" - #include "OpenTypeTables.h" -+#include "LETableReference.h" - //#include "Lookups.h" - //#include "Features.h" - -@@ -59,19 +60,21 @@ - class LookupProcessor : public UMemory { - public: - le_int32 process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, -- le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const LEFontInstance *fontInstance, LEErrorCode& success) const; -+ le_bool rightToLeft, const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader, const LEFontInstance *fontInstance, LEErrorCode& success) const; - -- le_uint32 applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; -+ le_uint32 applyLookupTable(const LEReferenceTo<LookupTable> &lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; - - le_uint32 applySingleLookup(le_uint16 lookupTableIndex, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; - -- virtual le_uint32 applySubtable(const LookupSubtable *lookupSubtable, le_uint16 subtableType, -+ virtual le_uint32 applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 subtableType, - GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const = 0; - - virtual ~LookupProcessor(); - -+ const LETableReference &getReference() const { return fReference; } -+ - protected: -- LookupProcessor(const char *baseAddress, -+ LookupProcessor(const LETableReference &baseAddress, - Offset scriptListOffset, - Offset featureListOffset, - Offset lookupListOffset, -@@ -84,10 +87,10 @@ - - LookupProcessor(); - -- le_int32 selectLookups(const FeatureTable *featureTable, FeatureMask featureMask, le_int32 order); -+ le_int32 selectLookups(const LEReferenceTo<FeatureTable> &featureTable, FeatureMask featureMask, le_int32 order, LEErrorCode &success); - -- const LookupListTable *lookupListTable; -- const FeatureListTable *featureListTable; -+ LEReferenceTo<LookupListTable> lookupListTable; -+ LEReferenceTo<FeatureListTable> featureListTable; - - FeatureMask *lookupSelectArray; - le_uint32 lookupSelectCount; -@@ -95,6 +98,8 @@ - le_uint16 *lookupOrderArray; - le_uint32 lookupOrderCount; - -+ LETableReference fReference; -+ - private: - - LookupProcessor(const LookupProcessor &other); // forbid copying of this class -diff --git a/src/share/native/sun/font/layout/LookupTables.cpp b/src/share/native/sun/font/layout/LookupTables.cpp ---- jdk/src/share/native/sun/font/layout/LookupTables.cpp -+++ jdk/src/share/native/sun/font/layout/LookupTables.cpp -@@ -49,22 +49,26 @@ - of the derived classes, and implement it in the others by casting - the "this" pointer to the type that has the implementation. - */ --const LookupSegment *BinarySearchLookupTable::lookupSegment(const LookupSegment *segments, LEGlyphID glyph) const -+const LookupSegment *BinarySearchLookupTable::lookupSegment(const LETableReference &base, const LookupSegment *segments, LEGlyphID glyph, LEErrorCode &success) const - { -+ - le_int16 unity = SWAPW(unitSize); - le_int16 probe = SWAPW(searchRange); - le_int16 extra = SWAPW(rangeShift); - TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(glyph); -- const LookupSegment *entry = segments; -- const LookupSegment *trial = (const LookupSegment *) ((char *) entry + extra); -+ LEReferenceTo<LookupSegment> entry(base, success, segments); -+ LEReferenceTo<LookupSegment> trial(entry, success, extra); -+ -+ if(LE_FAILURE(success)) return NULL; - - if (SWAPW(trial->lastGlyph) <= ttGlyph) { - entry = trial; - } - -- while (probe > unity) { -+ while (probe > unity && LE_SUCCESS(success)) { - probe >>= 1; -- trial = (const LookupSegment *) ((char *) entry + probe); -+ trial = entry; // copy -+ trial.addOffset(probe, success); - - if (SWAPW(trial->lastGlyph) <= ttGlyph) { - entry = trial; -@@ -72,28 +76,29 @@ - } - - if (SWAPW(entry->firstGlyph) <= ttGlyph) { -- return entry; -+ return entry.getAlias(); - } - - return NULL; - } - --const LookupSingle *BinarySearchLookupTable::lookupSingle(const LookupSingle *entries, LEGlyphID glyph) const -+const LookupSingle *BinarySearchLookupTable::lookupSingle(const LETableReference &base, const LookupSingle *entries, LEGlyphID glyph, LEErrorCode &success) const - { - le_int16 unity = SWAPW(unitSize); - le_int16 probe = SWAPW(searchRange); - le_int16 extra = SWAPW(rangeShift); - TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(glyph); -- const LookupSingle *entry = entries; -- const LookupSingle *trial = (const LookupSingle *) ((char *) entry + extra); -+ LEReferenceTo<LookupSingle> entry(base, success, entries); -+ LEReferenceTo<LookupSingle> trial(entry, success, extra); - - if (SWAPW(trial->glyph) <= ttGlyph) { - entry = trial; - } - -- while (probe > unity) { -+ while (probe > unity && LE_SUCCESS(success)) { - probe >>= 1; -- trial = (const LookupSingle *) ((char *) entry + probe); -+ trial = entry; -+ trial.addOffset(probe, success); - - if (SWAPW(trial->glyph) <= ttGlyph) { - entry = trial; -@@ -101,7 +106,7 @@ - } - - if (SWAPW(entry->glyph) == ttGlyph) { -- return entry; -+ return entry.getAlias(); - } - - return NULL; -diff --git a/src/share/native/sun/font/layout/LookupTables.h b/src/share/native/sun/font/layout/LookupTables.h ---- jdk/src/share/native/sun/font/layout/LookupTables.h -+++ jdk/src/share/native/sun/font/layout/LookupTables.h -@@ -39,6 +39,7 @@ - - #include "LETypes.h" - #include "LayoutTables.h" -+#include "LETableReference.h" - - U_NAMESPACE_BEGIN - -@@ -79,30 +80,34 @@ - le_int16 entrySelector; - le_int16 rangeShift; - -- const LookupSegment *lookupSegment(const LookupSegment *segments, LEGlyphID glyph) const; -+ const LookupSegment *lookupSegment(const LETableReference &base, const LookupSegment *segments, LEGlyphID glyph, LEErrorCode &success) const; - -- const LookupSingle *lookupSingle(const LookupSingle *entries, LEGlyphID glyph) const; -+ const LookupSingle *lookupSingle(const LETableReference &base, const LookupSingle *entries, LEGlyphID glyph, LEErrorCode &success) const; - }; - - struct SimpleArrayLookupTable : LookupTable - { - LookupValue valueArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(SimpleArrayLookupTable, valueArray) - - struct SegmentSingleLookupTable : BinarySearchLookupTable - { - LookupSegment segments[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(SegmentSingleLookupTable, segments) - - struct SegmentArrayLookupTable : BinarySearchLookupTable - { - LookupSegment segments[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(SegmentArrayLookupTable, segments) - - struct SingleTableLookupTable : BinarySearchLookupTable - { - LookupSingle entries[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(SingleTableLookupTable, entries) - - struct TrimmedArrayLookupTable : LookupTable - { -@@ -110,6 +115,7 @@ - TTGlyphID glyphCount; - LookupValue valueArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(TrimmedArrayLookupTable, valueArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/Lookups.cpp b/src/share/native/sun/font/layout/Lookups.cpp ---- jdk/src/share/native/sun/font/layout/Lookups.cpp -+++ jdk/src/share/native/sun/font/layout/Lookups.cpp -@@ -37,33 +37,35 @@ - - U_NAMESPACE_BEGIN - --const LookupTable *LookupListTable::getLookupTable(le_uint16 lookupTableIndex) const -+const LEReferenceTo<LookupTable> LookupListTable::getLookupTable(const LEReferenceTo<LookupListTable> &base, le_uint16 lookupTableIndex, LEErrorCode &success) const - { -- if (lookupTableIndex >= SWAPW(lookupCount)) { -- return 0; -- } -+ LEReferenceToArrayOf<Offset> lookupTableOffsetArrayRef(base, success, (const Offset*)&lookupTableOffsetArray, SWAPW(lookupCount)); - -- Offset lookupTableOffset = lookupTableOffsetArray[lookupTableIndex]; -- -- return (const LookupTable *) ((char *) this + SWAPW(lookupTableOffset)); -+ if(LE_FAILURE(success) || lookupTableIndex>lookupTableOffsetArrayRef.getCount()) { -+ return LEReferenceTo<LookupTable>(); -+ } else { -+ return LEReferenceTo<LookupTable>(base, success, SWAPW(lookupTableOffsetArrayRef.getObject(lookupTableIndex, success))); -+ } - } - --const LookupSubtable *LookupTable::getLookupSubtable(le_uint16 subtableIndex) const -+const LEReferenceTo<LookupSubtable> LookupTable::getLookupSubtable(const LEReferenceTo<LookupTable> &base, le_uint16 subtableIndex, LEErrorCode &success) const - { -- if (subtableIndex >= SWAPW(subTableCount)) { -- return 0; -- } -+ LEReferenceToArrayOf<Offset> subTableOffsetArrayRef(base, success, (const Offset*)&subTableOffsetArray, SWAPW(subTableCount)); - -- Offset subtableOffset = subTableOffsetArray[subtableIndex]; -- -- return (const LookupSubtable *) ((char *) this + SWAPW(subtableOffset)); -+ if(LE_FAILURE(success) || subtableIndex>subTableOffsetArrayRef.getCount()) { -+ return LEReferenceTo<LookupSubtable>(); -+ } else { -+ return LEReferenceTo<LookupSubtable>(base, success, SWAPW(subTableOffsetArrayRef.getObject(subtableIndex, success))); -+ } - } - --le_int32 LookupSubtable::getGlyphCoverage(Offset tableOffset, LEGlyphID glyphID) const -+le_int32 LookupSubtable::getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const - { -- const CoverageTable *coverageTable = (const CoverageTable *) ((char *) this + SWAPW(tableOffset)); -+ const LEReferenceTo<CoverageTable> coverageTable(base, success, SWAPW(tableOffset)); - -- return coverageTable->getGlyphCoverage(glyphID); -+ if(LE_FAILURE(success)) return 0; -+ -+ return coverageTable->getGlyphCoverage(glyphID); - } - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/Lookups.h b/src/share/native/sun/font/layout/Lookups.h ---- jdk/src/share/native/sun/font/layout/Lookups.h -+++ jdk/src/share/native/sun/font/layout/Lookups.h -@@ -58,9 +58,14 @@ - le_uint16 subtableFormat; - Offset coverageTableOffset; - -- inline le_int32 getGlyphCoverage(LEGlyphID glyphID) const; -+ inline le_int32 getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, LEGlyphID glyphID, LEErrorCode &success) const; - -- le_int32 getGlyphCoverage(Offset tableOffset, LEGlyphID glyphID) const; -+ le_int32 getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const; -+ -+ // convenience -+ inline le_int32 getGlyphCoverage(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const; -+ -+ inline le_int32 getGlyphCoverage(const LETableReference &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const; - }; - - struct LookupTable -@@ -70,20 +75,32 @@ - le_uint16 subTableCount; - Offset subTableOffsetArray[ANY_NUMBER]; - -- const LookupSubtable *getLookupSubtable(le_uint16 subtableIndex) const; -+ const LEReferenceTo<LookupSubtable> getLookupSubtable(const LEReferenceTo<LookupTable> &base, le_uint16 subtableIndex, LEErrorCode &success) const; - }; -+LE_VAR_ARRAY(LookupTable, subTableOffsetArray) - - struct LookupListTable - { - le_uint16 lookupCount; - Offset lookupTableOffsetArray[ANY_NUMBER]; - -- const LookupTable *getLookupTable(le_uint16 lookupTableIndex) const; -+ const LEReferenceTo<LookupTable> getLookupTable(const LEReferenceTo<LookupListTable> &base, le_uint16 lookupTableIndex, LEErrorCode &success) const; - }; -+LE_VAR_ARRAY(LookupListTable, lookupTableOffsetArray) - --inline le_int32 LookupSubtable::getGlyphCoverage(LEGlyphID glyphID) const -+inline le_int32 LookupSubtable::getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, LEGlyphID glyphID, LEErrorCode &success) const - { -- return getGlyphCoverage(coverageTableOffset, glyphID); -+ return getGlyphCoverage(base, coverageTableOffset, glyphID, success); -+} -+ -+inline le_int32 LookupSubtable::getGlyphCoverage(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const { -+ LEReferenceTo<LookupSubtable> thisRef(base, success, this); -+ return getGlyphCoverage(thisRef, glyphID, success); -+} -+ -+inline le_int32 LookupSubtable::getGlyphCoverage(const LETableReference &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const { -+ LEReferenceTo<LookupSubtable> thisRef(base, success, this); -+ return getGlyphCoverage(thisRef, tableOffset, glyphID, success); - } - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/MarkArrays.h b/src/share/native/sun/font/layout/MarkArrays.h ---- jdk/src/share/native/sun/font/layout/MarkArrays.h -+++ jdk/src/share/native/sun/font/layout/MarkArrays.h -@@ -57,6 +57,7 @@ - le_int32 getMarkClass(LEGlyphID glyphID, le_int32 coverageIndex, const LEFontInstance *fontInstance, - LEPoint &anchor) const; - }; -+LE_VAR_ARRAY(MarkArray, markRecordArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp ---- jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp -@@ -51,10 +51,10 @@ - return 0xFFFF; - } - --le_int32 MarkToBasePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const -+le_int32 MarkToBasePositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const - { - LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); -- le_int32 markCoverage = getGlyphCoverage((LEGlyphID) markGlyph); -+ le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success); - - if (markCoverage < 0) { - // markGlyph isn't a covered mark glyph -@@ -75,7 +75,7 @@ - // FIXME: We probably don't want to find a base glyph before a previous ligature... - GlyphIterator baseIterator(*glyphIterator, (le_uint16) (lfIgnoreMarks /*| lfIgnoreLigatures*/)); - LEGlyphID baseGlyph = findBaseGlyph(&baseIterator); -- le_int32 baseCoverage = getBaseCoverage((LEGlyphID) baseGlyph); -+ le_int32 baseCoverage = getBaseCoverage(base, (LEGlyphID) baseGlyph, success); - const BaseArray *baseArray = (const BaseArray *) ((char *) this + SWAPW(baseArrayOffset)); - le_uint16 baseCount = SWAPW(baseArray->baseRecordCount); - -diff --git a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h ---- jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h -+++ jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h -@@ -48,7 +48,7 @@ - - struct MarkToBasePositioningSubtable : AttachmentPositioningSubtable - { -- le_int32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; -+ le_int32 process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const; - LEGlyphID findBaseGlyph(GlyphIterator *glyphIterator) const; - }; - -@@ -56,12 +56,14 @@ - { - Offset baseAnchorTableOffsetArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(BaseRecord, baseAnchorTableOffsetArray) - - struct BaseArray - { - le_int16 baseRecordCount; - BaseRecord baseRecordArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(BaseArray, baseRecordArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp ---- jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp -@@ -50,10 +50,10 @@ - return 0xFFFF; - } - --le_int32 MarkToLigaturePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const -+le_int32 MarkToLigaturePositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const - { - LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); -- le_int32 markCoverage = getGlyphCoverage((LEGlyphID) markGlyph); -+ le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success); - - if (markCoverage < 0) { - // markGlyph isn't a covered mark glyph -@@ -74,7 +74,7 @@ - // FIXME: we probably don't want to find a ligature before a previous base glyph... - GlyphIterator ligatureIterator(*glyphIterator, (le_uint16) (lfIgnoreMarks /*| lfIgnoreBaseGlyphs*/)); - LEGlyphID ligatureGlyph = findLigatureGlyph(&ligatureIterator); -- le_int32 ligatureCoverage = getBaseCoverage((LEGlyphID) ligatureGlyph); -+ le_int32 ligatureCoverage = getBaseCoverage(base, (LEGlyphID) ligatureGlyph, success); - const LigatureArray *ligatureArray = (const LigatureArray *) ((char *) this + SWAPW(baseArrayOffset)); - le_uint16 ligatureCount = SWAPW(ligatureArray->ligatureCount); - -diff --git a/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h b/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h ---- jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h -+++ jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h -@@ -48,7 +48,7 @@ - - struct MarkToLigaturePositioningSubtable : AttachmentPositioningSubtable - { -- le_int32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; -+ le_int32 process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const; - LEGlyphID findLigatureGlyph(GlyphIterator *glyphIterator) const; - }; - -@@ -56,18 +56,21 @@ - { - Offset ligatureAnchorTableOffsetArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(ComponentRecord, ligatureAnchorTableOffsetArray) - - struct LigatureAttachTable - { - le_uint16 componentCount; - ComponentRecord componentRecordArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(LigatureAttachTable, componentRecordArray) - - struct LigatureArray - { - le_uint16 ligatureCount; - Offset ligatureAttachTableOffsetArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(LigatureArray, ligatureAttachTableOffsetArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp ---- jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp -@@ -51,10 +51,10 @@ - return 0xFFFF; - } - --le_int32 MarkToMarkPositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const -+le_int32 MarkToMarkPositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const - { - LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); -- le_int32 markCoverage = getGlyphCoverage((LEGlyphID) markGlyph); -+ le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success); - - if (markCoverage < 0) { - // markGlyph isn't a covered mark glyph -@@ -74,7 +74,7 @@ - - GlyphIterator mark2Iterator(*glyphIterator); - LEGlyphID mark2Glyph = findMark2Glyph(&mark2Iterator); -- le_int32 mark2Coverage = getBaseCoverage((LEGlyphID) mark2Glyph); -+ le_int32 mark2Coverage = getBaseCoverage(base, (LEGlyphID) mark2Glyph, success); - const Mark2Array *mark2Array = (const Mark2Array *) ((char *) this + SWAPW(baseArrayOffset)); - le_uint16 mark2Count = SWAPW(mark2Array->mark2RecordCount); - -diff --git a/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h b/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h ---- jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h -+++ jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h -@@ -48,7 +48,7 @@ - - struct MarkToMarkPositioningSubtable : AttachmentPositioningSubtable - { -- le_int32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; -+ le_int32 process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const; - LEGlyphID findMark2Glyph(GlyphIterator *glyphIterator) const; - }; - -@@ -56,12 +56,14 @@ - { - Offset mark2AnchorTableOffsetArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(Mark2Record, mark2AnchorTableOffsetArray) - - struct Mark2Array - { - le_uint16 mark2RecordCount; - Mark2Record mark2RecordArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(Mark2Array, mark2RecordArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/MorphTables.cpp b/src/share/native/sun/font/layout/MorphTables.cpp ---- jdk/src/share/native/sun/font/layout/MorphTables.cpp -+++ jdk/src/share/native/sun/font/layout/MorphTables.cpp -@@ -44,61 +44,61 @@ - - U_NAMESPACE_BEGIN - --void MorphTableHeader::process(LEGlyphStorage &glyphStorage) const -+void MorphTableHeader::process(const LETableReference &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const - { -- const ChainHeader *chainHeader = chains; -- le_uint32 chainCount = SWAPL(this->nChains); -+ le_uint32 chainCount = SWAPL(this->nChains); -+ LEReferenceTo<ChainHeader> chainHeader(base, success, chains); // moving header -+ LEReferenceToArrayOf<ChainHeader> chainHeaderArray(base, success, chains, chainCount); - le_uint32 chain; - -- for (chain = 0; chain < chainCount; chain += 1) { -+ for (chain = 0; LE_SUCCESS(success) && (chain < chainCount); chain += 1) { - FeatureFlags defaultFlags = SWAPL(chainHeader->defaultFlags); - le_uint32 chainLength = SWAPL(chainHeader->chainLength); - le_int16 nFeatureEntries = SWAPW(chainHeader->nFeatureEntries); - le_int16 nSubtables = SWAPW(chainHeader->nSubtables); -- const MorphSubtableHeader *subtableHeader = -- (const MorphSubtableHeader *)&chainHeader->featureTable[nFeatureEntries]; -+ LEReferenceTo<MorphSubtableHeader> subtableHeader = -+ LEReferenceTo<MorphSubtableHeader>(chainHeader,success, &(chainHeader->featureTable[nFeatureEntries])); - le_int16 subtable; - -- for (subtable = 0; subtable < nSubtables; subtable += 1) { -+ for (subtable = 0; LE_SUCCESS(success) && (subtable < nSubtables); subtable += 1) { - le_int16 length = SWAPW(subtableHeader->length); - SubtableCoverage coverage = SWAPW(subtableHeader->coverage); - FeatureFlags subtableFeatures = SWAPL(subtableHeader->subtableFeatures); - - // should check coverage more carefully... -- if ((coverage & scfVertical) == 0 && (subtableFeatures & defaultFlags) != 0) { -- subtableHeader->process(glyphStorage); -+ if ((coverage & scfVertical) == 0 && (subtableFeatures & defaultFlags) != 0 && LE_SUCCESS(success)) { -+ subtableHeader->process(subtableHeader, glyphStorage, success); - } - -- subtableHeader = (const MorphSubtableHeader *) ((char *)subtableHeader + length); -+ subtableHeader.addOffset(length, success); - } -- -- chainHeader = (const ChainHeader *)((char *)chainHeader + chainLength); -+ chainHeader.addOffset(chainLength, success); - } - } - --void MorphSubtableHeader::process(LEGlyphStorage &glyphStorage) const -+void MorphSubtableHeader::process(const LEReferenceTo<MorphSubtableHeader> &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const - { - SubtableProcessor *processor = NULL; - - switch (SWAPW(coverage) & scfTypeMask) - { - case mstIndicRearrangement: -- processor = new IndicRearrangementProcessor(this); -+ processor = new IndicRearrangementProcessor(base, success); - break; - - case mstContextualGlyphSubstitution: -- processor = new ContextualGlyphSubstitutionProcessor(this); -+ processor = new ContextualGlyphSubstitutionProcessor(base, success); - break; - - case mstLigatureSubstitution: -- processor = new LigatureSubstitutionProcessor(this); -+ processor = new LigatureSubstitutionProcessor(base, success); - break; - - case mstReservedUnused: - break; - - case mstNonContextualGlyphSubstitution: -- processor = NonContextualGlyphSubstitutionProcessor::createInstance(this); -+ processor = NonContextualGlyphSubstitutionProcessor::createInstance(base, success); - break; - - /* -@@ -112,8 +112,10 @@ - } - - if (processor != NULL) { -- processor->process(glyphStorage); -- delete processor; -+ if(LE_SUCCESS(success)) { -+ processor->process(glyphStorage, success); -+ } -+ delete processor; - } - } - -diff --git a/src/share/native/sun/font/layout/MorphTables.h b/src/share/native/sun/font/layout/MorphTables.h ---- jdk/src/share/native/sun/font/layout/MorphTables.h -+++ jdk/src/share/native/sun/font/layout/MorphTables.h -@@ -39,6 +39,7 @@ - - #include "LETypes.h" - #include "LayoutTables.h" -+#include "LETableReference.h" - - U_NAMESPACE_BEGIN - -@@ -65,6 +66,7 @@ - le_int16 nSubtables; - FeatureTableEntry featureTable[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(ChainHeader, featureTable) - - struct MorphTableHeader - { -@@ -72,8 +74,9 @@ - le_uint32 nChains; - ChainHeader chains[ANY_NUMBER]; - -- void process(LEGlyphStorage &glyphStorage) const; -+ void process(const LETableReference& base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const; - }; -+LE_VAR_ARRAY(MorphTableHeader, chains) - - typedef le_int16 SubtableCoverage; - -@@ -102,7 +105,7 @@ - SubtableCoverage coverage; - FeatureFlags subtableFeatures; - -- void process(LEGlyphStorage &glyphStorage) const; -+ void process(const LEReferenceTo<MorphSubtableHeader> &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const; - }; - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp b/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp ---- jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp -@@ -39,7 +39,7 @@ - - U_NAMESPACE_BEGIN - --le_uint32 MultipleSubstitutionSubtable::process(GlyphIterator *glyphIterator, LEErrorCode& success, const LEGlyphFilter *filter) const -+le_uint32 MultipleSubstitutionSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, LEErrorCode& success, const LEGlyphFilter *filter) const - { - if (LE_FAILURE(success)) { - return 0; -@@ -58,7 +58,7 @@ - return 0; - } - -- le_int32 coverageIndex = getGlyphCoverage(glyph); -+ le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); - le_uint16 seqCount = SWAPW(sequenceCount); - - if (coverageIndex >= 0 && coverageIndex < seqCount) { -diff --git a/src/share/native/sun/font/layout/MultipleSubstSubtables.h b/src/share/native/sun/font/layout/MultipleSubstSubtables.h ---- jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h -+++ jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h -@@ -50,14 +50,16 @@ - le_uint16 glyphCount; - TTGlyphID substituteArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(SequenceTable, substituteArray) - - struct MultipleSubstitutionSubtable : GlyphSubstitutionSubtable - { - le_uint16 sequenceCount; - Offset sequenceTableOffsetArray[ANY_NUMBER]; - -- le_uint32 process(GlyphIterator *glyphIterator, LEErrorCode& success, const LEGlyphFilter *filter = NULL) const; -+ le_uint32 process(const LETableReference &base, GlyphIterator *glyphIterator, LEErrorCode& success, const LEGlyphFilter *filter = NULL) const; - }; -+LE_VAR_ARRAY(MultipleSubstitutionSubtable, sequenceTableOffsetArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp b/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp ---- jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp -+++ jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp -@@ -47,8 +47,8 @@ - { - } - --NonContextualGlyphSubstitutionProcessor::NonContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader) -- : SubtableProcessor(morphSubtableHeader) -+NonContextualGlyphSubstitutionProcessor::NonContextualGlyphSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) -+ : SubtableProcessor(morphSubtableHeader, success) - { - } - -@@ -56,26 +56,27 @@ - { - } - --SubtableProcessor *NonContextualGlyphSubstitutionProcessor::createInstance(const MorphSubtableHeader *morphSubtableHeader) -+SubtableProcessor *NonContextualGlyphSubstitutionProcessor::createInstance(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) - { -- const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader; -+ LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success); - -- switch (SWAPW(header->table.format)) -- { -+ if(LE_FAILURE(success)) return NULL; -+ -+ switch (SWAPW(header->table.format)) { - case ltfSimpleArray: -- return new SimpleArrayProcessor(morphSubtableHeader); -+ return new SimpleArrayProcessor(morphSubtableHeader, success); - - case ltfSegmentSingle: -- return new SegmentSingleProcessor(morphSubtableHeader); -+ return new SegmentSingleProcessor(morphSubtableHeader, success); - - case ltfSegmentArray: -- return new SegmentArrayProcessor(morphSubtableHeader); -+ return new SegmentArrayProcessor(morphSubtableHeader, success); - - case ltfSingleTable: -- return new SingleTableProcessor(morphSubtableHeader); -+ return new SingleTableProcessor(morphSubtableHeader, success); - - case ltfTrimmedArray: -- return new TrimmedArrayProcessor(morphSubtableHeader); -+ return new TrimmedArrayProcessor(morphSubtableHeader, success); - - default: - return NULL; -diff --git a/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h b/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h ---- jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h -+++ jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h -@@ -49,13 +49,13 @@ - class NonContextualGlyphSubstitutionProcessor : public SubtableProcessor - { - public: -- virtual void process(LEGlyphStorage &glyphStorage) = 0; -+ virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success) = 0; - -- static SubtableProcessor *createInstance(const MorphSubtableHeader *morphSubtableHeader); -+ static SubtableProcessor *createInstance(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success); - - protected: - NonContextualGlyphSubstitutionProcessor(); -- NonContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader); -+ NonContextualGlyphSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &status); - - virtual ~NonContextualGlyphSubstitutionProcessor(); - -diff --git a/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp b/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp -@@ -101,25 +101,21 @@ - static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap); - - OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success) -+ le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success) - : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success), fFeatureMask(minimalFeatures), - fFeatureMap(featureMap), fFeatureMapCount(featureMapCount), fFeatureOrder(FALSE), -- fGSUBTable(gsubTable), fGDEFTable(NULL), fGPOSTable(NULL), fSubstitutionFilter(NULL) -+ fGSUBTable(gsubTable), -+ fGDEFTable(fontInstance, LE_GDEF_TABLE_TAG, success), -+ fGPOSTable(fontInstance, LE_GPOS_TABLE_TAG, success), fSubstitutionFilter(NULL) - { -- static const le_uint32 gdefTableTag = LE_GDEF_TABLE_TAG; -- static const le_uint32 gposTableTag = LE_GPOS_TABLE_TAG; -- const GlyphPositioningTableHeader *gposTable = (const GlyphPositioningTableHeader *) getFontTable(gposTableTag); -- - applyTypoFlags(); - - setScriptAndLanguageTags(); - -- fGDEFTable = (const GlyphDefinitionTableHeader *) getFontTable(gdefTableTag); -- - // JK patch, 2008-05-30 - see Sinhala bug report and LKLUG font - // if (gposTable != NULL && gposTable->coversScriptAndLanguage(fScriptTag, fLangSysTag)) { -- if (gposTable != NULL && gposTable->coversScript(fScriptTag)) { -- fGPOSTable = gposTable; -+ if (!fGPOSTable.isEmpty()&& !fGPOSTable->coversScript(fGPOSTable, fScriptTag, success)) { -+ fGPOSTable.clear(); // already loaded - } - } - -@@ -154,7 +150,7 @@ - OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, - le_int32 typoFlags, LEErrorCode &success) - : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success), fFeatureOrder(FALSE), -- fGSUBTable(NULL), fGDEFTable(NULL), fGPOSTable(NULL), fSubstitutionFilter(NULL) -+ fGSUBTable(), fGDEFTable(), fGPOSTable(), fSubstitutionFilter(NULL) - { - applyTypoFlags(); - setScriptAndLanguageTags(); -@@ -276,13 +272,13 @@ - return 0; - } - -- if (fGSUBTable != NULL) { -- if (fScriptTagV2 != nullScriptTag && fGSUBTable->coversScriptAndLanguage(fScriptTagV2,fLangSysTag)) { -- count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTagV2, fLangSysTag, fGDEFTable, fSubstitutionFilter, -+ if (fGSUBTable.isValid()) { -+ if (fScriptTagV2 != nullScriptTag && fGSUBTable->coversScriptAndLanguage(fGSUBTable, fScriptTagV2, fLangSysTag, success)) { -+ count = fGSUBTable->process(fGSUBTable, glyphStorage, rightToLeft, fScriptTagV2, fLangSysTag, fGDEFTable, fSubstitutionFilter, - fFeatureMap, fFeatureMapCount, fFeatureOrder, success); - - } else { -- count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter, -+ count = fGSUBTable->process(fGSUBTable, glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter, - fFeatureMap, fFeatureMapCount, fFeatureOrder, success); - } - } -@@ -303,13 +299,13 @@ - return 0; - } - -- if (fGSUBTable != NULL) { -- if (fScriptTagV2 != nullScriptTag && fGSUBTable->coversScriptAndLanguage(fScriptTagV2,fLangSysTag)) { -- count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTagV2, fLangSysTag, fGDEFTable, fSubstitutionFilter, -+ if (fGSUBTable.isValid()) { -+ if (fScriptTagV2 != nullScriptTag && fGSUBTable->coversScriptAndLanguage(fGSUBTable,fScriptTagV2,fLangSysTag,success)) { -+ count = fGSUBTable->process(fGSUBTable, glyphStorage, rightToLeft, fScriptTagV2, fLangSysTag, fGDEFTable, fSubstitutionFilter, - fFeatureMap, fFeatureMapCount, fFeatureOrder, success); - - } else { -- count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter, -+ count = fGSUBTable->process(fGSUBTable, glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter, - fFeatureMap, fFeatureMapCount, fFeatureOrder, success); - } - } -@@ -387,7 +383,7 @@ - return; - } - -- if (fGPOSTable != NULL) { -+ if (!fGPOSTable.isEmpty()) { - GlyphPositionAdjustments *adjustments = new GlyphPositionAdjustments(glyphCount); - le_int32 i; - -@@ -410,19 +406,20 @@ - } - #endif - -- if (fGPOSTable != NULL) { -- if (fScriptTagV2 != nullScriptTag && fGPOSTable->coversScriptAndLanguage(fScriptTagV2,fLangSysTag)) { -- fGPOSTable->process(glyphStorage, adjustments, reverse, fScriptTagV2, fLangSysTag, fGDEFTable, success, fFontInstance, -- fFeatureMap, fFeatureMapCount, fFeatureOrder); -+ if (!fGPOSTable.isEmpty()) { -+ if (fScriptTagV2 != nullScriptTag && -+ fGPOSTable->coversScriptAndLanguage(fGPOSTable, fScriptTagV2,fLangSysTag,success)) { -+ fGPOSTable->process(fGPOSTable, glyphStorage, adjustments, reverse, fScriptTagV2, fLangSysTag, -+ fGDEFTable, success, fFontInstance, fFeatureMap, fFeatureMapCount, fFeatureOrder); - - } else { -- fGPOSTable->process(glyphStorage, adjustments, reverse, fScriptTag, fLangSysTag, fGDEFTable, success, fFontInstance, -- fFeatureMap, fFeatureMapCount, fFeatureOrder); -+ fGPOSTable->process(fGPOSTable, glyphStorage, adjustments, reverse, fScriptTag, fLangSysTag, -+ fGDEFTable, success, fFontInstance, fFeatureMap, fFeatureMapCount, fFeatureOrder); - } -- } else if ( fTypoFlags & 0x1 ) { -- static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG; -- KernTable kt(fFontInstance, getFontTable(kernTableTag)); -- kt.process(glyphStorage); -+ } else if (fTypoFlags & LE_Kerning_FEATURE_FLAG) { /* kerning enabled */ -+ LETableReference kernTable(fFontInstance, LE_KERN_TABLE_TAG, success); -+ KernTable kt(kernTable, success); -+ kt.process(glyphStorage, success); - } - - float xAdjust = 0, yAdjust = 0; -diff --git a/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h b/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h ---- jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h -+++ jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h -@@ -35,6 +35,7 @@ - #include "LEGlyphFilter.h" - #include "LEFontInstance.h" - #include "LayoutEngine.h" -+#include "LETableReference.h" - - #include "GlyphSubstitutionTables.h" - #include "GlyphDefinitionTables.h" -@@ -88,7 +89,7 @@ - * @internal - */ - OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success); -+ le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success); - - /** - * This constructor is used when the font requires a "canned" GSUB table which can't be known -@@ -228,21 +229,21 @@ - * - * @internal - */ -- const GlyphSubstitutionTableHeader *fGSUBTable; -+ LEReferenceTo<GlyphSubstitutionTableHeader> fGSUBTable; - - /** - * The address of the GDEF table. - * - * @internal - */ -- const GlyphDefinitionTableHeader *fGDEFTable; -+ LEReferenceTo<GlyphDefinitionTableHeader> fGDEFTable; - - /** - * The address of the GPOS table. - * - * @internal - */ -- const GlyphPositioningTableHeader *fGPOSTable; -+ LEReferenceTo<GlyphPositioningTableHeader> fGPOSTable; - - /** - * An optional filter used to inhibit substitutions -diff --git a/src/share/native/sun/font/layout/OpenTypeTables.h b/src/share/native/sun/font/layout/OpenTypeTables.h ---- jdk/src/share/native/sun/font/layout/OpenTypeTables.h -+++ jdk/src/share/native/sun/font/layout/OpenTypeTables.h -@@ -38,6 +38,7 @@ - */ - - #include "LETypes.h" -+#include "LETableReference.h" - - U_NAMESPACE_BEGIN - -@@ -50,7 +51,7 @@ - #define LE_GLYPH_GROUP_MASK 0x00000001UL - typedef le_uint32 FeatureMask; - --#define SWAPT(atag) ((LETag) ((atag[0] << 24) + (atag[1] << 16) + (atag[2] << 8) + atag[3])) -+#define SWAPT(atag) ((LETag) (((atag[0]) << 24) + ((atag[1]) << 16) + ((atag[2]) << 8) + (atag[3]))) - - struct TagAndOffsetRecord - { -diff --git a/src/share/native/sun/font/layout/OpenTypeUtilities.cpp b/src/share/native/sun/font/layout/OpenTypeUtilities.cpp ---- jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp -+++ jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp -@@ -76,58 +76,74 @@ - return bit; - } - --Offset OpenTypeUtilities::getTagOffset(LETag tag, const TagAndOffsetRecord *records, le_int32 recordCount) -+ -+Offset OpenTypeUtilities::getTagOffset(LETag tag, const LEReferenceToArrayOf<TagAndOffsetRecord> &records, LEErrorCode &success) - { -- le_uint8 bit = highBit(recordCount); -- le_int32 power = 1 << bit; -- le_int32 extra = recordCount - power; -- le_int32 probe = power; -- le_int32 index = 0; -+ if(LE_FAILURE(success)) return 0; - -- if (SWAPT(records[extra].tag) <= tag) { -- index = extra; -+ le_uint32 recordCount = records.getCount(); -+ le_uint8 bit = highBit(recordCount); -+ le_int32 power = 1 << bit; -+ le_int32 extra = recordCount - power; -+ le_int32 probe = power; -+ le_int32 index = 0; -+ -+ { -+ const ATag &aTag = records.getAlias(extra,success)->tag; -+ if (SWAPT(aTag) <= tag) { -+ index = extra; - } -+ } - -- while (probe > (1 << 0)) { -- probe >>= 1; -+ while (probe > (1 << 0) && LE_SUCCESS(success)) { -+ probe >>= 1; - -- if (SWAPT(records[index + probe].tag) <= tag) { -- index += probe; -- } -+ { -+ const ATag &aTag = records.getAlias(index+probe,success)->tag; -+ if (SWAPT(aTag) <= tag) { -+ index += probe; -+ } - } -+ } - -- if (SWAPT(records[index].tag) == tag) { -- return SWAPW(records[index].offset); -+ { -+ const ATag &aTag = records.getAlias(index,success)->tag; -+ if (SWAPT(aTag) == tag) { -+ return SWAPW(records.getAlias(index,success)->offset); - } -+ } - -- return 0; -+ return 0; - } - --le_int32 OpenTypeUtilities::getGlyphRangeIndex(TTGlyphID glyphID, const GlyphRangeRecord *records, le_int32 recordCount) -+le_int32 OpenTypeUtilities::getGlyphRangeIndex(TTGlyphID glyphID, const LEReferenceToArrayOf<GlyphRangeRecord> &records, LEErrorCode &success) - { -+ if(LE_FAILURE(success)) return -1; -+ -+ le_uint32 recordCount = records.getCount(); - le_uint8 bit = highBit(recordCount); - le_int32 power = 1 << bit; - le_int32 extra = recordCount - power; - le_int32 probe = power; - le_int32 range = 0; - -- if (recordCount == 0) { -- return -1; -- } -+ if (recordCount == 0) { -+ return -1; -+ } - -- if (SWAPW(records[extra].firstGlyph) <= glyphID) { -+ if (SWAPW(records(extra,success).firstGlyph) <= glyphID) { - range = extra; - } - -- while (probe > (1 << 0)) { -+ while (probe > (1 << 0) && LE_SUCCESS(success)) { - probe >>= 1; - -- if (SWAPW(records[range + probe].firstGlyph) <= glyphID) { -+ if (SWAPW(records(range + probe,success).firstGlyph) <= glyphID) { - range += probe; - } - } - -- if (SWAPW(records[range].firstGlyph) <= glyphID && SWAPW(records[range].lastGlyph) >= glyphID) { -+ if (SWAPW(records(range,success).firstGlyph) <= glyphID && SWAPW(records(range,success).lastGlyph) >= glyphID) { - return range; - } - -@@ -199,6 +215,38 @@ - } - } - -+U_NAMESPACE_END - -+#if LE_ASSERT_BAD_FONT -+#include <stdio.h> - --U_NAMESPACE_END -+static const char *letagToStr(LETag tag, char *str) { -+ str[0]= 0xFF & (tag>>24); -+ str[1]= 0xFF & (tag>>16); -+ str[2]= 0xFF & (tag>>8); -+ str[3]= 0xFF & (tag>>0); -+ str[4]= 0; -+ return str; -+} -+ -+U_CAPI void U_EXPORT2 _debug_LETableReference(const char *f, int l, const char *msg, const LETableReference *what, const void *ptr, size_t len) { -+ char tagbuf[5]; -+ -+ fprintf(stderr, "%s:%d: LETableReference@0x%p: ", f, l, what); -+ fprintf(stderr, msg, ptr, len); -+ fprintf(stderr, "\n"); -+ -+ for(int depth=0;depth<10&&(what!=NULL);depth++) { -+ for(int i=0;i<depth;i++) { -+ fprintf(stderr, " "); // indent -+ } -+ if(!what->isValid()) { -+ fprintf(stderr, "(invalid)"); -+ } -+ fprintf(stderr, "@%p: tag (%s) font (0x%p), [0x%p+0x%lx]\n", what, letagToStr(what->getTag(), tagbuf), what->getFont(), -+ what->getAlias(), what->getLength()); -+ -+ what = what->getParent(); -+ } -+} -+#endif -diff --git a/src/share/native/sun/font/layout/OpenTypeUtilities.h b/src/share/native/sun/font/layout/OpenTypeUtilities.h ---- jdk/src/share/native/sun/font/layout/OpenTypeUtilities.h -+++ jdk/src/share/native/sun/font/layout/OpenTypeUtilities.h -@@ -45,8 +45,17 @@ - class OpenTypeUtilities /* not : public UObject because all methods are static */ { - public: - static le_int8 highBit(le_int32 value); -- static Offset getTagOffset(LETag tag, const TagAndOffsetRecord *records, le_int32 recordCount); -- static le_int32 getGlyphRangeIndex(TTGlyphID glyphID, const GlyphRangeRecord *records, le_int32 recordCount); -+ static Offset getTagOffset(LETag tag, const LEReferenceToArrayOf<TagAndOffsetRecord> &records, LEErrorCode &success); -+ /** -+ * @deprecated TODO remove -+ */ -+ static le_int32 getGlyphRangeIndex(TTGlyphID glyphID, const GlyphRangeRecord *records, le_int32 recordCount) { -+ LEErrorCode success = LE_NO_ERROR; -+ LETableReference recordRef0((const le_uint8*)records); -+ LEReferenceToArrayOf<GlyphRangeRecord> recordRef(recordRef0, success, (size_t)0, recordCount); -+ return getGlyphRangeIndex(glyphID, recordRef, success); -+ } -+ static le_int32 getGlyphRangeIndex(TTGlyphID glyphID, const LEReferenceToArrayOf<GlyphRangeRecord> &records, LEErrorCode &success); - static le_int32 search(le_uint16 value, const le_uint16 array[], le_int32 count); - static le_int32 search(le_uint32 value, const le_uint32 array[], le_int32 count); - static void sort(le_uint16 *array, le_int32 count); -diff --git a/src/share/native/sun/font/layout/PairPositioningSubtables.cpp b/src/share/native/sun/font/layout/PairPositioningSubtables.cpp ---- jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp -@@ -41,7 +41,7 @@ - - U_NAMESPACE_BEGIN - --le_uint32 PairPositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const -+le_uint32 PairPositioningSubtable::process(const LEReferenceTo<PairPositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const - { - switch(SWAPW(subtableFormat)) - { -@@ -50,27 +50,32 @@ - - case 1: - { -- const PairPositioningFormat1Subtable *subtable = (const PairPositioningFormat1Subtable *) this; -+ const LEReferenceTo<PairPositioningFormat1Subtable> subtable(base, success, (const PairPositioningFormat1Subtable *) this); - -- return subtable->process(glyphIterator, fontInstance); -+ if(LE_SUCCESS(success)) -+ return subtable->process(subtable, glyphIterator, fontInstance, success); -+ else -+ return 0; - } - - case 2: - { -- const PairPositioningFormat2Subtable *subtable = (const PairPositioningFormat2Subtable *) this; -+ const LEReferenceTo<PairPositioningFormat2Subtable> subtable(base, success, (const PairPositioningFormat2Subtable *) this); - -- return subtable->process(glyphIterator, fontInstance); -+ if(LE_SUCCESS(success)) -+ return subtable->process(subtable, glyphIterator, fontInstance, success); -+ else -+ return 0; - } -- - default: -- return 0; -+ return 0; - } - } - --le_uint32 PairPositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const -+le_uint32 PairPositioningFormat1Subtable::process(const LEReferenceTo<PairPositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const - { - LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(firstGlyph); -+ le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success); - GlyphIterator tempIterator(*glyphIterator); - - if (coverageIndex >= 0 && glyphIterator->next()) { -@@ -110,10 +115,10 @@ - return 0; - } - --le_uint32 PairPositioningFormat2Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const -+le_uint32 PairPositioningFormat2Subtable::process(const LEReferenceTo<PairPositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const - { - LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(firstGlyph); -+ le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success); - GlyphIterator tempIterator(*glyphIterator); - - if (coverageIndex >= 0 && glyphIterator->next()) { -diff --git a/src/share/native/sun/font/layout/PairPositioningSubtables.h b/src/share/native/sun/font/layout/PairPositioningSubtables.h ---- jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h -+++ jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h -@@ -59,13 +59,14 @@ - le_uint16 pairValueCount; - PairValueRecord pairValueRecordArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(PairSetTable, pairValueRecordArray) - - struct PairPositioningSubtable : GlyphPositioningSubtable - { - ValueFormat valueFormat1; - ValueFormat valueFormat2; - -- le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; -+ le_uint32 process(const LEReferenceTo<PairPositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const; - }; - - struct PairPositioningFormat1Subtable : PairPositioningSubtable -@@ -73,12 +74,13 @@ - le_uint16 pairSetCount; - Offset pairSetTableOffsetArray[ANY_NUMBER]; - -- le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; -+ le_uint32 process(const LEReferenceTo<PairPositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const; - - private: - const PairValueRecord *findPairValueRecord(TTGlyphID glyphID, const PairValueRecord *records, - le_uint16 recordCount, le_uint16 recordSize) const; - }; -+LE_VAR_ARRAY(PairPositioningFormat1Subtable, pairSetTableOffsetArray) - - // NOTE: ValueRecord has a variable size - struct Class2Record -@@ -91,6 +93,7 @@ - { - Class2Record class2RecordArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(Class1Record, class2RecordArray) - - struct PairPositioningFormat2Subtable : PairPositioningSubtable - { -@@ -100,8 +103,9 @@ - le_uint16 class2Count; - Class1Record class1RecordArray[ANY_NUMBER]; - -- le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; -+ le_uint32 process(const LEReferenceTo<PairPositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const; - }; -+LE_VAR_ARRAY(PairPositioningFormat2Subtable, class1RecordArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/ScriptAndLanguage.cpp b/src/share/native/sun/font/layout/ScriptAndLanguage.cpp ---- jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp -+++ jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp -@@ -38,29 +38,33 @@ - - U_NAMESPACE_BEGIN - --const LangSysTable *ScriptTable::findLanguage(LETag languageTag, le_bool exactMatch) const -+LEReferenceTo<LangSysTable> ScriptTable::findLanguage(const LETableReference& base, LETag languageTag, LEErrorCode &success, le_bool exactMatch) const - { - le_uint16 count = SWAPW(langSysCount); - Offset langSysTableOffset = exactMatch? 0 : SWAPW(defaultLangSysTableOffset); - - if (count > 0) { -- Offset foundOffset = -- OpenTypeUtilities::getTagOffset(languageTag, langSysRecordArray, count); -+ LEReferenceToArrayOf<TagAndOffsetRecord> langSysRecords(base, success, langSysRecordArray, count); -+ Offset foundOffset = -+ OpenTypeUtilities::getTagOffset(languageTag, langSysRecords, success); - -- if (foundOffset != 0) { -- langSysTableOffset = foundOffset; -- } -+ if (foundOffset != 0 && LE_SUCCESS(success)) { -+ langSysTableOffset = foundOffset; -+ } - } - - if (langSysTableOffset != 0) { -- return (const LangSysTable *) ((char *)this + langSysTableOffset); -+ return LEReferenceTo<LangSysTable>(base, success, langSysTableOffset); - } - -- return NULL; -+ return LEReferenceTo<LangSysTable>(); - } - --const ScriptTable *ScriptListTable::findScript(LETag scriptTag) const -+LEReferenceTo<ScriptTable> ScriptListTable::findScript(const LETableReference &base, LETag scriptTag, LEErrorCode &success) const - { -+ if (LE_FAILURE(success) ) { -+ return LEReferenceTo<ScriptTable>(); // get out -+ } - /* - * There are some fonts that have a large, bogus value for scriptCount. To try - * and protect against this, we use the offset in the first scriptRecord, -@@ -74,38 +78,53 @@ - * to be unsorted. - */ - le_uint16 count = SWAPW(scriptCount); -+ -+ if (count == 0) { -+ return LEReferenceTo<ScriptTable>(); // no items, no search -+ } -+ -+ // attempt to construct a ref with at least one element -+ LEReferenceToArrayOf<ScriptRecord> oneElementTable(base, success, &scriptRecordArray[0], 1); -+ -+ if( LE_FAILURE(success) ) { -+ return LEReferenceTo<ScriptTable>(); // couldn't even read the first record - bad font. -+ } -+ - le_uint16 limit = ((SWAPW(scriptRecordArray[0].offset) - sizeof(ScriptListTable)) / sizeof(scriptRecordArray)) + ANY_NUMBER; - Offset scriptTableOffset = 0; - -+ - if (count > limit) { - // the scriptCount value is bogus; do a linear search - // because limit may still be too large. -- for(le_int32 s = 0; s < limit; s += 1) { -- if (SWAPT(scriptRecordArray[s].tag) == scriptTag) { -- scriptTableOffset = SWAPW(scriptRecordArray[s].offset); -- break; -- } -+ LEReferenceToArrayOf<ScriptRecord> scriptRecordArrayRef(base, success, &scriptRecordArray[0], limit); -+ for(le_int32 s = 0; (s < limit)&&LE_SUCCESS(success); s += 1) { -+ if (SWAPT(scriptRecordArrayRef(s,success).tag) == scriptTag) { -+ scriptTableOffset = SWAPW(scriptRecordArrayRef(s,success).offset); -+ break; -+ } - } - } else { -- scriptTableOffset = OpenTypeUtilities::getTagOffset(scriptTag, scriptRecordArray, count); -+ LEReferenceToArrayOf<ScriptRecord> scriptRecordArrayRef(base, success, &scriptRecordArray[0], count); -+ scriptTableOffset = OpenTypeUtilities::getTagOffset(scriptTag, scriptRecordArrayRef, success); // TODO - } - - if (scriptTableOffset != 0) { -- return (const ScriptTable *) ((char *)this + scriptTableOffset); -+ return LEReferenceTo<ScriptTable>(base, success, scriptTableOffset); - } - -- return NULL; -+ return LEReferenceTo<ScriptTable>(); - } - --const LangSysTable *ScriptListTable::findLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch) const -+LEReferenceTo<LangSysTable> ScriptListTable::findLanguage(const LETableReference &base, LETag scriptTag, LETag languageTag, LEErrorCode &success, le_bool exactMatch) const - { -- const ScriptTable *scriptTable = findScript(scriptTag); -+ const LEReferenceTo<ScriptTable> scriptTable = findScript(base, scriptTag, success); - -- if (scriptTable == 0) { -- return NULL; -- } -+ if (scriptTable.isEmpty()) { -+ return LEReferenceTo<LangSysTable>(); -+ } - -- return scriptTable->findLanguage(languageTag, exactMatch); -+ return scriptTable->findLanguage(scriptTable, languageTag, success, exactMatch).reparent(base); - } - - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/ScriptAndLanguage.h b/src/share/native/sun/font/layout/ScriptAndLanguage.h ---- jdk/src/share/native/sun/font/layout/ScriptAndLanguage.h -+++ jdk/src/share/native/sun/font/layout/ScriptAndLanguage.h -@@ -51,6 +51,7 @@ - le_uint16 featureCount; - le_uint16 featureIndexArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(LangSysTable, featureIndexArray) - - struct ScriptTable - { -@@ -58,8 +59,9 @@ - le_uint16 langSysCount; - LangSysRecord langSysRecordArray[ANY_NUMBER]; - -- const LangSysTable *findLanguage(LETag languageTag, le_bool exactMatch = FALSE) const; -+ LEReferenceTo<LangSysTable> findLanguage(const LETableReference &base, LETag languageTag, LEErrorCode &success, le_bool exactMatch = FALSE) const; - }; -+LE_VAR_ARRAY(ScriptTable, langSysRecordArray) - - typedef TagAndOffsetRecord ScriptRecord; - -@@ -68,9 +70,10 @@ - le_uint16 scriptCount; - ScriptRecord scriptRecordArray[ANY_NUMBER]; - -- const ScriptTable *findScript(LETag scriptTag) const; -- const LangSysTable *findLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch = FALSE) const; -+ LEReferenceTo<ScriptTable> findScript(const LETableReference &base, LETag scriptTag, LEErrorCode &success) const; -+ LEReferenceTo<LangSysTable> findLanguage(const LETableReference &base, LETag scriptTag, LETag languageTag, LEErrorCode &success, le_bool exactMatch = FALSE) const; - }; -+LE_VAR_ARRAY(ScriptListTable, scriptRecordArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp b/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp ---- jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp -+++ jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp -@@ -46,19 +46,18 @@ - { - } - --SegmentArrayProcessor::SegmentArrayProcessor(const MorphSubtableHeader *morphSubtableHeader) -- : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader) -+SegmentArrayProcessor::SegmentArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) -+ : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success) - { -- const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader; -- -- segmentArrayLookupTable = (const SegmentArrayLookupTable *) &header->table; -+ LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success); -+ segmentArrayLookupTable = LEReferenceTo<SegmentArrayLookupTable>(morphSubtableHeader, success, (const SegmentArrayLookupTable*)&header->table); - } - - SegmentArrayProcessor::~SegmentArrayProcessor() - { - } - --void SegmentArrayProcessor::process(LEGlyphStorage &glyphStorage) -+void SegmentArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) - { - const LookupSegment *segments = segmentArrayLookupTable->segments; - le_int32 glyphCount = glyphStorage.getGlyphCount(); -@@ -66,17 +65,16 @@ - - for (glyph = 0; glyph < glyphCount; glyph += 1) { - LEGlyphID thisGlyph = glyphStorage[glyph]; -- const LookupSegment *lookupSegment = segmentArrayLookupTable->lookupSegment(segments, thisGlyph); -+ const LookupSegment *lookupSegment = segmentArrayLookupTable->lookupSegment(segmentArrayLookupTable, segments, thisGlyph, success); - - if (lookupSegment != NULL) { - TTGlyphID firstGlyph = SWAPW(lookupSegment->firstGlyph); - le_int16 offset = SWAPW(lookupSegment->value); - - if (offset != 0) { -- TTGlyphID *glyphArray = (TTGlyphID *) ((char *) subtableHeader + offset); -- TTGlyphID newGlyph = SWAPW(glyphArray[LE_GET_GLYPH(thisGlyph) - firstGlyph]); -- -- glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); -+ LEReferenceToArrayOf<TTGlyphID> glyphArray(subtableHeader, success, offset, LE_UNBOUNDED_ARRAY); -+ TTGlyphID newGlyph = SWAPW(glyphArray(LE_GET_GLYPH(thisGlyph) - firstGlyph, success)); -+ glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); - } - } - } -diff --git a/src/share/native/sun/font/layout/SegmentArrayProcessor.h b/src/share/native/sun/font/layout/SegmentArrayProcessor.h ---- jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.h -+++ jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.h -@@ -50,9 +50,9 @@ - class SegmentArrayProcessor : public NonContextualGlyphSubstitutionProcessor - { - public: -- virtual void process(LEGlyphStorage &glyphStorage); -+ virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); - -- SegmentArrayProcessor(const MorphSubtableHeader *morphSubtableHeader); -+ SegmentArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success); - - virtual ~SegmentArrayProcessor(); - -@@ -74,7 +74,7 @@ - SegmentArrayProcessor(); - - protected: -- const SegmentArrayLookupTable *segmentArrayLookupTable; -+ LEReferenceTo<SegmentArrayLookupTable> segmentArrayLookupTable; - - }; - -diff --git a/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp b/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp ---- jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp -+++ jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp -@@ -46,29 +46,28 @@ - { - } - --SegmentSingleProcessor::SegmentSingleProcessor(const MorphSubtableHeader *morphSubtableHeader) -- : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader) -+SegmentSingleProcessor::SegmentSingleProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) -+ : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success) - { -- const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader; -- -- segmentSingleLookupTable = (const SegmentSingleLookupTable *) &header->table; -+ LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success); -+ segmentSingleLookupTable = LEReferenceTo<SegmentSingleLookupTable>(morphSubtableHeader, success, (const SegmentSingleLookupTable*)&header->table); - } - - SegmentSingleProcessor::~SegmentSingleProcessor() - { - } - --void SegmentSingleProcessor::process(LEGlyphStorage &glyphStorage) -+void SegmentSingleProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) - { - const LookupSegment *segments = segmentSingleLookupTable->segments; - le_int32 glyphCount = glyphStorage.getGlyphCount(); - le_int32 glyph; - -- for (glyph = 0; glyph < glyphCount; glyph += 1) { -+ for (glyph = 0; glyph < glyphCount && LE_SUCCESS(success); glyph += 1) { - LEGlyphID thisGlyph = glyphStorage[glyph]; -- const LookupSegment *lookupSegment = segmentSingleLookupTable->lookupSegment(segments, thisGlyph); -+ const LookupSegment *lookupSegment = segmentSingleLookupTable->lookupSegment(segmentSingleLookupTable, segments, thisGlyph, success); - -- if (lookupSegment != NULL) { -+ if (lookupSegment != NULL && LE_SUCCESS(success)) { - TTGlyphID newGlyph = (TTGlyphID) LE_GET_GLYPH(thisGlyph) + SWAPW(lookupSegment->value); - - glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); -diff --git a/src/share/native/sun/font/layout/SegmentSingleProcessor.h b/src/share/native/sun/font/layout/SegmentSingleProcessor.h ---- jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.h -+++ jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.h -@@ -50,9 +50,9 @@ - class SegmentSingleProcessor : public NonContextualGlyphSubstitutionProcessor - { - public: -- virtual void process(LEGlyphStorage &glyphStorage); -+ virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); - -- SegmentSingleProcessor(const MorphSubtableHeader *morphSubtableHeader); -+ SegmentSingleProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success); - - virtual ~SegmentSingleProcessor(); - -@@ -74,7 +74,7 @@ - SegmentSingleProcessor(); - - protected: -- const SegmentSingleLookupTable *segmentSingleLookupTable; -+ LEReferenceTo<SegmentSingleLookupTable> segmentSingleLookupTable; - - }; - -diff --git a/src/share/native/sun/font/layout/ShapingTypeData.cpp b/src/share/native/sun/font/layout/ShapingTypeData.cpp ---- jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp -+++ jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp -@@ -122,4 +122,6 @@ - 0x00, 0x05, 0xFE, 0xFF, 0xFE, 0xFF, 0x00, 0x05, 0xFF, 0xF9, 0xFF, 0xFB, 0x00, 0x05 - }; - -+const size_t ArabicShaping::shapingTypeTableLen = sizeof(shapingTypeTable)/sizeof(shapingTypeTable[0]); -+ - U_NAMESPACE_END -diff --git a/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp b/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp ---- jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp -+++ jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp -@@ -46,29 +46,29 @@ - { - } - --SimpleArrayProcessor::SimpleArrayProcessor(const MorphSubtableHeader *morphSubtableHeader) -- : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader) -+SimpleArrayProcessor::SimpleArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) -+ : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success) - { -- const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader; -- -- simpleArrayLookupTable = (const SimpleArrayLookupTable *) &header->table; -+ LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success); -+ simpleArrayLookupTable = LEReferenceTo<SimpleArrayLookupTable>(morphSubtableHeader, success, (const SimpleArrayLookupTable*)&header->table); - } - - SimpleArrayProcessor::~SimpleArrayProcessor() - { - } - --void SimpleArrayProcessor::process(LEGlyphStorage &glyphStorage) -+void SimpleArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) - { - le_int32 glyphCount = glyphStorage.getGlyphCount(); - le_int32 glyph; - -- for (glyph = 0; glyph < glyphCount; glyph += 1) { -+ LEReferenceToArrayOf<LookupValue> valueArray(simpleArrayLookupTable, success, (const LookupValue*)&simpleArrayLookupTable->valueArray, LE_UNBOUNDED_ARRAY); -+ -+ for (glyph = 0; LE_SUCCESS(success) && (glyph < glyphCount); glyph += 1) { - LEGlyphID thisGlyph = glyphStorage[glyph]; - if (LE_GET_GLYPH(thisGlyph) < 0xFFFF) { -- TTGlyphID newGlyph = SWAPW(simpleArrayLookupTable->valueArray[LE_GET_GLYPH(thisGlyph)]); -- -- glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); -+ TTGlyphID newGlyph = SWAPW(valueArray.getObject(LE_GET_GLYPH(thisGlyph),success)); -+ glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); - } - } - } -diff --git a/src/share/native/sun/font/layout/SimpleArrayProcessor.h b/src/share/native/sun/font/layout/SimpleArrayProcessor.h ---- jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.h -+++ jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.h -@@ -50,9 +50,9 @@ - class SimpleArrayProcessor : public NonContextualGlyphSubstitutionProcessor - { - public: -- virtual void process(LEGlyphStorage &glyphStorage); -+ virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); - -- SimpleArrayProcessor(const MorphSubtableHeader *morphSubtableHeader); -+ SimpleArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success); - - virtual ~SimpleArrayProcessor(); - -@@ -74,7 +74,7 @@ - SimpleArrayProcessor(); - - protected: -- const SimpleArrayLookupTable *simpleArrayLookupTable; -+ LEReferenceTo<SimpleArrayLookupTable> simpleArrayLookupTable; - - }; - -diff --git a/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp b/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp ---- jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp -@@ -40,7 +40,7 @@ - - U_NAMESPACE_BEGIN - --le_uint32 SinglePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const -+le_uint32 SinglePositioningSubtable::process(const LEReferenceTo<SinglePositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const - { - switch(SWAPW(subtableFormat)) - { -@@ -49,16 +49,16 @@ - - case 1: - { -- const SinglePositioningFormat1Subtable *subtable = (const SinglePositioningFormat1Subtable *) this; -+ const LEReferenceTo<SinglePositioningFormat1Subtable> subtable(base, success, (const SinglePositioningFormat1Subtable *) this); - -- return subtable->process(glyphIterator, fontInstance); -+ return subtable->process(subtable, glyphIterator, fontInstance, success); - } - - case 2: - { -- const SinglePositioningFormat2Subtable *subtable = (const SinglePositioningFormat2Subtable *) this; -+ const LEReferenceTo<SinglePositioningFormat2Subtable> subtable(base, success, (const SinglePositioningFormat2Subtable *) this); - -- return subtable->process(glyphIterator, fontInstance); -+ return subtable->process(subtable, glyphIterator, fontInstance, success); - } - - default: -@@ -66,10 +66,10 @@ - } - } - --le_uint32 SinglePositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const -+le_uint32 SinglePositioningFormat1Subtable::process(const LEReferenceTo<SinglePositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const - { - LEGlyphID glyph = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(glyph); -+ le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); - - if (coverageIndex >= 0) { - valueRecord.adjustPosition(SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance); -@@ -80,10 +80,10 @@ - return 0; - } - --le_uint32 SinglePositioningFormat2Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const -+le_uint32 SinglePositioningFormat2Subtable::process(const LEReferenceTo<SinglePositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const - { - LEGlyphID glyph = glyphIterator->getCurrGlyphID(); -- le_int16 coverageIndex = (le_int16) getGlyphCoverage(glyph); -+ le_int16 coverageIndex = (le_int16) getGlyphCoverage(base, glyph, success); - - if (coverageIndex >= 0) { - valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance); -diff --git a/src/share/native/sun/font/layout/SinglePositioningSubtables.h b/src/share/native/sun/font/layout/SinglePositioningSubtables.h ---- jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.h -+++ jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.h -@@ -48,7 +48,7 @@ - - struct SinglePositioningSubtable : GlyphPositioningSubtable - { -- le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; -+ le_uint32 process(const LEReferenceTo<SinglePositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const; - }; - - struct SinglePositioningFormat1Subtable : SinglePositioningSubtable -@@ -56,7 +56,7 @@ - ValueFormat valueFormat; - ValueRecord valueRecord; - -- le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; -+ le_uint32 process(const LEReferenceTo<SinglePositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const; - }; - - struct SinglePositioningFormat2Subtable : SinglePositioningSubtable -@@ -65,8 +65,9 @@ - le_uint16 valueCount; - ValueRecord valueRecordArray[ANY_NUMBER]; - -- le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; -+ le_uint32 process(const LEReferenceTo<SinglePositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const; - }; -+LE_VAR_ARRAY(SinglePositioningFormat2Subtable, valueRecordArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp b/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp ---- jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp -+++ jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp -@@ -39,7 +39,7 @@ - - U_NAMESPACE_BEGIN - --le_uint32 SingleSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const -+le_uint32 SingleSubstitutionSubtable::process(const LEReferenceTo<SingleSubstitutionSubtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const - { - switch(SWAPW(subtableFormat)) - { -@@ -48,16 +48,16 @@ - - case 1: - { -- const SingleSubstitutionFormat1Subtable *subtable = (const SingleSubstitutionFormat1Subtable *) this; -+ const LEReferenceTo<SingleSubstitutionFormat1Subtable> subtable(base, success, (const SingleSubstitutionFormat1Subtable *) this); - -- return subtable->process(glyphIterator, filter); -+ return subtable->process(subtable, glyphIterator, success, filter); - } - - case 2: - { -- const SingleSubstitutionFormat2Subtable *subtable = (const SingleSubstitutionFormat2Subtable *) this; -+ const LEReferenceTo<SingleSubstitutionFormat2Subtable> subtable(base, success, (const SingleSubstitutionFormat2Subtable *) this); - -- return subtable->process(glyphIterator, filter); -+ return subtable->process(subtable, glyphIterator, success, filter); - } - - default: -@@ -65,10 +65,10 @@ - } - } - --le_uint32 SingleSubstitutionFormat1Subtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const -+le_uint32 SingleSubstitutionFormat1Subtable::process(const LEReferenceTo<SingleSubstitutionFormat1Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const - { - LEGlyphID glyph = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(glyph); -+ le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); - - if (coverageIndex >= 0) { - TTGlyphID substitute = ((TTGlyphID) LE_GET_GLYPH(glyph)) + SWAPW(deltaGlyphID); -@@ -83,10 +83,10 @@ - return 0; - } - --le_uint32 SingleSubstitutionFormat2Subtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const -+le_uint32 SingleSubstitutionFormat2Subtable::process(const LEReferenceTo<SingleSubstitutionFormat2Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const - { - LEGlyphID glyph = glyphIterator->getCurrGlyphID(); -- le_int32 coverageIndex = getGlyphCoverage(glyph); -+ le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); - - if (coverageIndex >= 0) { - TTGlyphID substitute = SWAPW(substituteArray[coverageIndex]); -diff --git a/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h b/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h ---- jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h -+++ jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h -@@ -47,14 +47,14 @@ - - struct SingleSubstitutionSubtable : GlyphSubstitutionSubtable - { -- le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; -+ le_uint32 process(const LEReferenceTo<SingleSubstitutionSubtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter = NULL) const; - }; - - struct SingleSubstitutionFormat1Subtable : SingleSubstitutionSubtable - { - le_int16 deltaGlyphID; - -- le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; -+ le_uint32 process(const LEReferenceTo<SingleSubstitutionFormat1Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter = NULL) const; - }; - - struct SingleSubstitutionFormat2Subtable : SingleSubstitutionSubtable -@@ -62,8 +62,9 @@ - le_uint16 glyphCount; - TTGlyphID substituteArray[ANY_NUMBER]; - -- le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; -+ le_uint32 process(const LEReferenceTo<SingleSubstitutionFormat2Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter = NULL) const; - }; -+LE_VAR_ARRAY(SingleSubstitutionFormat2Subtable, substituteArray) - - U_NAMESPACE_END - #endif -diff --git a/src/share/native/sun/font/layout/SingleTableProcessor.cpp b/src/share/native/sun/font/layout/SingleTableProcessor.cpp ---- jdk/src/share/native/sun/font/layout/SingleTableProcessor.cpp -+++ jdk/src/share/native/sun/font/layout/SingleTableProcessor.cpp -@@ -46,26 +46,25 @@ - { - } - --SingleTableProcessor::SingleTableProcessor(const MorphSubtableHeader *moprhSubtableHeader) -- : NonContextualGlyphSubstitutionProcessor(moprhSubtableHeader) -+SingleTableProcessor::SingleTableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) -+ : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success) - { -- const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) moprhSubtableHeader; -- -- singleTableLookupTable = (const SingleTableLookupTable *) &header->table; -+ LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success); -+ singleTableLookupTable = LEReferenceTo<SingleTableLookupTable>(morphSubtableHeader, success, (const SingleTableLookupTable*)&header->table); - } - - SingleTableProcessor::~SingleTableProcessor() - { - } - --void SingleTableProcessor::process(LEGlyphStorage &glyphStorage) -+void SingleTableProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) - { - const LookupSingle *entries = singleTableLookupTable->entries; - le_int32 glyph; - le_int32 glyphCount = glyphStorage.getGlyphCount(); - - for (glyph = 0; glyph < glyphCount; glyph += 1) { -- const LookupSingle *lookupSingle = singleTableLookupTable->lookupSingle(entries, glyphStorage[glyph]); -+ const LookupSingle *lookupSingle = singleTableLookupTable->lookupSingle(singleTableLookupTable, entries, glyphStorage[glyph], success); - - if (lookupSingle != NULL) { - glyphStorage[glyph] = SWAPW(lookupSingle->value); -diff --git a/src/share/native/sun/font/layout/SingleTableProcessor.h b/src/share/native/sun/font/layout/SingleTableProcessor.h ---- jdk/src/share/native/sun/font/layout/SingleTableProcessor.h -+++ jdk/src/share/native/sun/font/layout/SingleTableProcessor.h -@@ -50,9 +50,9 @@ - class SingleTableProcessor : public NonContextualGlyphSubstitutionProcessor - { - public: -- virtual void process(LEGlyphStorage &glyphStorage); -+ virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); - -- SingleTableProcessor(const MorphSubtableHeader *morphSubtableHeader); -+ SingleTableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success); - - virtual ~SingleTableProcessor(); - -@@ -74,7 +74,7 @@ - SingleTableProcessor(); - - protected: -- const SingleTableLookupTable *singleTableLookupTable; -+ LEReferenceTo<SingleTableLookupTable> singleTableLookupTable; - - }; - -diff --git a/src/share/native/sun/font/layout/StateTableProcessor.cpp b/src/share/native/sun/font/layout/StateTableProcessor.cpp ---- jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp -+++ jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp -@@ -44,17 +44,18 @@ - { - } - --StateTableProcessor::StateTableProcessor(const MorphSubtableHeader *morphSubtableHeader) -- : SubtableProcessor(morphSubtableHeader) -+StateTableProcessor::StateTableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) -+ : SubtableProcessor(morphSubtableHeader, success), stateTableHeader(morphSubtableHeader, success), -+ stHeader(stateTableHeader, success, (const StateTableHeader*)&stateTableHeader->stHeader) - { -- stateTableHeader = (const MorphStateTableHeader *) morphSubtableHeader; -- -+ if(LE_FAILURE(success)) return; - stateSize = SWAPW(stateTableHeader->stHeader.stateSize); - classTableOffset = SWAPW(stateTableHeader->stHeader.classTableOffset); - stateArrayOffset = SWAPW(stateTableHeader->stHeader.stateArrayOffset); - entryTableOffset = SWAPW(stateTableHeader->stHeader.entryTableOffset); - -- classTable = (const ClassTable *) ((char *) &stateTableHeader->stHeader + classTableOffset); -+ classTable = LEReferenceTo<ClassTable>(stateTableHeader, success, ((char *) &stateTableHeader->stHeader + classTableOffset)); -+ if(LE_FAILURE(success)) return; - firstGlyph = SWAPW(classTable->firstGlyph); - lastGlyph = firstGlyph + SWAPW(classTable->nGlyphs); - } -@@ -63,9 +64,9 @@ - { - } - --void StateTableProcessor::process(LEGlyphStorage &glyphStorage) -+void StateTableProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) - { -- -+ if (LE_FAILURE(success)) return; - LE_STATE_PATIENCE_INIT(); - - // Start at state 0 -@@ -94,8 +95,8 @@ - } - } - -- const EntryTableIndex *stateArray = (const EntryTableIndex *) ((char *) &stateTableHeader->stHeader + currentState); -- EntryTableIndex entryTableIndex = stateArray[(le_uint8)classCode]; -+ LEReferenceToArrayOf<EntryTableIndex> stateArray(stHeader, success, currentState, LE_UNBOUNDED_ARRAY); -+ EntryTableIndex entryTableIndex = stateArray.getObject((le_uint8)classCode, success); - LE_STATE_PATIENCE_CURR(le_int32, currGlyph); - currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex); - LE_STATE_PATIENCE_INCR(currGlyph); -diff --git a/src/share/native/sun/font/layout/StateTableProcessor.h b/src/share/native/sun/font/layout/StateTableProcessor.h ---- jdk/src/share/native/sun/font/layout/StateTableProcessor.h -+++ jdk/src/share/native/sun/font/layout/StateTableProcessor.h -@@ -49,7 +49,7 @@ - class StateTableProcessor : public SubtableProcessor - { - public: -- void process(LEGlyphStorage &glyphStorage); -+ void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); - - virtual void beginStateTable() = 0; - -@@ -58,7 +58,7 @@ - virtual void endStateTable() = 0; - - protected: -- StateTableProcessor(const MorphSubtableHeader *morphSubtableHeader); -+ StateTableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success); - virtual ~StateTableProcessor(); - - StateTableProcessor(); -@@ -68,11 +68,12 @@ - ByteOffset stateArrayOffset; - ByteOffset entryTableOffset; - -- const ClassTable *classTable; -+ LEReferenceTo<ClassTable> classTable; - TTGlyphID firstGlyph; - TTGlyphID lastGlyph; - -- const MorphStateTableHeader *stateTableHeader; -+ LEReferenceTo<MorphStateTableHeader> stateTableHeader; -+ LEReferenceTo<StateTableHeader> stHeader; // for convenience - - private: - StateTableProcessor(const StateTableProcessor &other); // forbid copying of this class -diff --git a/src/share/native/sun/font/layout/StateTables.h b/src/share/native/sun/font/layout/StateTables.h ---- jdk/src/share/native/sun/font/layout/StateTables.h -+++ jdk/src/share/native/sun/font/layout/StateTables.h -@@ -103,6 +103,7 @@ - le_uint16 nGlyphs; - ClassCode classArray[ANY_NUMBER]; - }; -+LE_VAR_ARRAY(ClassTable, classArray) - - enum StateNumber - { -diff --git a/src/share/native/sun/font/layout/SubtableProcessor.cpp b/src/share/native/sun/font/layout/SubtableProcessor.cpp ---- jdk/src/share/native/sun/font/layout/SubtableProcessor.cpp -+++ jdk/src/share/native/sun/font/layout/SubtableProcessor.cpp -@@ -40,10 +40,10 @@ - { - } - --SubtableProcessor::SubtableProcessor(const MorphSubtableHeader *morphSubtableHeader) -+SubtableProcessor::SubtableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) -+ : length(0), coverage(0), subtableFeatures(0L), subtableHeader(morphSubtableHeader) - { -- subtableHeader = morphSubtableHeader; -- -+ if(LE_FAILURE(success)) return; - length = SWAPW(subtableHeader->length); - coverage = SWAPW(subtableHeader->coverage); - subtableFeatures = SWAPL(subtableHeader->subtableFeatures); -diff --git a/src/share/native/sun/font/layout/SubtableProcessor.h b/src/share/native/sun/font/layout/SubtableProcessor.h ---- jdk/src/share/native/sun/font/layout/SubtableProcessor.h -+++ jdk/src/share/native/sun/font/layout/SubtableProcessor.h -@@ -46,11 +46,11 @@ - - class SubtableProcessor : public UMemory { - public: -- virtual void process(LEGlyphStorage &glyphStorage) = 0; -+ virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success) = 0; - virtual ~SubtableProcessor(); - - protected: -- SubtableProcessor(const MorphSubtableHeader *morphSubtableHeader); -+ SubtableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success); - - SubtableProcessor(); - -@@ -58,7 +58,7 @@ - SubtableCoverage coverage; - FeatureFlags subtableFeatures; - -- const MorphSubtableHeader *subtableHeader; -+ const LEReferenceTo<MorphSubtableHeader> subtableHeader; - - private: - -diff --git a/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp b/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp -@@ -134,11 +134,10 @@ - return; - } - -- if (fTypoFlags & 0x1) { /* kerning enabled */ -- static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG; -- -- KernTable kt(fFontInstance, getFontTable(kernTableTag)); -- kt.process(glyphStorage); -+ if (fTypoFlags & LE_Kerning_FEATURE_FLAG) { /* kerning enabled */ -+ LETableReference kernTable(fFontInstance, LE_KERN_TABLE_TAG, success); -+ KernTable kt(kernTable, success); -+ kt.process(glyphStorage, success); - } - - // default is no adjustments -diff --git a/src/share/native/sun/font/layout/TibetanLayoutEngine.cpp b/src/share/native/sun/font/layout/TibetanLayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/TibetanLayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/TibetanLayoutEngine.cpp -@@ -49,7 +49,7 @@ - UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TibetanOpenTypeLayoutEngine) - - TibetanOpenTypeLayoutEngine::TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success) -+ le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success) - : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success) - { - fFeatureMap = TibetanReordering::getFeatureMap(fFeatureMapCount); -diff --git a/src/share/native/sun/font/layout/TibetanLayoutEngine.h b/src/share/native/sun/font/layout/TibetanLayoutEngine.h ---- jdk/src/share/native/sun/font/layout/TibetanLayoutEngine.h -+++ jdk/src/share/native/sun/font/layout/TibetanLayoutEngine.h -@@ -83,7 +83,7 @@ - * @internal - */ - TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, -- le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success); -+ le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success); - - /** - * This constructor is used when the font requires a "canned" GSUB table which can't be known -diff --git a/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp b/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp ---- jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp -+++ jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp -@@ -46,22 +46,28 @@ - { - } - --TrimmedArrayProcessor::TrimmedArrayProcessor(const MorphSubtableHeader *morphSubtableHeader) -- : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader) -+TrimmedArrayProcessor::TrimmedArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) -+ : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success), firstGlyph(0), lastGlyph(0) - { -- const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader; -+ LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success); - -- trimmedArrayLookupTable = (const TrimmedArrayLookupTable *) &header->table; -- firstGlyph = SWAPW(trimmedArrayLookupTable->firstGlyph); -- lastGlyph = firstGlyph + SWAPW(trimmedArrayLookupTable->glyphCount); -+ if(LE_FAILURE(success)) return; -+ -+ trimmedArrayLookupTable = LEReferenceTo<TrimmedArrayLookupTable>(morphSubtableHeader, success, (const TrimmedArrayLookupTable*)&header->table); -+ -+ if(LE_FAILURE(success)) return; -+ -+ firstGlyph = SWAPW(trimmedArrayLookupTable->firstGlyph); -+ lastGlyph = firstGlyph + SWAPW(trimmedArrayLookupTable->glyphCount); - } - - TrimmedArrayProcessor::~TrimmedArrayProcessor() - { - } - --void TrimmedArrayProcessor::process(LEGlyphStorage &glyphStorage) -+void TrimmedArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) - { -+ if(LE_FAILURE(success)) return; - le_int32 glyphCount = glyphStorage.getGlyphCount(); - le_int32 glyph; - -diff --git a/src/share/native/sun/font/layout/TrimmedArrayProcessor.h b/src/share/native/sun/font/layout/TrimmedArrayProcessor.h ---- jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.h -+++ jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.h -@@ -50,9 +50,9 @@ - class TrimmedArrayProcessor : public NonContextualGlyphSubstitutionProcessor - { - public: -- virtual void process(LEGlyphStorage &glyphStorage); -+ virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); - -- TrimmedArrayProcessor(const MorphSubtableHeader *morphSubtableHeader); -+ TrimmedArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success); - - virtual ~TrimmedArrayProcessor(); - -@@ -76,7 +76,7 @@ - protected: - TTGlyphID firstGlyph; - TTGlyphID lastGlyph; -- const TrimmedArrayLookupTable *trimmedArrayLookupTable; -+ LEReferenceTo<TrimmedArrayLookupTable> trimmedArrayLookupTable; - - }; - -diff --git a/src/share/native/sun/font/layout/ValueRecords.h b/src/share/native/sun/font/layout/ValueRecords.h ---- jdk/src/share/native/sun/font/layout/ValueRecords.h -+++ jdk/src/share/native/sun/font/layout/ValueRecords.h -@@ -64,6 +64,7 @@ - static le_int16 getFieldCount(ValueFormat valueFormat); - static le_int16 getFieldIndex(ValueFormat valueFormat, ValueRecordField field); - }; -+LE_VAR_ARRAY(ValueRecord, values) - - enum ValueRecordFields - { -diff --git a/src/share/native/sun/font/sunFont.c b/src/share/native/sun/font/sunFont.c ---- jdk/src/share/native/sun/font/sunFont.c -+++ jdk/src/share/native/sun/font/sunFont.c -@@ -376,22 +376,20 @@ - JNIEXPORT TTLayoutTableCache* newLayoutTableCache() { - TTLayoutTableCache* ltc = calloc(1, sizeof(TTLayoutTableCache)); - if (ltc) { -- ltc->gsub_len = -1; -- ltc->gpos_len = -1; -- ltc->gdef_len = -1; -- ltc->mort_len = -1; -- ltc->kern_len = -1; -+ int i; -+ for(i=0;i<LAYOUTCACHE_ENTRIES;i++) { -+ ltc->entries[i].len = -1; -+ } - } - return ltc; - } - - JNIEXPORT void freeLayoutTableCache(TTLayoutTableCache* ltc) { - if (ltc) { -- if (ltc->gsub) free(ltc->gsub); -- if (ltc->gpos) free(ltc->gpos); -- if (ltc->gdef) free(ltc->gdef); -- if (ltc->mort) free(ltc->mort); -- if (ltc->kern) free(ltc->kern); -+ int i; -+ for(i=0;i<LAYOUTCACHE_ENTRIES;i++) { -+ if(ltc->entries[i].ptr) free (ltc->entries[i].ptr); -+ } - if (ltc->kernPairs) free(ltc->kernPairs); - free(ltc); - } diff --git a/java/openjdk6/files/icedtea/security/20130416/8001040.patch b/java/openjdk6/files/icedtea/security/20130416/8001040.patch deleted file mode 100644 index 56da89c9f3ff..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8001040.patch +++ /dev/null @@ -1,113 +0,0 @@ -# HG changeset patch -# User andrew -# Date 1365766584 -3600 -# Node ID ac0858a12d62c384c53a048a634d25dc1f8f1b72 -# Parent 5ed9acc1f6be298713f10ad71c33564d48f46555 -8001040: Rework RMI model -Reviewed-by: alanb, ahgross, coffeys, dmocek - -diff --git a/src/share/classes/sun/rmi/server/MarshalInputStream.java b/src/share/classes/sun/rmi/server/MarshalInputStream.java ---- jdk/src/share/classes/sun/rmi/server/MarshalInputStream.java -+++ jdk/src/share/classes/sun/rmi/server/MarshalInputStream.java -@@ -55,13 +55,19 @@ - public class MarshalInputStream extends ObjectInputStream { - - /** -- * value of "java.rmi.server.useCodebaseOnly" property, -+ * Value of "java.rmi.server.useCodebaseOnly" property, - * as cached at class initialization time. -+ * -+ * The default value is true. That is, the value is true -+ * if the property is absent or is not equal to "false". -+ * The value is only false when the property is present -+ * and is equal to "false". - */ - private static final boolean useCodebaseOnlyProperty = -- ((Boolean) java.security.AccessController.doPrivileged( -- new sun.security.action.GetBooleanAction( -- "java.rmi.server.useCodebaseOnly"))).booleanValue(); -+ ! java.security.AccessController.doPrivileged( -+ new sun.security.action.GetPropertyAction( -+ "java.rmi.server.useCodebaseOnly", "true")) -+ .equalsIgnoreCase("false"); - - /** table to hold sun classes to which access is explicitly permitted */ - protected static Map permittedSunClasses = new HashMap(3); -diff --git a/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java b/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java ---- jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java -+++ jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java -@@ -31,7 +31,8 @@ - * - * @library ../../testlibrary - * @build ClassPathCodebase Dummy -- * @run main/othervm/policy=security.policy ClassPathCodebase -+ * @run main/othervm/policy=security.policy -+ * -Djava.rmi.server.useCodebaseOnly=false ClassPathCodebase - */ - - import java.io.*; -diff --git a/test/java/rmi/registry/readTest/readTest.sh b/test/java/rmi/registry/readTest/readTest.sh ---- jdk/test/java/rmi/registry/readTest/readTest.sh -+++ jdk/test/java/rmi/registry/readTest/readTest.sh -@@ -52,7 +52,8 @@ - RMIREG_OUT=rmi.out - #start rmiregistry without any local classes on classpath - cd rmi_tmp --${TESTJAVA}${FS}bin${FS}rmiregistry 7491 > ..${FS}${RMIREG_OUT} 2>&1 & -+${TESTJAVA}${FS}bin${FS}rmiregistry -J-Djava.rmi.server.useCodebaseOnly=false \ -+ ${TESTTOOLVMOPTS} 64005 > ..${FS}${RMIREG_OUT} 2>&1 & - RMIREG_PID=$! - # allow some time to start - sleep 3 -diff --git a/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java b/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java ---- jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java -+++ jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java -@@ -68,6 +68,10 @@ - TestLibrary.bomb(e); - } - -+ System.err.println("Setting codebase property to: " + remoteCodebase); -+ System.setProperty("java.rmi.server.codebase", -+ remoteCodebase.toString()); -+ - /* - * Load Foo from a non-RMI class loader so that it won't be already - * loaded by an RMI class loader in this VM (for whatever that's -diff --git a/test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy b/test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy ---- jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy -+++ jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy -@@ -7,6 +7,8 @@ - }; - - grant { -+ permission java.util.PropertyPermission -+ "java.rmi.server.codebase", "read,write"; - - // permissions needed to move classes into separate codebase directories - permission java.io.FilePermission -diff --git a/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java b/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java ---- jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java -+++ jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java -@@ -32,7 +32,8 @@ - * @library ../../../testlibrary - * @build TestLibrary FnnClass FnnUnmarshal LoadProxyClasses NonpublicInterface - * @build NonpublicInterface1 PublicInterface PublicInterface1 -- * @run main/othervm/policy=security.policy LoadProxyClasses -+ * @run main/othervm/policy=security.policy -+ * -Djava.rmi.server.useCodebaseOnly=false LoadProxyClasses - */ - - import java.rmi.server.RMIClassLoader; -diff --git a/test/java/rmi/testlibrary/RMID.java b/test/java/rmi/testlibrary/RMID.java ---- jdk/test/java/rmi/testlibrary/RMID.java -+++ jdk/test/java/rmi/testlibrary/RMID.java -@@ -109,6 +109,9 @@ - if (!TestParams.testClasses.equals("")) { - args += " -C-Dtest.classes=" + TestParams.testClasses; - } -+ -+ args += " -C-Djava.rmi.server.useCodebaseOnly=false "; -+ - args += " " + getCodeCoverageArgs(); - return args; - } diff --git a/java/openjdk6/files/icedtea/security/20130416/8001322.patch b/java/openjdk6/files/icedtea/security/20130416/8001322.patch deleted file mode 100644 index 766d7270a1ab..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8001322.patch +++ /dev/null @@ -1,61 +0,0 @@ -# HG changeset patch -# User dfuchs -# Date 1363010839 -3600 -# Node ID 4a3260353853c3590ceb915337e21fe17aa07dbd -# Parent ac0858a12d62c384c53a048a634d25dc1f8f1b72 -8001322: Refactor deserialization -Reviewed-by: mchung, skoivu, smarks - -diff --git a/src/share/classes/java/io/ObjectInputStream.java b/src/share/classes/java/io/ObjectInputStream.java ---- jdk/src/share/classes/java/io/ObjectInputStream.java -+++ jdk/src/share/classes/java/io/ObjectInputStream.java -@@ -41,6 +41,7 @@ - import java.util.concurrent.ConcurrentMap; - import java.util.concurrent.atomic.AtomicBoolean; - import static java.io.ObjectStreamClass.processQueue; -+import sun.reflect.misc.ReflectUtil; - - /** - * An ObjectInputStream deserializes primitive data and objects previously -@@ -1518,6 +1519,12 @@ - } - } - -+ private boolean isCustomSubclass() { -+ // Return true if this class is a custom subclass of ObjectInputStream -+ return getClass().getClassLoader() -+ != ObjectInputStream.class.getClassLoader(); -+ } -+ - /** - * Reads in and returns class descriptor for a dynamic proxy class. Sets - * passHandle to proxy class descriptor's assigned handle. If proxy class -@@ -1547,6 +1554,15 @@ - try { - if ((cl = resolveProxyClass(ifaces)) == null) { - resolveEx = new ClassNotFoundException("null class"); -+ } else if (!Proxy.isProxyClass(cl)) { -+ throw new InvalidClassException("Not a proxy"); -+ } else { -+ // ReflectUtil.checkProxyPackageAccess makes a test -+ // equivalent to isCustomSubclass so there's no need -+ // to condition this call to isCustomSubclass == true here. -+ ReflectUtil.checkProxyPackageAccess( -+ getClass().getClassLoader(), -+ cl.getInterfaces()); - } - } catch (ClassNotFoundException ex) { - resolveEx = ex; -@@ -1588,9 +1604,12 @@ - Class cl = null; - ClassNotFoundException resolveEx = null; - bin.setBlockDataMode(true); -+ final boolean checksRequired = isCustomSubclass(); - try { - if ((cl = resolveClass(readDesc)) == null) { - resolveEx = new ClassNotFoundException("null class"); -+ } else if (checksRequired) { -+ ReflectUtil.checkPackageAccess(cl); - } - } catch (ClassNotFoundException ex) { - resolveEx = ex; diff --git a/java/openjdk6/files/icedtea/security/20130416/8001329.patch b/java/openjdk6/files/icedtea/security/20130416/8001329.patch deleted file mode 100644 index 592c665a3be5..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8001329.patch +++ /dev/null @@ -1,32 +0,0 @@ -# HG changeset patch -# User dmocek -# Date 1360111105 28800 -# Node ID a0e51ed355c9ae1256f8d344df34babb87a1edce -# Parent 4a3260353853c3590ceb915337e21fe17aa07dbd -8001329: Augment RMI logging -Reviewed-by: smarks, hawtin, alanb - -diff --git a/src/share/classes/java/rmi/server/LogStream.java b/src/share/classes/java/rmi/server/LogStream.java ---- jdk/src/share/classes/java/rmi/server/LogStream.java -+++ jdk/src/share/classes/java/rmi/server/LogStream.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -120,6 +120,13 @@ - */ - @Deprecated - public static synchronized void setDefaultStream(PrintStream newDefault) { -+ SecurityManager sm = System.getSecurityManager(); -+ -+ if (sm != null) { -+ sm.checkPermission( -+ new java.util.logging.LoggingPermission("control", null)); -+ } -+ - defaultStream = newDefault; - } - diff --git a/java/openjdk6/files/icedtea/security/20130416/8003335.patch b/java/openjdk6/files/icedtea/security/20130416/8003335.patch deleted file mode 100644 index ae733a018f2a..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8003335.patch +++ /dev/null @@ -1,63 +0,0 @@ -# HG changeset patch -# User chegar -# Date 1356010827 0 -# Node ID 3c7eb39c811464c98847a4f1a167636c1db80f17 -# Parent a0e51ed355c9ae1256f8d344df34babb87a1edce -8003335: Better handling of Finalizer thread -Reviewed-by: alanb, ahgross - -diff --git a/src/share/classes/java/lang/ref/Finalizer.java b/src/share/classes/java/lang/ref/Finalizer.java ---- jdk/src/share/classes/java/lang/ref/Finalizer.java -+++ jdk/src/share/classes/java/lang/ref/Finalizer.java -@@ -38,9 +38,9 @@ - */ - static native void invokeFinalizeMethod(Object o) throws Throwable; - -- static private ReferenceQueue queue = new ReferenceQueue(); -- static private Finalizer unfinalized = null; -- static private Object lock = new Object(); -+ private static ReferenceQueue queue = new ReferenceQueue(); -+ private static Finalizer unfinalized = null; -+ private static final Object lock = new Object(); - - private Finalizer - next = null, -@@ -142,7 +142,11 @@ - /* Called by Runtime.runFinalization() */ - static void runFinalization() { - forkSecondaryFinalizer(new Runnable() { -+ private volatile boolean running; - public void run() { -+ if (running) -+ return; -+ running = true; - for (;;) { - Finalizer f = (Finalizer)queue.poll(); - if (f == null) break; -@@ -155,7 +159,11 @@ - /* Invoked by java.lang.Shutdown */ - static void runAllFinalizers() { - forkSecondaryFinalizer(new Runnable() { -+ private volatile boolean running; - public void run() { -+ if (running) -+ return; -+ running = true; - for (;;) { - Finalizer f; - synchronized (lock) { -@@ -168,10 +176,14 @@ - } - - private static class FinalizerThread extends Thread { -+ private volatile boolean running; - FinalizerThread(ThreadGroup g) { - super(g, "Finalizer"); - } - public void run() { -+ if (running) -+ return; -+ running = true; - for (;;) { - try { - Finalizer f = (Finalizer)queue.remove(); diff --git a/java/openjdk6/files/icedtea/security/20130416/8003445.patch b/java/openjdk6/files/icedtea/security/20130416/8003445.patch deleted file mode 100644 index 2d53b2959e65..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8003445.patch +++ /dev/null @@ -1,77 +0,0 @@ -# HG changeset patch -# User andrew -# Date 1365768981 -3600 -# Node ID 8f5ad2cacf6fff8efd817c5373469037d945f3dc -# Parent 3c7eb39c811464c98847a4f1a167636c1db80f17 -8003445: Adjust JAX-WS to focus on API -Reviewed-by: vinnie, ahgross, mgrebac - -diff --git a/src/share/lib/security/java.security b/src/share/lib/security/java.security ---- jdk/src/share/lib/security/java.security -+++ jdk/src/share/lib/security/java.security -@@ -150,7 +150,8 @@ - com.sun.org.apache.xalan.internal.xsltc.util.,\ - com.sun.org.apache.xml.internal.res.,\ - com.sun.org.apache.xml.internal.serializer.utils.,\ -- com.sun.org.apache.xml.internal.utils. -+ com.sun.org.apache.xml.internal.utils.,\ -+ com.sun.org.glassfish. - - # - # List of comma-separated packages that start with or equal this string -@@ -185,7 +186,8 @@ - com.sun.org.apache.xalan.internal.xsltc.util.,\ - com.sun.org.apache.xml.internal.res.,\ - com.sun.org.apache.xml.internal.serializer.utils.,\ -- com.sun.org.apache.xml.internal.utils. -+ com.sun.org.apache.xml.internal.utils.,\ -+ com.sun.org.glassfish. - - # - # Determines whether this properties file can be appended to -diff --git a/src/share/lib/security/java.security-solaris b/src/share/lib/security/java.security-solaris ---- jdk/src/share/lib/security/java.security-solaris -+++ jdk/src/share/lib/security/java.security-solaris -@@ -151,7 +151,8 @@ - com.sun.org.apache.xalan.internal.xsltc.util.,\ - com.sun.org.apache.xml.internal.res.,\ - com.sun.org.apache.xml.internal.serializer.utils.,\ -- com.sun.org.apache.xml.internal.utils. -+ com.sun.org.apache.xml.internal.utils.,\ -+ com.sun.org.glassfish. - - # - # List of comma-separated packages that start with or equal this string -@@ -186,7 +187,8 @@ - com.sun.org.apache.xalan.internal.xsltc.util.,\ - com.sun.org.apache.xml.internal.res.,\ - com.sun.org.apache.xml.internal.serializer.utils.,\ -- com.sun.org.apache.xml.internal.utils. -+ com.sun.org.apache.xml.internal.utils.,\ -+ com.sun.org.glassfish. - - # - # Determines whether this properties file can be appended to -diff --git a/src/share/lib/security/java.security-windows b/src/share/lib/security/java.security-windows ---- jdk/src/share/lib/security/java.security-windows -+++ jdk/src/share/lib/security/java.security-windows -@@ -151,7 +151,8 @@ - com.sun.org.apache.xalan.internal.xsltc.util.,\ - com.sun.org.apache.xml.internal.res.,\ - com.sun.org.apache.xml.internal.serializer.utils.,\ -- com.sun.org.apache.xml.internal.utils. -+ com.sun.org.apache.xml.internal.utils.,\ -+ com.sun.org.glassfish. - - # - # List of comma-separated packages that start with or equal this string -@@ -186,7 +187,8 @@ - com.sun.org.apache.xalan.internal.xsltc.util.,\ - com.sun.org.apache.xml.internal.res.,\ - com.sun.org.apache.xml.internal.serializer.utils.,\ -- com.sun.org.apache.xml.internal.utils. -+ com.sun.org.apache.xml.internal.utils.,\ -+ com.sun.org.glassfish. - - # - # Determines whether this properties file can be appended to diff --git a/java/openjdk6/files/icedtea/security/20130416/8003543.patch b/java/openjdk6/files/icedtea/security/20130416/8003543.patch deleted file mode 100644 index 8178f0b5eee6..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8003543.patch +++ /dev/null @@ -1,227 +0,0 @@ ---- /dev/null 2013-04-25 15:02:13.000000000 -0400 -+++ jaxws/patches/jaxws_src/8003543.patch 2013-04-25 15:03:47.000000000 -0400 -@@ -0,0 +1,224 @@ -+--- src/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java -++++ src/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java -+@@ -1,5 +1,5 @@ -+ /* -+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. -++ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+@@ -27,6 +27,7 @@ -+ import java.nio.ByteBuffer; -+ import java.io.File; -+ import java.io.IOException; -++import java.util.logging.Level; -+ import java.util.logging.Logger; -+ -+ /** -+@@ -49,41 +50,45 @@ -+ } -+ -+ // size of the chunk given by the parser -++ @Override -+ public int size() { -+ return len; -+ } -+ -++ @Override -+ public byte[] read() { -+ return data; -+ } -+ -++ @Override -+ public long writeTo(DataFile file) { -+ return file.writeTo(data, 0, len); -+ } -+ -+ /** -+- * -+ * @param dataHead -+ * @param buf -+ * @return -+ */ -++ @Override -+ public Data createNext(DataHead dataHead, ByteBuffer buf) { -+ if (!config.isOnlyMemory() && dataHead.inMemory >= config.memoryThreshold) { -+ try { -+ String prefix = config.getTempFilePrefix(); -+ String suffix = config.getTempFileSuffix(); -+- File dir = config.getTempDir(); -+- File tempFile = (dir == null) -+- ? File.createTempFile(prefix, suffix) -+- : File.createTempFile(prefix, suffix, dir); -+- LOGGER.fine("Created temp file = "+tempFile); -++ File tempFile = TempFiles.createTempFile(prefix, suffix, config.getTempDir()); -++ // delete the temp file when VM exits as a last resort for file clean up -++ tempFile.deleteOnExit(); -++ if (LOGGER.isLoggable(Level.FINE)) { -++ LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile); -++ } -+ dataHead.dataFile = new DataFile(tempFile); -+- } catch(IOException ioe) { -++ } catch (IOException ioe) { -+ throw new MIMEParsingException(ioe); -+ } -+ -+ if (dataHead.head != null) { -+- for(Chunk c=dataHead.head; c != null; c=c.next) { -++ for (Chunk c = dataHead.head; c != null; c = c.next) { -+ long pointer = c.data.writeTo(dataHead.dataFile); -+ c.data = new FileData(dataHead.dataFile, pointer, len); -+ } -+@@ -93,4 +98,5 @@ -+ return new MemoryData(buf, config); -+ } -+ } -++ -+ } -+--- /dev/null -++++ src/com/sun/xml/internal/org/jvnet/mimepull/TempFiles.java -+@@ -0,0 +1,144 @@ -++/* -++ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. -++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -++ * -++ * This code is free software; you can redistribute it and/or modify it -++ * under the terms of the GNU General Public License version 2 only, as -++ * published by the Free Software Foundation. Oracle designates this -++ * particular file as subject to the "Classpath" exception as provided -++ * by Oracle in the LICENSE file that accompanied this code. -++ * -++ * This code is distributed in the hope that it will be useful, but WITHOUT -++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -++ * version 2 for more details (a copy is included in the LICENSE file that -++ * accompanied this code). -++ * -++ * You should have received a copy of the GNU General Public License version -++ * 2 along with this work; if not, write to the Free Software Foundation, -++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -++ * -++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -++ * or visit www.oracle.com if you need additional information or have any -++ * questions. -++ */ -++ -++package com.sun.xml.internal.org.jvnet.mimepull; -++ -++import java.io.File; -++import java.io.IOException; -++import java.lang.reflect.Array; -++import java.lang.reflect.InvocationTargetException; -++import java.lang.reflect.Method; -++import java.util.logging.Level; -++import java.util.logging.Logger; -++ -++/** -++ * Helper utility to support jdk <= jdk1.6. After jdk1.6 EOL reflection can be removed and API can be used directly. -++ */ -++class TempFiles { -++ -++ private static final Logger LOGGER = Logger.getLogger(TempFiles.class.getName()); -++ -++ private static final Class<?> CLASS_FILES; -++ private static final Class<?> CLASS_PATH; -++ private static final Class<?> CLASS_FILE_ATTRIBUTE; -++ private static final Class<?> CLASS_FILE_ATTRIBUTES; -++ private static final Method METHOD_FILE_TO_PATH; -++ private static final Method METHOD_FILES_CREATE_TEMP_FILE; -++ private static final Method METHOD_FILES_CREATE_TEMP_FILE_WITHPATH; -++ -++ private static final Method METHOD_PATH_TO_FILE; -++ -++ private static boolean useJdk6API; -++ -++ static { -++ useJdk6API = isJdk6(); -++ -++ CLASS_FILES = safeGetClass("java.nio.file.Files"); -++ CLASS_PATH = safeGetClass("java.nio.file.Path"); -++ CLASS_FILE_ATTRIBUTE = safeGetClass("java.nio.file.attribute.FileAttribute"); -++ CLASS_FILE_ATTRIBUTES = safeGetClass("[Ljava.nio.file.attribute.FileAttribute;"); -++ METHOD_FILE_TO_PATH = safeGetMethod(File.class, "toPath"); -++ METHOD_FILES_CREATE_TEMP_FILE = safeGetMethod(CLASS_FILES, "createTempFile", String.class, String.class, CLASS_FILE_ATTRIBUTES); -++ METHOD_FILES_CREATE_TEMP_FILE_WITHPATH = safeGetMethod(CLASS_FILES, "createTempFile", CLASS_PATH, String.class, String.class, CLASS_FILE_ATTRIBUTES); -++ METHOD_PATH_TO_FILE = safeGetMethod(CLASS_PATH, "toFile"); -++ } -++ -++ private static boolean isJdk6() { -++ String javaVersion = System.getProperty("java.version"); -++ LOGGER.log(Level.FINEST, "Detected java version = {0}", javaVersion); -++ return javaVersion.startsWith("1.6."); -++ } -++ -++ private static Class<?> safeGetClass(String className) { -++ // it is jdk 6 or something failed already before -++ if (useJdk6API) return null; -++ try { -++ return Class.forName(className); -++ } catch (ClassNotFoundException e) { -++ LOGGER.log(Level.SEVERE, "Exception cought", e); -++ LOGGER.log(Level.WARNING, "Class {0} not found. Temp files will be created using old java.io API.", className); -++ useJdk6API = true; -++ return null; -++ } -++ } -++ -++ private static Method safeGetMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) { -++ // it is jdk 6 or something failed already before -++ if (useJdk6API) return null; -++ try { -++ return clazz.getMethod(methodName, parameterTypes); -++ } catch (NoSuchMethodException e) { -++ LOGGER.log(Level.SEVERE, "Exception cought", e); -++ LOGGER.log(Level.WARNING, "Method {0} not found. Temp files will be created using old java.io API.", methodName); -++ useJdk6API = true; -++ return null; -++ } -++ } -++ -++ -++ static Object toPath(File f) throws InvocationTargetException, IllegalAccessException { -++ return METHOD_FILE_TO_PATH.invoke(f); -++ } -++ -++ static File toFile(Object path) throws InvocationTargetException, IllegalAccessException { -++ return (File) METHOD_PATH_TO_FILE.invoke(path); -++ } -++ -++ static File createTempFile(String prefix, String suffix, File dir) throws IOException { -++ -++ if (useJdk6API) { -++ LOGGER.log(Level.FINEST, "Jdk6 detected, temp file (prefix:{0}, suffix:{1}) being created using old java.io API.", new Object[]{prefix, suffix}); -++ return File.createTempFile(prefix, suffix, dir); -++ -++ } else { -++ -++ try { -++ if (dir != null) { -++ Object path = toPath(dir); -++ LOGGER.log(Level.FINEST, "Temp file (path: {0}, prefix:{1}, suffix:{2}) being created using NIO API.", new Object[]{dir.getAbsolutePath(), prefix, suffix}); -++ return toFile(METHOD_FILES_CREATE_TEMP_FILE_WITHPATH.invoke(null, path, prefix, suffix, Array.newInstance(CLASS_FILE_ATTRIBUTE, 0))); -++ } else { -++ LOGGER.log(Level.FINEST, "Temp file (prefix:{0}, suffix:{1}) being created using NIO API.", new Object[]{prefix, suffix}); -++ return toFile(METHOD_FILES_CREATE_TEMP_FILE.invoke(null, prefix, suffix, Array.newInstance(CLASS_FILE_ATTRIBUTE, 0))); -++ } -++ -++ } catch (IllegalAccessException e) { -++ LOGGER.log(Level.SEVERE, "Exception caught", e); -++ LOGGER.log(Level.WARNING, "Error invoking java.nio API, temp file (path: {0}, prefix:{1}, suffix:{2}) being created using old java.io API.", -++ new Object[]{dir != null ? dir.getAbsolutePath() : null, prefix, suffix}); -++ return File.createTempFile(prefix, suffix, dir); -++ -++ } catch (InvocationTargetException e) { -++ LOGGER.log(Level.SEVERE, "Exception caught", e); -++ LOGGER.log(Level.WARNING, "Error invoking java.nio API, temp file (path: {0}, prefix:{1}, suffix:{2}) being created using old java.io API.", -++ new Object[]{dir != null ? dir.getAbsolutePath() : null, prefix, suffix}); -++ return File.createTempFile(prefix, suffix, dir); -++ } -++ } -++ -++ } -++ -++ -++} diff --git a/java/openjdk6/files/icedtea/security/20130416/8004261.patch b/java/openjdk6/files/icedtea/security/20130416/8004261.patch deleted file mode 100644 index 245d49e34c5f..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8004261.patch +++ /dev/null @@ -1,142 +0,0 @@ -# HG changeset patch -# User andrew -# Date 1365774039 -3600 -# Node ID 0236ab95a0f15e35aef6edd91f58a5072784dccd -# Parent 8f5ad2cacf6fff8efd817c5373469037d945f3dc -8004261: Improve input validation -Reviewed-by: art, mschoene, amenkov - -diff --git a/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java b/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java ---- jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java -+++ jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java -@@ -56,7 +56,7 @@ - // from simultaneous creation and destruction - // reduces possibility of deadlock, compared to - // synchronizing to the class instance -- private Object traRecLock = new Object(); -+ private final Object traRecLock = new Object(); - - // DEVICE ATTRIBUTES - -@@ -474,7 +474,7 @@ - This is necessary for Receivers retrieved via MidiSystem.getReceiver() - (which opens the device implicitely). - */ -- protected abstract class AbstractReceiver implements Receiver { -+ abstract class AbstractReceiver implements Receiver { - private boolean open = true; - - -@@ -483,24 +483,24 @@ - Receiver. Therefore, subclasses should not override this method. - Instead, they should implement implSend(). - */ -- public synchronized void send(MidiMessage message, long timeStamp) { -- if (open) { -- implSend(message, timeStamp); -- } else { -+ @Override -+ public final synchronized void send(final MidiMessage message, -+ final long timeStamp) { -+ if (!open) { - throw new IllegalStateException("Receiver is not open"); - } -+ implSend(message, timeStamp); - } - -- -- protected abstract void implSend(MidiMessage message, long timeStamp); -- -+ abstract void implSend(MidiMessage message, long timeStamp); - - /** Close the Receiver. - * Here, the call to the magic method closeInternal() takes place. - * Therefore, subclasses that override this method must call - * 'super.close()'. - */ -- public void close() { -+ @Override -+ public final void close() { - open = false; - synchronized (AbstractMidiDevice.this.traRecLock) { - AbstractMidiDevice.this.getReceiverList().remove(this); -@@ -508,7 +508,7 @@ - AbstractMidiDevice.this.closeInternal(this); - } - -- protected boolean isOpen() { -+ final boolean isOpen() { - return open; - } - -diff --git a/src/share/classes/com/sun/media/sound/FastShortMessage.java b/src/share/classes/com/sun/media/sound/FastShortMessage.java ---- jdk/src/share/classes/com/sun/media/sound/FastShortMessage.java -+++ jdk/src/share/classes/com/sun/media/sound/FastShortMessage.java -@@ -32,7 +32,7 @@ - * - * @author Florian Bomers - */ --class FastShortMessage extends ShortMessage { -+final class FastShortMessage extends ShortMessage { - private int packedMsg; - - public FastShortMessage(int packedMsg) throws InvalidMidiDataException { -diff --git a/src/share/classes/com/sun/media/sound/FastSysexMessage.java b/src/share/classes/com/sun/media/sound/FastSysexMessage.java ---- jdk/src/share/classes/com/sun/media/sound/FastSysexMessage.java -+++ jdk/src/share/classes/com/sun/media/sound/FastSysexMessage.java -@@ -32,7 +32,7 @@ - * - * @author Florian Bomers - */ --class FastSysexMessage extends SysexMessage { -+final class FastSysexMessage extends SysexMessage { - - FastSysexMessage(byte[] data) throws InvalidMidiDataException { - super(data); -diff --git a/src/share/classes/com/sun/media/sound/MidiOutDevice.java b/src/share/classes/com/sun/media/sound/MidiOutDevice.java ---- jdk/src/share/classes/com/sun/media/sound/MidiOutDevice.java -+++ jdk/src/share/classes/com/sun/media/sound/MidiOutDevice.java -@@ -103,9 +103,9 @@ - - class MidiOutReceiver extends AbstractReceiver { - -- protected void implSend(MidiMessage message, long timeStamp) { -- int length = message.getLength(); -- int status = message.getStatus(); -+ void implSend(final MidiMessage message, final long timeStamp) { -+ final int length = message.getLength(); -+ final int status = message.getStatus(); - if (length <= 3 && status != 0xF0 && status != 0xF7) { - int packedMsg; - if (message instanceof ShortMessage) { -@@ -140,11 +140,15 @@ - } - nSendShortMessage(id, packedMsg, timeStamp); - } else { -+ final byte[] data; - if (message instanceof FastSysexMessage) { -- nSendLongMessage(id, ((FastSysexMessage) message).getReadOnlyMessage(), -- length, timeStamp); -+ data = ((FastSysexMessage) message).getReadOnlyMessage(); - } else { -- nSendLongMessage(id, message.getMessage(), length, timeStamp); -+ data = message.getMessage(); -+ } -+ final int dataLength = Math.min(length, data.length); -+ if (dataLength > 0) { -+ nSendLongMessage(id, data, dataLength, timeStamp); - } - } - } -diff --git a/src/share/classes/com/sun/media/sound/RealTimeSequencer.java b/src/share/classes/com/sun/media/sound/RealTimeSequencer.java ---- jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java -+++ jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java -@@ -1019,7 +1019,7 @@ - - class SequencerReceiver extends AbstractReceiver { - -- protected void implSend(MidiMessage message, long timeStamp) { -+ void implSend(MidiMessage message, long timeStamp) { - if (recording) { - long tickPos = 0; - diff --git a/java/openjdk6/files/icedtea/security/20130416/8004336.patch b/java/openjdk6/files/icedtea/security/20130416/8004336.patch deleted file mode 100644 index ca0ab35188cc..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8004336.patch +++ /dev/null @@ -1,29 +0,0 @@ -# HG changeset patch -# User twisti -# Date 1361822075 28800 -# Node ID cf2b7f0f7a2188a1421bdd033e88bf4b0aa6870c -# Parent f9d5be4340c0ab09bebfcd2dce5563a2042ccc95 -8004336: Better handling of method handle intrinsic frames -Reviewed-by: kvn, jrose, ahgross - -diff --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp ---- hotspot/src/share/vm/opto/library_call.cpp -+++ hotspot/src/share/vm/opto/library_call.cpp -@@ -1313,7 +1313,6 @@ - push(result); - return true; - } -- - //--------------------------pop_math_arg-------------------------------- - // Pop a double argument to a math function from the stack - // rounding it if necessary. -@@ -3746,7 +3745,8 @@ - } - } - } -- else if (method->is_method_handle_adapter()) { -+ -+ if (method->is_method_handle_adapter()) { - // This is an internal adapter frame from the MethodHandleCompiler -- skip it - return true; - } diff --git a/java/openjdk6/files/icedtea/security/20130416/8004986.patch b/java/openjdk6/files/icedtea/security/20130416/8004986.patch deleted file mode 100644 index 2139154d9d26..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8004986.patch +++ /dev/null @@ -1,374 +0,0 @@ -# HG changeset patch -# User andrew -# Date 1365737071 -3600 -# Node ID c7ddbf756d7f35d6e782eb91b86ce2938de44fb8 -# Parent a5bbb8808ac9a6a8e20c5f267044bb0cef0bbdc1 -8004986: Better handling of glyph table -8004987: Improve font layout -8004994: Improve checking of glyph table -Reviewed-by: bae, mschoene, jgodinez -Contributed-by: steven.loomis@oracle.com - -diff --git a/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp b/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp -@@ -26,7 +26,7 @@ - - /* - * -- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved -+ * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved - * - */ - -@@ -155,17 +155,16 @@ - UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine( - const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) -- : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags) -+ : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG) - { - fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable; - fGDEFTable = (const GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable; -- -- fSubstitutionFilter = new CharSubstitutionFilter(fontInstance); -+ /* OpenTypeLayoutEngine will allocate a substitution filter */ - } - - UnicodeArabicOpenTypeLayoutEngine::~UnicodeArabicOpenTypeLayoutEngine() - { -- delete fSubstitutionFilter; -+ /* OpenTypeLayoutEngine will cleanup the substitution filter */ - } - - // "glyphs", "indices" -> glyphs, indices -diff --git a/src/share/native/sun/font/layout/LETypes.h b/src/share/native/sun/font/layout/LETypes.h ---- jdk/src/share/native/sun/font/layout/LETypes.h -+++ jdk/src/share/native/sun/font/layout/LETypes.h -@@ -208,6 +208,35 @@ - #define LE_CLIENT_SHIFT 24 - - -+#ifndef LE_ASSERT_BAD_FONT -+#define LE_ASSERT_BAD_FONT 0 -+#endif -+ -+#if LE_ASSERT_BAD_FONT -+#include <stdio.h> -+#define LE_DEBUG_BAD_FONT(x) fprintf(stderr,"%s:%d: BAD FONT: %s\n", __FILE__, __LINE__, (x)); -+#else -+#define LE_DEBUG_BAD_FONT(x) -+#endif -+ -+/** -+ * Max value representable by a uintptr -+ */ -+#ifndef UINTPTR_MAX -+#ifndef UINT32_MAX -+#define LE_UINTPTR_MAX 0xFFFFFFFFU -+#else -+#define LE_UINTPTR_MAX UINT32_MAX -+#endif -+#else -+#define LE_UINTPTR_MAX UINTPTR_MAX -+#endif -+ -+/** -+ * Range check for overflow -+ */ -+#define LE_RANGE_CHECK(type, count, ptrfn) (( (LE_UINTPTR_MAX / sizeof(type)) < count ) ? NULL : (ptrfn)) -+ - /** - * A convenience macro to get the Glyph ID part of an LEGlyphID. - * -@@ -599,6 +628,21 @@ - */ - #define LE_SUCCESS(code) ((code)<=LE_NO_ERROR) - -+enum LEFeatureENUMs { -+ LE_Kerning_FEATURE_ENUM = 0, -+ LE_Ligatures_FEATURE_ENUM = 1, -+ LE_CHAR_FILTER_FEATURE_ENUM = 31, -+}; -+ -+#define LE_Kerning_FEATURE_FLAG (1 << LE_Kerning_FEATURE_ENUM) -+#define LE_Ligatures_FEATURE_FLAG (1 << LE_Ligatures_FEATURE_ENUM) -+ -+#define LE_CHAR_FILTER_FEATURE_ENUM 31 -+ -+#define LE_CHAR_FILTER_FEATURE_FLAG (1 << LE_CHAR_FILTER_FEATURE_ENUM) -+ -+#define LE_DEFAULT_FEATURE_FLAG (LE_Kerning_FEATURE_FLAG | LE_Ligatures_FEATURE_FLAG) /**< default features */ -+ - /** - * A convenience macro to test for the failure of a LayoutEngine call. - * -diff --git a/src/share/native/sun/font/layout/LayoutEngine.cpp b/src/share/native/sun/font/layout/LayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/LayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/LayoutEngine.cpp -@@ -31,6 +31,7 @@ - - #include "LETypes.h" - #include "LEScripts.h" -+#include "LESwaps.h" - #include "LELanguages.h" - - #include "LayoutEngine.h" -@@ -387,7 +388,7 @@ - - adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success); - -- if (fTypoFlags & 0x1) { /* kerning enabled */ -+ if (fTypoFlags & LE_Kerning_FEATURE_FLAG) { /* kerning enabled */ - static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG; - - KernTable kt(fFontInstance, getFontTable(kernTableTag)); -@@ -538,7 +539,7 @@ - { - // 3 -> kerning and ligatures - return LayoutEngine::layoutEngineFactory(fontInstance, scriptCode, -- languageCode, 3, success); -+ languageCode, LE_DEFAULT_FEATURE_FLAG, success); - } - - LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, -@@ -621,7 +622,7 @@ - const MorphTableHeader *morphTable = - (MorphTableHeader *) fontInstance->getFontTable(mortTableTag); - -- if (morphTable != NULL) { -+ if (morphTable != NULL && SWAPL(morphTable->version)==0x00010000) { - result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, morphTable); - } else { - switch (scriptCode) { -diff --git a/src/share/native/sun/font/layout/LigatureSubstProc.cpp b/src/share/native/sun/font/layout/LigatureSubstProc.cpp ---- jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp -+++ jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp -@@ -25,7 +25,7 @@ - - /* - * -- * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved -+ * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved - * - */ - -@@ -76,6 +76,10 @@ - } - - componentStack[m] = currGlyph; -+ } else if ( m == -1) { -+ // bad font- skip this glyph. -+ currGlyph++; -+ return newState; - } - - ByteOffset actionOffset = flags & lsfActionOffsetMask; -@@ -99,7 +103,21 @@ - offset = action & lafComponentOffsetMask; - if (offset != 0) { - const le_int16 *offsetTable = (const le_int16 *)((char *) &ligatureSubstitutionHeader->stHeader + 2 * SignExtend(offset, lafComponentOffsetMask)); -+ const le_int16 *tableEnd = (const le_int16 *)((char *) &ligatureSubstitutionHeader + 1 * SWAPW(ligatureSubstitutionHeader->length)); - -+ // Check if the font is internally consistent -+ if(tableEnd < (const le_int16*)&ligatureSubstitutionHeader // stated end wrapped around? -+ || offsetTable > tableEnd) { // offset past end of stated length? -+ currGlyph++; -+ LE_DEBUG_BAD_FONT("off end of ligature substitution header"); -+ return newState; // get out! bad font -+ } -+ -+ if(componentGlyph > glyphStorage.getGlyphCount()) { -+ LE_DEBUG_BAD_FONT("preposterous componentGlyph"); -+ currGlyph++; -+ return newState; // get out! bad font -+ } - i += SWAPW(offsetTable[LE_GET_GLYPH(glyphStorage[componentGlyph])]); - - if (action & (lafLast | lafStore)) { -@@ -107,13 +125,22 @@ - TTGlyphID ligatureGlyph = SWAPW(*ligatureOffset); - - glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], ligatureGlyph); -+ if(mm==nComponents) { -+ LE_DEBUG_BAD_FONT("exceeded nComponents"); -+ mm--; // don't overrun the stack. -+ } - stack[++mm] = componentGlyph; - i = 0; - } else { - glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], 0xFFFF); - } - } -- } while (!(action & lafLast)); -+#if LE_ASSERT_BAD_FONT -+ if(m<0) { -+ LE_DEBUG_BAD_FONT("m<0") -+ } -+#endif -+ } while (!(action & lafLast) && (m>=0) ); // stop if last bit is set, or if run out of items - - while (mm >= 0) { - if (++m >= nComponents) { -diff --git a/src/share/native/sun/font/layout/LookupProcessor.cpp b/src/share/native/sun/font/layout/LookupProcessor.cpp ---- jdk/src/share/native/sun/font/layout/LookupProcessor.cpp -+++ jdk/src/share/native/sun/font/layout/LookupProcessor.cpp -@@ -185,7 +185,7 @@ - lookupSelectCount = lookupListCount; - - le_int32 count, order = 0; -- le_int32 featureReferences = 0; -+ le_uint32 featureReferences = 0; - const FeatureTable *featureTable = NULL; - LETag featureTag; - -@@ -196,7 +196,7 @@ - // be the maximum number of entries in the lookupOrderArray. We can't use - // lookupListCount because some lookups might be referenced by more than - // one feature. -- for (le_int32 feature = 0; feature < featureCount; feature += 1) { -+ for (le_uint32 feature = 0; feature < featureCount; feature += 1) { - le_uint16 featureIndex = SWAPW(langSysTable->featureIndexArray[feature]); - - featureTable = featureListTable->getFeatureTable(featureIndex, &featureTag); -diff --git a/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp b/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp ---- jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp -+++ jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp -@@ -100,6 +100,14 @@ - const GlyphPositioningTableHeader *gposTable = - (const GlyphPositioningTableHeader *) getFontTable(gposTableTag); - -+ applyTypoFlags(); -+ -+} -+ -+void OpenTypeLayoutEngine::applyTypoFlags() { -+ const le_int32& typoFlags = fTypoFlags; -+ const LEFontInstance *fontInstance = fFontInstance; -+ - // todo: switch to more flags and bitfield rather than list of feature tags? - switch (typoFlags) { - case 0: break; // default -@@ -109,13 +117,6 @@ - default: break; - } - -- setScriptAndLanguageTags(); -- -- fGDEFTable = (const GlyphDefinitionTableHeader *) getFontTable(gdefTableTag); -- -- if (gposTable != NULL && gposTable->coversScriptAndLanguage(fScriptTag, fLangSysTag)) { -- fGPOSTable = gposTable; -- } - } - - void OpenTypeLayoutEngine::reset() -@@ -133,11 +134,16 @@ - fFeatureOrder(FALSE), fGSUBTable(NULL), fGDEFTable(NULL), - fGPOSTable(NULL), fSubstitutionFilter(NULL) - { -+ applyTypoFlags(); - setScriptAndLanguageTags(); - } - - OpenTypeLayoutEngine::~OpenTypeLayoutEngine() - { -+ if (fTypoFlags & LE_CHAR_FILTER_FEATURE_FLAG) { -+ delete fSubstitutionFilter; -+ fSubstitutionFilter = NULL; -+ } - reset(); - } - -diff --git a/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h b/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h ---- jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h -+++ jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h -@@ -150,6 +150,11 @@ - */ - static const LETag languageTags[]; - -+ /** -+ * apply the typoflags. Only called by the c'tors. -+ */ -+ void applyTypoFlags(); -+ - protected: - /** - * A set of "default" features. The default characterProcessing method -diff --git a/src/share/native/sun/font/layout/StateTableProcessor.cpp b/src/share/native/sun/font/layout/StateTableProcessor.cpp ---- jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp -+++ jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp -@@ -63,6 +63,9 @@ - - void StateTableProcessor::process(LEGlyphStorage &glyphStorage) - { -+ -+ LE_STATE_PATIENCE_INIT(); -+ - // Start at state 0 - // XXX: How do we know when to start at state 1? - ByteOffset currentState = stateArrayOffset; -@@ -74,6 +77,7 @@ - beginStateTable(); - - while (currGlyph <= glyphCount) { -+ if(LE_STATE_PATIENCE_DECR()) break; // patience exceeded. - ClassCode classCode = classCodeOOB; - if (currGlyph == glyphCount) { - // XXX: How do we handle EOT vs. EOL? -@@ -90,8 +94,9 @@ - - const EntryTableIndex *stateArray = (const EntryTableIndex *) ((char *) &stateTableHeader->stHeader + currentState); - EntryTableIndex entryTableIndex = stateArray[(le_uint8)classCode]; -- -+ LE_STATE_PATIENCE_CURR(le_int32, currGlyph); - currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex); -+ LE_STATE_PATIENCE_INCR(currGlyph); - } - - endStateTable(); -diff --git a/src/share/native/sun/font/layout/StateTables.h b/src/share/native/sun/font/layout/StateTables.h ---- jdk/src/share/native/sun/font/layout/StateTables.h -+++ jdk/src/share/native/sun/font/layout/StateTables.h -@@ -35,6 +35,41 @@ - #include "LETypes.h" - #include "LayoutTables.h" - -+ -+ -+ -+/* -+ * State table loop detection. -+ * Detects if too many ( LE_STATE_PATIENCE_COUNT ) state changes occur without moving the glyph index 'g'. -+ * -+ * Usage (pseudocode): -+ * -+ * { -+ * LE_STATE_PATIENCE_INIT(); -+ * -+ * int g=0; // the glyph index - expect it to be moving -+ * -+ * for(;;) { -+ * if(LE_STATE_PATIENCE_DECR()) { // decrements the patience counter -+ * // ran out of patience, get out. -+ * break; -+ * } -+ * -+ * LE_STATE_PATIENCE_CURR(int, g); // store the 'current' -+ * state = newState(state,g); -+ * g+= <something, could be zero>; -+ * LE_STATE_PATIENCE_INCR(g); // if g has moved, increment the patience counter. Otherwise leave it. -+ * } -+ * -+ */ -+ -+#define LE_STATE_PATIENCE_COUNT 4096 /**< give up if a state table doesn't move the glyph after this many iterations */ -+#define LE_STATE_PATIENCE_INIT() le_uint32 le_patience_count = LE_STATE_PATIENCE_COUNT -+#define LE_STATE_PATIENCE_DECR() --le_patience_count==0 -+#define LE_STATE_PATIENCE_CURR(type,x) type le_patience_curr=(x) -+#define LE_STATE_PATIENCE_INCR(x) if((x)!=le_patience_curr) ++le_patience_count; -+ -+ - struct StateTableHeader - { - le_int16 stateSize; diff --git a/java/openjdk6/files/icedtea/security/20130416/8005432.patch b/java/openjdk6/files/icedtea/security/20130416/8005432.patch deleted file mode 100644 index ccb6093bdbfc..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8005432.patch +++ /dev/null @@ -1,511 +0,0 @@ ---- jdk/src/share/lib/security/java.security 2013-04-16 14:57:04.075141879 +0100 -+++ jdk/src/share/lib/security/java.security 2013-04-16 14:58:37.884647607 +0100 -@@ -128,10 +128,7 @@ - # corresponding RuntimePermission ("accessClassInPackage."+package) has - # been granted. - package.access=sun.,\ -- com.sun.xml.internal.bind.,\ -- com.sun.xml.internal.org.jvnet.staxex.,\ -- com.sun.xml.internal.stream.,\ -- com.sun.xml.internal.ws.,\ -+ com.sun.xml.internal.,\ - com.sun.imageio.,\ - com.sun.istack.internal.,\ - com.sun.jmx.,\ -@@ -164,10 +161,7 @@ - # checkPackageDefinition. - # - package.definition=sun.,\ -- com.sun.xml.internal.bind.,\ -- com.sun.xml.internal.org.jvnet.staxex.,\ -- com.sun.xml.internal.stream.,\ -- com.sun.xml.internal.ws.,\ -+ com.sun.xml.internal.,\ - com.sun.imageio.,\ - com.sun.istack.internal.,\ - com.sun.jmx.,\ ---- jdk/src/share/lib/security/java.security-solaris 2013-04-16 14:57:04.075141879 +0100 -+++ jdk/src/share/lib/security/java.security-solaris 2013-04-16 15:00:01.509990145 +0100 -@@ -129,10 +129,7 @@ - # corresponding RuntimePermission ("accessClassInPackage."+package) has - # been granted. - package.access=sun.,\ -- com.sun.xml.internal.bind.,\ -- com.sun.xml.internal.org.jvnet.staxex.,\ -- com.sun.xml.internal.stream.,\ -- com.sun.xml.internal.ws.,\ -+ com.sun.xml.internal.,\ - com.sun.imageio. - com.sun.istack.internal.,\ - com.sun.jmx.,\ -@@ -165,10 +162,7 @@ - # checkPackageDefinition. - # - package.definition=sun.,\ -- com.sun.xml.internal.bind.,\ -- com.sun.xml.internal.org.jvnet.staxex.,\ -- com.sun.xml.internal.stream.,\ -- com.sun.xml.internal.ws.,\ -+ com.sun.xml.internal.,\ - com.sun.imageio. - com.sun.istack.internal.,\ - com.sun.jmx.,\ ---- jdk/src/share/lib/security/java.security-windows 2013-04-16 14:57:04.075141879 +0100 -+++ jdk/src/share/lib/security/java.security-windows 2013-04-16 15:00:24.790356811 +0100 -@@ -129,10 +129,7 @@ - # corresponding RuntimePermission ("accessClassInPackage."+package) has - # been granted. - package.access=sun.,\ -- com.sun.xml.internal.bind.,\ -- com.sun.xml.internal.org.jvnet.staxex.,\ -- com.sun.xml.internal.stream.,\ -- com.sun.xml.internal.ws.,\ -+ com.sun.xml.internal.,\ - com.sun.imageio. - com.sun.istack.internal.,\ - com.sun.jmx.,\ -@@ -165,10 +162,7 @@ - # checkPackageDefinition. - # - package.definition=sun.,\ -- com.sun.xml.internal.bind.,\ -- com.sun.xml.internal.org.jvnet.staxex.,\ -- com.sun.xml.internal.stream.,\ -- com.sun.xml.internal.ws.,\ -+ com.sun.xml.internal.,\ - com.sun.imageio. - com.sun.istack.internal.,\ - com.sun.jmx.,\ ---- /dev/null 2013-04-25 15:02:13.000000000 -0400 -+++ jaxws/patches/jaxws_src/8005432.patch 2013-04-25 15:09:37.000000000 -0400 -@@ -0,0 +1,430 @@ -+--- src/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.java 2013-04-16 14:56:58.235048158 +0100 -++++ src/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.java 2013-04-16 14:58:37.884647607 +0100 -+@@ -1,5 +1,5 @@ -+ /* -+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. -++ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+@@ -235,7 +235,7 @@ -+ String pkg = nav.getPackageName(ci.getClazz()); -+ if(!registries.containsKey(pkg)) { -+ // insert the package's object factory -+- C c = nav.findClass(pkg + ".ObjectFactory",ci.getClazz()); -++ C c = loadObjectFactory(ci, pkg); -+ if(c!=null) -+ addRegistry(c,(Locatable)p); -+ } -+@@ -264,6 +264,15 @@ -+ return r; -+ } -+ -++ private C loadObjectFactory(ClassInfoImpl<T, C, F, M> ci, String pkg) { -++ try { -++ return nav.findClass(pkg + ".ObjectFactory", ci.getClazz()); -++ } catch (SecurityException ignored) { -++ // treat SecurityException in same way as ClassNotFoundException in this case -++ return null; -++ } -++ } -++ -+ /** -+ * Checks the uniqueness of the type name. -+ */ -+--- src/com/sun/xml/internal/ws/client/WSServiceDelegate.java 2013-04-16 14:56:58.419051111 +0100 -++++ src/com/sun/xml/internal/ws/client/WSServiceDelegate.java 2013-04-16 14:58:37.884647607 +0100 -+@@ -1,5 +1,5 @@ -+ /* -+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. -++ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+@@ -22,7 +22,6 @@ -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ */ -+- -+ package com.sun.xml.internal.ws.client; -+ -+ import com.sun.istack.internal.NotNull; -+@@ -45,8 +44,8 @@ -+ import com.sun.xml.internal.ws.client.HandlerConfigurator.AnnotationConfigurator; -+ import com.sun.xml.internal.ws.client.HandlerConfigurator.HandlerResolverImpl; -+ import com.sun.xml.internal.ws.client.sei.SEIStub; -+-import com.sun.xml.internal.ws.developer.WSBindingProvider; -+ import com.sun.xml.internal.ws.developer.UsesJAXBContextFeature; -++import com.sun.xml.internal.ws.developer.WSBindingProvider; -+ import com.sun.xml.internal.ws.model.AbstractSEIModelImpl; -+ import com.sun.xml.internal.ws.model.RuntimeModeler; -+ import com.sun.xml.internal.ws.model.SOAPSEIModel; -+@@ -59,7 +58,6 @@ -+ import com.sun.xml.internal.ws.util.JAXWSUtils; -+ import com.sun.xml.internal.ws.util.ServiceConfigurationError; -+ import com.sun.xml.internal.ws.util.ServiceFinder; -+-import static com.sun.xml.internal.ws.util.xml.XmlUtil.createDefaultCatalogResolver; -+ import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser; -+ import org.xml.sax.SAXException; -+ -+@@ -74,16 +72,18 @@ -+ import javax.xml.ws.handler.HandlerResolver; -+ import javax.xml.ws.soap.AddressingFeature; -+ import java.io.IOException; -++import java.lang.RuntimePermission; -+ import java.lang.reflect.Proxy; -+ import java.net.MalformedURLException; -+ import java.net.URL; -+-import java.security.AccessController; -+-import java.security.PrivilegedAction; -++import java.security.*; -+ import java.util.*; -+ import java.util.concurrent.Executor; -+ import java.util.concurrent.Executors; -+ import java.util.concurrent.ThreadFactory; -+ -++import static com.sun.xml.internal.ws.util.xml.XmlUtil.createDefaultCatalogResolver; -++ -+ /** -+ * <code>Service</code> objects provide the client view of a Web service. -+ * -+@@ -613,7 +613,7 @@ -+ } -+ } -+ -+- private <T> T createEndpointIFBaseProxy(@Nullable WSEndpointReference epr,QName portName, Class<T> portInterface, -++ private <T> T createEndpointIFBaseProxy(@Nullable WSEndpointReference epr,QName portName, final Class<T> portInterface, -+ WebServiceFeature[] webServiceFeatures, SEIPortInfo eif) { -+ //fail if service doesnt have WSDL -+ if (wsdlService == null) -+@@ -627,14 +627,37 @@ -+ BindingImpl binding = eif.createBinding(webServiceFeatures,portInterface); -+ SEIStub pis = new SEIStub(this, binding, eif.model, createPipeline(eif, binding), epr); -+ -+- T proxy = portInterface.cast(Proxy.newProxyInstance(portInterface.getClassLoader(), -+- new Class[]{portInterface, WSBindingProvider.class, Closeable.class}, pis)); -++ T proxy = createProxy(portInterface, pis); -++ -+ if (serviceInterceptor != null) { -+ serviceInterceptor.postCreateProxy((WSBindingProvider)proxy, portInterface); -+ } -+ return proxy; -+ } -+ -++ private <T> T createProxy(final Class<T> portInterface, final SEIStub pis) { -++ -++ // accessClassInPackage privilege needs to be granted ... -++ RuntimePermission perm = new RuntimePermission("accessClassInPackage.com.sun." + "xml.internal.*"); -++ PermissionCollection perms = perm.newPermissionCollection(); -++ perms.add(perm); -++ -++ return AccessController.doPrivileged( -++ new PrivilegedAction<T>() { -++ @Override -++ public T run() { -++ Object proxy = Proxy.newProxyInstance(portInterface.getClassLoader(), -++ new Class[]{portInterface, WSBindingProvider.class, Closeable.class}, pis); -++ return portInterface.cast(proxy); -++ } -++ }, -++ new AccessControlContext( -++ new ProtectionDomain[]{ -++ new ProtectionDomain(null, perms) -++ }) -++ ); -++ } -++ -+ /** -+ * Lists up the port names in WSDL. For error diagnostics. -+ */ -+--- src/javax/xml/soap/FactoryFinder.java 2013-04-16 14:56:58.667055090 +0100 -++++ src/javax/xml/soap/FactoryFinder.java 2013-04-16 14:58:37.888647671 +0100 -+@@ -1,5 +1,5 @@ -+ /* -+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. -++ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+@@ -50,20 +50,12 @@ -+ throws SOAPException -+ { -+ try { -+- Class spiClass; -+- if (classLoader == null) { -+- spiClass = Class.forName(className); -+- } else { -+- spiClass = classLoader.loadClass(className); -+- } -++ Class spiClass = safeLoadClass(className, classLoader); -+ return spiClass.newInstance(); -+ } catch (ClassNotFoundException x) { -+- throw new SOAPException( -+- "Provider " + className + " not found", x); -++ throw new SOAPException("Provider " + className + " not found", x); -+ } catch (Exception x) { -+- throw new SOAPException( -+- "Provider " + className + " could not be instantiated: " + x, -+- x); -++ throw new SOAPException("Provider " + className + " could not be instantiated: " + x, x); -+ } -+ } -+ -+@@ -83,6 +75,61 @@ -+ static Object find(String factoryId) -+ throws SOAPException -+ { -++ return find(factoryId, null, false); -++ } -++ -++ /** -++ * Finds the implementation <code>Class</code> object for the given -++ * factory name, or if that fails, finds the <code>Class</code> object -++ * for the given fallback class name. The arguments supplied must be -++ * used in order. If using the first argument is successful, the second -++ * one will not be used. -++ * <P> -++ * This method is package private so that this code can be shared. -++ * -++ * @return the <code>Class</code> object of the specified message factory; -++ * may be <code>null</code> -++ * -++ * @param factoryId the name of the factory to find, which is -++ * a system property -++ * @param fallbackClassName the implementation class name, which is -++ * to be used only if nothing else -++ * is found; <code>null</code> to indicate that -++ * there is no fallback class name -++ * @exception SOAPException if there is a SOAP error -++ */ -++ static Object find(String factoryId, String fallbackClassName) -++ throws SOAPException -++ { -++ return find(factoryId, fallbackClassName, true); -++ } -++ -++ /** -++ * Finds the implementation <code>Class</code> object for the given -++ * factory name, or if that fails, finds the <code>Class</code> object -++ * for the given default class name, but only if <code>tryFallback</code> -++ * is <code>true</code>. The arguments supplied must be used in order -++ * If using the first argument is successful, the second one will not -++ * be used. Note the default class name may be needed even if fallback -++ * is not to be attempted, so certain error conditions can be handled. -++ * <P> -++ * This method is package private so that this code can be shared. -++ * -++ * @return the <code>Class</code> object of the specified message factory; -++ * may not be <code>null</code> -++ * -++ * @param factoryId the name of the factory to find, which is -++ * a system property -++ * @param defaultClassName the implementation class name, which is -++ * to be used only if nothing else -++ * is found; <code>null</code> to indicate -++ * that there is no default class name -++ * @param tryFallback whether to try the default class as a -++ * fallback -++ * @exception SOAPException if there is a SOAP error -++ */ -++ static Object find(String factoryId, String defaultClassName, -++ boolean tryFallback) throws SOAPException { -+ ClassLoader classLoader; -+ try { -+ classLoader = Thread.currentThread().getContextClassLoader(); -+@@ -140,49 +187,56 @@ -+ } catch( Exception ex ) { -+ } -+ -+- return null; -++ // If not found and fallback should not be tried, return a null result. -++ if (!tryFallback) -++ return null; -++ -++ // We didn't find the class through the usual means so try the default -++ // (built in) factory if specified. -++ if (defaultClassName == null) { -++ throw new SOAPException( -++ "Provider for " + factoryId + " cannot be found", null); -++ } -++ return newInstance(defaultClassName, classLoader); -+ } -+ -+ /** -+- * Finds the implementation <code>Class</code> object for the given -+- * factory name, or if that fails, finds the <code>Class</code> object -+- * for the given fallback class name. The arguments supplied must be -+- * used in order. If using the first argument is successful, the second -+- * one will not be used. -+- * <P> -+- * This method is package private so that this code can be shared. -+- * -+- * @return the <code>Class</code> object of the specified message factory; -+- * may not be <code>null</code> -+- * -+- * @param factoryId the name of the factory to find, which is -+- * a system property -+- * @param fallbackClassName the implementation class name, which is -+- * to be used only if nothing else -+- * is found; <code>null</code> to indicate that -+- * there is no fallback class name -+- * @exception SOAPException if there is a SOAP error -++ * Loads the class, provided that the calling thread has an access to the -++ * class being loaded. If this is the specified default factory class and it -++ * is restricted by package.access we get a SecurityException and can do a -++ * Class.forName() on it so it will be loaded by the bootstrap class loader. -+ */ -+- static Object find(String factoryId, String fallbackClassName) -+- throws SOAPException -+- { -+- -+- Object obj = find(factoryId); -+- if (obj != null) -+- return obj; -++ private static Class safeLoadClass(String className, -++ ClassLoader classLoader) -++ throws ClassNotFoundException { -++ try { -++ // make sure that the current thread has an access to the package of the given name. -++ SecurityManager s = System.getSecurityManager(); -++ if (s != null) { -++ int i = className.lastIndexOf('.'); -++ if (i != -1) { -++ s.checkPackageAccess(className.substring(0, i)); -++ } -++ } -+ -+- ClassLoader classLoader; -+- try { -+- classLoader = Thread.currentThread().getContextClassLoader(); -+- } catch (Exception x) { -+- throw new SOAPException(x.toString(), x); -+- } -++ if (classLoader == null) -++ return Class.forName(className); -++ else -++ return classLoader.loadClass(className); -++ } catch (SecurityException se) { -++ // (only) default implementation can be loaded -++ // using bootstrap class loader ... -++ if (isDefaultImplementation(className)) -++ return Class.forName(className); -+ -+- if (fallbackClassName == null) { -+- throw new SOAPException( -+- "Provider for " + factoryId + " cannot be found", null); -++ throw se; -+ } -++ } -+ -+- return newInstance(fallbackClassName, classLoader); -++ private static boolean isDefaultImplementation(String className) { -++ return MessageFactory.DEFAULT_MESSAGE_FACTORY.equals(className) || -++ SOAPFactory.DEFAULT_SOAP_FACTORY.equals(className) || -++ SOAPConnectionFactory.DEFAULT_SOAP_CONNECTION_FACTORY.equals(className) || -++ SAAJMetaFactory.DEFAULT_META_FACTORY_CLASS.equals(className); -+ } -+ } -+--- src/javax/xml/soap/MessageFactory.java 2013-04-16 14:56:58.667055090 +0100 -++++ src/javax/xml/soap/MessageFactory.java 2013-04-16 14:58:37.888647671 +0100 -+@@ -1,5 +1,5 @@ -+ /* -+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. -++ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+@@ -72,7 +72,7 @@ -+ */ -+ public abstract class MessageFactory { -+ -+- static private final String DEFAULT_MESSAGE_FACTORY -++ static final String DEFAULT_MESSAGE_FACTORY -+ = "com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"; -+ -+ static private final String MESSAGE_FACTORY_PROPERTY -+@@ -105,11 +105,14 @@ -+ public static MessageFactory newInstance() -+ throws SOAPException { -+ try { -+- MessageFactory factory = (MessageFactory) -+- FactoryFinder.find(MESSAGE_FACTORY_PROPERTY); -++ MessageFactory factory = (MessageFactory) FactoryFinder.find( -++ MESSAGE_FACTORY_PROPERTY, -++ DEFAULT_MESSAGE_FACTORY, -++ false); -+ -+- if (factory != null) -++ if (factory != null) { -+ return factory; -++ } -+ -+ return newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); -+ } catch (Exception ex) { -+--- src/javax/xml/soap/SAAJMetaFactory.java 2013-04-16 14:56:58.667055090 +0100 -++++ src/javax/xml/soap/SAAJMetaFactory.java 2013-04-16 14:58:37.888647671 +0100 -+@@ -1,5 +1,5 @@ -+ /* -+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. -++ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+@@ -50,7 +50,7 @@ -+ public abstract class SAAJMetaFactory { -+ static private final String META_FACTORY_CLASS_PROPERTY = -+ "javax.xml.soap.MetaFactory"; -+- static private final String DEFAULT_META_FACTORY_CLASS = -++ static final String DEFAULT_META_FACTORY_CLASS = -+ "com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl"; -+ -+ /** -+--- src/javax/xml/soap/SOAPConnectionFactory.java 2013-04-16 14:56:58.667055090 +0100 -++++ src/javax/xml/soap/SOAPConnectionFactory.java 2013-04-16 14:58:37.888647671 +0100 -+@@ -1,5 +1,5 @@ -+ /* -+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. -++ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+@@ -44,7 +44,7 @@ -+ * A constant representing the default value for a <code>SOAPConnection</code> -+ * object. The default is the point-to-point SOAP connection. -+ */ -+- static private final String DEFAULT_SOAP_CONNECTION_FACTORY -++ static final String DEFAULT_SOAP_CONNECTION_FACTORY -+ = "com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory"; -+ -+ /** -+--- src/javax/xml/soap/SOAPFactory.java 2013-04-16 14:56:58.671055155 +0100 -++++ src/javax/xml/soap/SOAPFactory.java 2013-04-16 14:58:37.888647671 +0100 -+@@ -1,5 +1,5 @@ -+ /* -+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. -++ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+@@ -61,6 +61,12 @@ -+ "javax.xml.soap.SOAPFactory"; -+ -+ /** -++ * Class name of default <code>SOAPFactory</code> implementation. -++ */ -++ static final String DEFAULT_SOAP_FACTORY -++ = "com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl"; -++ -++ /** -+ * Creates a <code>SOAPElement</code> object from an existing DOM -+ * <code>Element</code>. If the DOM <code>Element</code> that is passed in -+ * as an argument is already a <code>SOAPElement</code> then this method -+@@ -262,7 +268,7 @@ -+ throws SOAPException -+ { -+ try { -+- SOAPFactory factory = (SOAPFactory) FactoryFinder.find(SOAP_FACTORY_PROPERTY); -++ SOAPFactory factory = (SOAPFactory) FactoryFinder.find(SOAP_FACTORY_PROPERTY, DEFAULT_SOAP_FACTORY, false); -+ if (factory != null) -+ return factory; -+ return newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); diff --git a/java/openjdk6/files/icedtea/security/20130416/8005943.patch b/java/openjdk6/files/icedtea/security/20130416/8005943.patch deleted file mode 100644 index 02188fb6f551..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8005943.patch +++ /dev/null @@ -1,202 +0,0 @@ -# HG changeset patch -# User andrew -# Date 1365784383 -3600 -# Node ID dfa1c658a62a54dbcfa02e96c51af21a3cc71907 -# Parent 0938f449476b5c89ccb68f0c195a57a0e72e9dc4 -8005943: (process) Improved Runtime.exec -Reviewed-by: alanb, ahgross - -diff --git a/src/share/classes/java/lang/ProcessBuilder.java b/src/share/classes/java/lang/ProcessBuilder.java ---- jdk/src/share/classes/java/lang/ProcessBuilder.java -+++ jdk/src/share/classes/java/lang/ProcessBuilder.java -@@ -27,6 +27,7 @@ - - import java.io.File; - import java.io.IOException; -+import java.security.AccessControlException; - import java.util.ArrayList; - import java.util.List; - import java.util.Map; -@@ -459,8 +460,9 @@ - String prog = cmdarray[0]; - - SecurityManager security = System.getSecurityManager(); -- if (security != null) -+ if (security != null) { - security.checkExec(prog); -+ } - - String dir = directory == null ? null : directory.toString(); - -@@ -470,13 +472,24 @@ - dir, - redirectErrorStream); - } catch (IOException e) { -+ String exceptionInfo = ": " + e.getMessage(); -+ Throwable cause = e; -+ if (security != null) { -+ // Can not disclose the fail reason for read-protected files. -+ try { -+ security.checkRead(prog); -+ } catch (AccessControlException ace) { -+ exceptionInfo = ""; -+ cause = ace; -+ } -+ } - // It's much easier for us to create a high-quality error - // message than the low-level C code which found the problem. - throw new IOException( - "Cannot run program \"" + prog + "\"" - + (dir == null ? "" : " (in directory \"" + dir + "\")") -- + ": " + e.getMessage(), -- e); -+ + exceptionInfo, -+ cause); - } - } - } -diff --git a/src/windows/classes/java/lang/ProcessImpl.java b/src/windows/classes/java/lang/ProcessImpl.java ---- jdk/src/windows/classes/java/lang/ProcessImpl.java -+++ jdk/src/windows/classes/java/lang/ProcessImpl.java -@@ -47,6 +47,88 @@ - return new ProcessImpl(cmdarray, envblock, dir, redirectErrorStream); - } - -+ // We guarantee the only command file execution for implicit [cmd.exe] run. -+ // http://technet.microsoft.com/en-us/library/bb490954.aspx -+ private static final char CMD_BAT_ESCAPE[] = {' ', '\t', '<', '>', '&', '|', '^'}; -+ private static final char WIN32_EXECUTABLE_ESCAPE[] = {' ', '\t', '<', '>'}; -+ -+ private static boolean isQuoted(boolean noQuotesInside, String arg, -+ String errorMessage) { -+ int lastPos = arg.length() - 1; -+ if (lastPos >=1 && arg.charAt(0) == '"' && arg.charAt(lastPos) == '"') { -+ // The argument has already been quoted. -+ if (noQuotesInside) { -+ if (arg.indexOf('"', 1) != lastPos) { -+ // There is ["] inside. -+ throw new IllegalArgumentException(errorMessage); -+ } -+ } -+ return true; -+ } -+ if (noQuotesInside) { -+ if (arg.indexOf('"') >= 0) { -+ // There is ["] inside. -+ throw new IllegalArgumentException(errorMessage); -+ } -+ } -+ return false; -+ } -+ -+ private static boolean needsEscaping(boolean isCmdFile, String arg) { -+ // Switch off MS heuristic for internal ["]. -+ // Please, use the explicit [cmd.exe] call -+ // if you need the internal ["]. -+ // Example: "cmd.exe", "/C", "Extended_MS_Syntax" -+ -+ // For [.exe] or [.com] file the unpaired/internal ["] -+ // in the argument is not a problem. -+ boolean argIsQuoted = isQuoted(isCmdFile, arg, -+ "Argument has embedded quote, use the explicit CMD.EXE call."); -+ -+ if (!argIsQuoted) { -+ char testEscape[] = isCmdFile -+ ? CMD_BAT_ESCAPE -+ : WIN32_EXECUTABLE_ESCAPE; -+ for (int i = 0; i < testEscape.length; ++i) { -+ if (arg.indexOf(testEscape[i]) >= 0) { -+ return true; -+ } -+ } -+ } -+ return false; -+ } -+ -+ private static String getExecutablePath(String path) -+ throws IOException -+ { -+ boolean pathIsQuoted = isQuoted(true, path, -+ "Executable name has embedded quote, split the arguments"); -+ -+ // Win32 CreateProcess requires path to be normalized -+ File fileToRun = new File(pathIsQuoted -+ ? path.substring(1, path.length() - 1) -+ : path); -+ -+ // From the [CreateProcess] function documentation: -+ // -+ // "If the file name does not contain an extension, .exe is appended. -+ // Therefore, if the file name extension is .com, this parameter -+ // must include the .com extension. If the file name ends in -+ // a period (.) with no extension, or if the file name contains a path, -+ // .exe is not appended." -+ // -+ // "If the file name !does not contain a directory path!, -+ // the system searches for the executable file in the following -+ // sequence:..." -+ // -+ // In practice ANY non-existent path is extended by [.exe] extension -+ // in the [CreateProcess] funcion with the only exception: -+ // the path ends by (.) -+ -+ return fileToRun.getPath(); -+ } -+ -+ - private long handle = 0; - private FileDescriptor stdin_fd; - private FileDescriptor stdout_fd; -@@ -61,30 +143,31 @@ - boolean redirectErrorStream) - throws IOException - { -- // Win32 CreateProcess requires cmd[0] to be normalized -- cmd[0] = new File(cmd[0]).getPath(); -+ // The [executablePath] is not quoted for any case. -+ String executablePath = getExecutablePath(cmd[0]); -+ -+ // We need to extend the argument verification procedure -+ // to guarantee the only command file execution for implicit [cmd.exe] -+ // run. -+ String upPath = executablePath.toUpperCase(); -+ boolean isCmdFile = (upPath.endsWith(".CMD") || upPath.endsWith(".BAT")); - - StringBuilder cmdbuf = new StringBuilder(80); -- for (int i = 0; i < cmd.length; i++) { -- if (i > 0) { -- cmdbuf.append(' '); -- } -+ -+ // Quotation protects from interpretation of the [path] argument as -+ // start of longer path with spaces. Quotation has no influence to -+ // [.exe] extension heuristic. -+ cmdbuf.append('"'); -+ cmdbuf.append(executablePath); -+ cmdbuf.append('"'); -+ -+ for (int i = 1; i < cmd.length; i++) { -+ cmdbuf.append(' '); - String s = cmd[i]; -- if (s.indexOf(' ') >= 0 || s.indexOf('\t') >= 0) { -- if (s.charAt(0) != '"') { -- cmdbuf.append('"'); -- cmdbuf.append(s); -- if (s.endsWith("\\")) { -- cmdbuf.append("\\"); -- } -- cmdbuf.append('"'); -- } else if (s.endsWith("\"")) { -- /* The argument has already been quoted. */ -- cmdbuf.append(s); -- } else { -- /* Unmatched quote for the argument. */ -- throw new IllegalArgumentException(); -- } -+ if (needsEscaping(isCmdFile, s)) { -+ cmdbuf.append('"'); -+ cmdbuf.append(s); -+ cmdbuf.append('"'); - } else { - cmdbuf.append(s); - } diff --git a/java/openjdk6/files/icedtea/security/20130416/8006309.patch b/java/openjdk6/files/icedtea/security/20130416/8006309.patch deleted file mode 100644 index 26c2ac56cb7f..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8006309.patch +++ /dev/null @@ -1,22 +0,0 @@ -# HG changeset patch -# User poonam -# Date 1362616238 28800 -# Node ID ef36be1ae9bc7d061721f8890797e5d89c901846 -# Parent cf2b7f0f7a2188a1421bdd033e88bf4b0aa6870c -8006309: More reliable control panel operation -Summary: Added a comment in the dead Kernel code -Reviewed-by: ahgross, sla, coleenp - -diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp ---- hotspot/src/share/vm/runtime/thread.cpp -+++ hotspot/src/share/vm/runtime/thread.cpp -@@ -3416,6 +3416,9 @@ - os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), name); - library = os::dll_load(buffer, ebuf, sizeof ebuf); - #ifdef KERNEL -+ -+ // Dead code, KERNEL is never built in JDK7 or later. This code will be removed in a future update release. -+ - // Download instrument dll - if (library == NULL && strcmp(name, "instrument") == 0) { - char *props = Arguments::get_kernel_properties(); diff --git a/java/openjdk6/files/icedtea/security/20130416/8006435.patch b/java/openjdk6/files/icedtea/security/20130416/8006435.patch deleted file mode 100644 index fc2aa8d125c2..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8006435.patch +++ /dev/null @@ -1,76 +0,0 @@ -# HG changeset patch -# User andrew -# Date 1365784460 -3600 -# Node ID e0803f17f824df0bbedf0dd03aa06938389b1b9f -# Parent dfa1c658a62a54dbcfa02e96c51af21a3cc71907 -8006435: Improvements in JMX -Summary: Improvements in JMX -Reviewed-by: dfuchs, skoivu - -diff --git a/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java b/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java ---- jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java -+++ jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -213,7 +213,6 @@ - - Object moi = null; - -- - // ------------------------------ - // ------------------------------ - Constructor cons = findConstructor(theClass, null); -@@ -224,6 +223,7 @@ - // Instantiate the new object - try { - ReflectUtil.checkPackageAccess(theClass); -+ ReflectUtil.ensureClassAccess(theClass); - moi= cons.newInstance(); - } catch (InvocationTargetException e) { - // Wrap the exception. -@@ -270,7 +270,6 @@ - checkMBeanPermission(theClass, null, null, "instantiate"); - - // Instantiate the new object -- - // ------------------------------ - // ------------------------------ - final Class[] tab; -@@ -301,6 +300,7 @@ - } - try { - ReflectUtil.checkPackageAccess(theClass); -+ ReflectUtil.ensureClassAccess(theClass); - moi = cons.newInstance(params); - } - catch (NoSuchMethodError error) { -diff --git a/src/share/classes/sun/reflect/misc/ReflectUtil.java b/src/share/classes/sun/reflect/misc/ReflectUtil.java ---- jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java -+++ jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -46,6 +46,14 @@ - return cls.newInstance(); - } - -+ public static void ensureClassAccess(Class clazz) -+ throws IllegalAccessException -+ { -+ int mod = clazz.getModifiers(); -+ if ( ! Modifier.isPublic(mod) ){ -+ throw new IllegalAccessException("Class is not public and can't be instantiated"); -+ } -+ } - /* - * Reflection.ensureMemberAccess is overly-restrictive - * due to a bug. We awkwardly work around it for now. diff --git a/java/openjdk6/files/icedtea/security/20130416/8006790.patch b/java/openjdk6/files/icedtea/security/20130416/8006790.patch deleted file mode 100644 index b54d5230136c..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8006790.patch +++ /dev/null @@ -1,166 +0,0 @@ -# HG changeset patch -# User andrew -# Date 1365784684 -3600 -# Node ID 08f7ab5f86a27c17b648f3b47f800393d939140c -# Parent e0803f17f824df0bbedf0dd03aa06938389b1b9f -8006790: Improve checking for windows -Reviewed-by: art, mschoene - -diff --git a/src/share/classes/java/awt/Window.java b/src/share/classes/java/awt/Window.java ---- jdk/src/share/classes/java/awt/Window.java -+++ jdk/src/share/classes/java/awt/Window.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -2055,7 +2055,7 @@ - WindowPeer peer = (WindowPeer)this.peer; - synchronized(getTreeLock()) { - if (peer != null) { -- peer.setAlwaysOnTop(alwaysOnTop); -+ peer.updateAlwaysOnTopState(); - } - } - } -diff --git a/src/share/classes/java/awt/peer/WindowPeer.java b/src/share/classes/java/awt/peer/WindowPeer.java ---- jdk/src/share/classes/java/awt/peer/WindowPeer.java -+++ jdk/src/share/classes/java/awt/peer/WindowPeer.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -37,7 +37,7 @@ - public interface WindowPeer extends ContainerPeer { - void toFront(); - void toBack(); -- void setAlwaysOnTop(boolean alwaysOnTop); -+ void updateAlwaysOnTopState(); - void updateFocusableWindowState(); - boolean requestWindowFocus(); - void setModalBlocked(Dialog blocker, boolean blocked); -diff --git a/src/share/classes/sun/awt/EmbeddedFrame.java b/src/share/classes/sun/awt/EmbeddedFrame.java ---- jdk/src/share/classes/sun/awt/EmbeddedFrame.java -+++ jdk/src/share/classes/sun/awt/EmbeddedFrame.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -551,7 +551,7 @@ - public void toBack() {} - public void updateFocusableWindowState() {} - public void updateAlwaysOnTop() {} -- public void setAlwaysOnTop(boolean alwaysOnTop) {} -+ public void updateAlwaysOnTopState() {} - public Component getGlobalHeavyweightFocusOwner() { return null; } - public void setBoundsPrivate(int x, int y, int width, int height) { - setBounds(x, y, width, height, SET_BOUNDS); -diff --git a/src/solaris/classes/sun/awt/X11/XWindowPeer.java b/src/solaris/classes/sun/awt/X11/XWindowPeer.java ---- jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java -+++ jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -1018,8 +1018,8 @@ - XLayerProtocol.LAYER_NORMAL); - } - -- public void setAlwaysOnTop(boolean alwaysOnTop) { -- this.alwaysOnTop = alwaysOnTop; -+ public void updateAlwaysOnTopState() { -+ this.alwaysOnTop = ((Window) this.target).isAlwaysOnTop(); - updateAlwaysOnTop(); - } - -diff --git a/src/windows/classes/sun/awt/windows/WFileDialogPeer.java b/src/windows/classes/sun/awt/windows/WFileDialogPeer.java ---- jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java -+++ jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -199,7 +199,7 @@ - - // unused methods. Overridden to disable this functionality as - // it requires HWND which is not available for FileDialog -- public void setAlwaysOnTop(boolean value) {} -+ public void updateAlwaysOnTopState() {} - public void setDirectory(String dir) {} - public void setFile(String file) {} - public void setTitle(String title) {} -diff --git a/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java b/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java ---- jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java -+++ jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -115,7 +115,7 @@ - // unused methods. Overridden to disable this functionality as - // it requires HWND which is not available for FileDialog - void initialize() {} -- public void setAlwaysOnTop(boolean b) {} -+ public void updateAlwaysOnTopState() {} - public void setResizable(boolean resizable) {} - public void hide() {} - public void enable() {} -diff --git a/src/windows/classes/sun/awt/windows/WWindowPeer.java b/src/windows/classes/sun/awt/windows/WWindowPeer.java ---- jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java -+++ jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -112,6 +112,10 @@ - } - } - -+ public void updateAlwaysOnTopState() { -+ setAlwaysOnTop(((Window)target).isAlwaysOnTop()); -+ } -+ - public void updateFocusableWindowState() { - setFocusableWindow(((Window)target).isFocusableWindow()); - } -# HG changeset patch -# User andrew -# Date 1365787780 -3600 -# Node ID f135ac267a382a052f563d7dd8fb001cd27827be -# Parent 014d4beffa044a4ae8f7f82618bdf9bc659056a7 -Extend 8006790 to cover the Motif peer - -diff --git a/src/solaris/classes/sun/awt/motif/MWindowPeer.java b/src/solaris/classes/sun/awt/motif/MWindowPeer.java ---- jdk/src/solaris/classes/sun/awt/motif/MWindowPeer.java -+++ jdk/src/solaris/classes/sun/awt/motif/MWindowPeer.java -@@ -183,6 +183,10 @@ - updateAlwaysOnTop(alwaysOnTop); - } - -+ public void updateAlwaysOnTopState() { -+ setAlwaysOnTop(((Window)target).isAlwaysOnTop()); -+ } -+ - public void toFront() { - if (target.isVisible()) { - updateFocusableWindowState(); diff --git a/java/openjdk6/files/icedtea/security/20130416/8006795.patch b/java/openjdk6/files/icedtea/security/20130416/8006795.patch deleted file mode 100644 index ec0d6bda9ac6..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8006795.patch +++ /dev/null @@ -1,35 +0,0 @@ -# HG changeset patch -# User prr -# Date 1360268071 28800 -# Node ID 2da00862b3dba3b690f5e212a00fe984e9f648ed -# Parent 08f7ab5f86a27c17b648f3b47f800393d939140c -8006795: Improve font warning messages -Reviewed-by: bae, jgodinez, mschoene - -diff --git a/src/share/classes/sun/font/CMap.java b/src/share/classes/sun/font/CMap.java ---- jdk/src/share/classes/sun/font/CMap.java -+++ jdk/src/share/classes/sun/font/CMap.java -@@ -841,7 +841,6 @@ - - CMapFormat6(ByteBuffer bbuffer, int offset, char[] xlat) { - -- System.err.println("WARNING: CMapFormat8 is untested."); - bbuffer.position(offset+6); - CharBuffer buffer = bbuffer.asCharBuffer(); - firstCode = buffer.get(); -@@ -884,7 +883,6 @@ - - CMapFormat8(ByteBuffer bbuffer, int offset, char[] xlat) { - -- System.err.println("WARNING: CMapFormat8 is untested."); - bbuffer.position(12); - bbuffer.get(is32); - nGroups = bbuffer.getInt(); -@@ -915,7 +913,6 @@ - - CMapFormat10(ByteBuffer bbuffer, int offset, char[] xlat) { - -- System.err.println("WARNING: CMapFormat10 is untested."); - firstCode = bbuffer.getInt() & INTMASK; - entryCount = bbuffer.getInt() & INTMASK; - bbuffer.position(offset+20); diff --git a/java/openjdk6/files/icedtea/security/20130416/8007406.patch b/java/openjdk6/files/icedtea/security/20130416/8007406.patch deleted file mode 100644 index 4d4ff7df7537..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8007406.patch +++ /dev/null @@ -1,31 +0,0 @@ -# HG changeset patch -# User raginip -# Date 1362146770 0 -# Node ID 014d4beffa044a4ae8f7f82618bdf9bc659056a7 -# Parent 2da00862b3dba3b690f5e212a00fe984e9f648ed -8007406: Improve accessibility of AccessBridge -Reviewed-by: skoivu, mullan, ptbrunet - -diff --git a/src/share/lib/security/java.security-windows b/src/share/lib/security/java.security-windows ---- jdk/src/share/lib/security/java.security-windows -+++ jdk/src/share/lib/security/java.security-windows -@@ -149,7 +149,8 @@ - com.sun.org.apache.xml.internal.res.,\ - com.sun.org.apache.xml.internal.serializer.utils.,\ - com.sun.org.apache.xml.internal.utils.,\ -- com.sun.org.glassfish. -+ com.sun.org.glassfish.,\ -+ com.sun.java.accessibility. - - # - # List of comma-separated packages that start with or equal this string -@@ -182,7 +183,8 @@ - com.sun.org.apache.xml.internal.res.,\ - com.sun.org.apache.xml.internal.serializer.utils.,\ - com.sun.org.apache.xml.internal.utils.,\ -- com.sun.org.glassfish. -+ com.sun.org.glassfish.,\ -+ com.sun.java.accessibility. - - # - # Determines whether this properties file can be appended to diff --git a/java/openjdk6/files/icedtea/security/20130416/8007617.patch b/java/openjdk6/files/icedtea/security/20130416/8007617.patch deleted file mode 100644 index 452ef78c09ff..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8007617.patch +++ /dev/null @@ -1,376 +0,0 @@ -# HG changeset patch -# User bae -# Date 1361531665 -14400 -# Node ID cf93d3828aa8f85003f3668f069646205c39c087 -# Parent ddd9e6df700fa59366b4560e58a3b7b0a16b4746 -8007617: Better validation of images -Reviewed-by: prr, jgodinez - -diff --git openjdk/jdk/src/share/classes/sun/awt/image/ImageRepresentation.java openjdk/jdk/src/share/classes/sun/awt/image/ImageRepresentation.java ---- jdk/src/share/classes/sun/awt/image/ImageRepresentation.java -+++ jdk/src/share/classes/sun/awt/image/ImageRepresentation.java -@@ -333,10 +333,10 @@ public class ImageRepresentation extends - hints = h; - } - -- private native void setICMpixels(int x, int y, int w, int h, int[] lut, -+ private native boolean setICMpixels(int x, int y, int w, int h, int[] lut, - byte[] pix, int off, int scansize, - IntegerComponentRaster ict); -- private native int setDiffICM(int x, int y, int w, int h, int[] lut, -+ private native boolean setDiffICM(int x, int y, int w, int h, int[] lut, - int transPix, int numLut, IndexColorModel icm, - byte[] pix, int off, int scansize, - ByteComponentRaster bct, int chanOff); -@@ -426,10 +426,10 @@ public class ImageRepresentation extends - IndexColorModel icm = (IndexColorModel) model; - ByteComponentRaster bct = (ByteComponentRaster) biRaster; - int numlut = numSrcLUT; -- if (setDiffICM(x, y, w, h, srcLUT, srcLUTtransIndex, -+ if (!setDiffICM(x, y, w, h, srcLUT, srcLUTtransIndex, - numSrcLUT, icm, - pix, off, scansize, bct, -- bct.getDataOffset(0)) == 0) { -+ bct.getDataOffset(0))) { - convertToRGB(); - } - else { -@@ -470,9 +470,14 @@ public class ImageRepresentation extends - if (s_useNative) { - // Note that setICMpixels modifies the raster directly - // so we must mark it as changed afterwards -- setICMpixels(x, y, w, h, srcLUT, pix, off, scansize, -- iraster); -- iraster.markDirty(); -+ if (setICMpixels(x, y, w, h, srcLUT, pix, off, scansize, -+ iraster)) -+ { -+ iraster.markDirty(); -+ } else { -+ abort(); -+ return; -+ } - } - else { - int[] storage = new int[w*h]; -diff --git openjdk/jdk/src/share/native/sun/awt/image/awt_ImageRep.c openjdk/jdk/src/share/native/sun/awt/image/awt_ImageRep.c ---- jdk/src/share/native/sun/awt/image/awt_ImageRep.c -+++ jdk/src/share/native/sun/awt/image/awt_ImageRep.c -@@ -45,6 +45,53 @@ static int findIdx(unsigned int rgb, uns - # define TRUE 1 - #endif - -+#define CHECK_STRIDE(yy, hh, ss) \ -+ if ((ss) != 0) { \ -+ int limit = 0x7fffffff / ((ss) > 0 ? (ss) : -(ss)); \ -+ if (limit < (yy) || limit < ((yy) + (hh) - 1)) { \ -+ /* integer oveflow */ \ -+ return JNI_FALSE; \ -+ } \ -+ } \ -+ -+#define CHECK_SRC() \ -+ do { \ -+ int pixeloffset; \ -+ if (off < 0 || off >= srcDataLength) { \ -+ return JNI_FALSE; \ -+ } \ -+ CHECK_STRIDE(0, h, scansize); \ -+ \ -+ /* check scansize */ \ -+ pixeloffset = scansize * (h - 1); \ -+ if ((w - 1) > (0x7fffffff - pixeloffset)) { \ -+ return JNI_FALSE; \ -+ } \ -+ pixeloffset += (w - 1); \ -+ \ -+ if (off > (0x7fffffff - pixeloffset)) { \ -+ return JNI_FALSE; \ -+ } \ -+ } while (0) \ -+ -+#define CHECK_DST(xx, yy) \ -+ do { \ -+ int soffset = (yy) * sStride; \ -+ int poffset = (xx) * pixelStride; \ -+ if (poffset > (0x7fffffff - soffset)) { \ -+ return JNI_FALSE; \ -+ } \ -+ poffset += soffset; \ -+ if (dstDataOff > (0x7fffffff - poffset)) { \ -+ return JNI_FALSE; \ -+ } \ -+ poffset += dstDataOff; \ -+ \ -+ if (poffset < 0 || poffset >= dstDataLength) { \ -+ return JNI_FALSE; \ -+ } \ -+ } while (0) \ -+ - static jfieldID s_JnumSrcLUTID; - static jfieldID s_JsrcLUTtransIndexID; - -@@ -58,7 +105,7 @@ Java_sun_awt_image_ImageRepresentation_i - /* - * This routine is used to draw ICM pixels into a default color model - */ --JNIEXPORT void JNICALL -+JNIEXPORT jboolean JNICALL - Java_sun_awt_image_ImageRepresentation_setICMpixels(JNIEnv *env, jclass cls, - jint x, jint y, jint w, - jint h, jintArray jlut, -@@ -67,7 +114,10 @@ Java_sun_awt_image_ImageRepresentation_s - jobject jict) - { - unsigned char *srcData = NULL; -+ jint srcDataLength; - int *dstData; -+ jint dstDataLength; -+ jint dstDataOff; - int *dstP, *dstyP; - unsigned char *srcyP, *srcP; - int *srcLUT = NULL; -@@ -80,12 +130,20 @@ Java_sun_awt_image_ImageRepresentation_s - - if (JNU_IsNull(env, jlut)) { - JNU_ThrowNullPointerException(env, "NullPointerException"); -- return; -+ return JNI_FALSE; - } - - if (JNU_IsNull(env, jpix)) { - JNU_ThrowNullPointerException(env, "NullPointerException"); -- return; -+ return JNI_FALSE; -+ } -+ -+ if (x < 0 || w < 1 || (0x7fffffff - x) < w) { -+ return JNI_FALSE; -+ } -+ -+ if (y < 0 || h < 1 || (0x7fffffff - y) < h) { -+ return JNI_FALSE; - } - - sStride = (*env)->GetIntField(env, jict, g_ICRscanstrID); -@@ -93,10 +151,47 @@ Java_sun_awt_image_ImageRepresentation_s - joffs = (*env)->GetObjectField(env, jict, g_ICRdataOffsetsID); - jdata = (*env)->GetObjectField(env, jict, g_ICRdataID); - -+ if (JNU_IsNull(env, jdata)) { -+ /* no destination buffer */ -+ return JNI_FALSE; -+ } -+ -+ if (JNU_IsNull(env, joffs) || (*env)->GetArrayLength(env, joffs) < 1) { -+ /* invalid data offstes in raster */ -+ return JNI_FALSE; -+ } -+ -+ srcDataLength = (*env)->GetArrayLength(env, jpix); -+ dstDataLength = (*env)->GetArrayLength(env, jdata); -+ -+ cOffs = (int *) (*env)->GetPrimitiveArrayCritical(env, joffs, NULL); -+ if (cOffs == NULL) { -+ JNU_ThrowNullPointerException(env, "Null channel offset array"); -+ return JNI_FALSE; -+ } -+ -+ dstDataOff = cOffs[0]; -+ -+ /* the offset array is not needed anymore and can be released */ -+ (*env)->ReleasePrimitiveArrayCritical(env, joffs, cOffs, JNI_ABORT); -+ joffs = NULL; -+ cOffs = NULL; -+ -+ /* do basic validation: make sure that offsets for -+ * first pixel and for last pixel are safe to calculate and use */ -+ CHECK_STRIDE(y, h, sStride); -+ CHECK_STRIDE(x, w, pixelStride); -+ -+ CHECK_DST(x, y); -+ CHECK_DST(x + w -1, y + h - 1); -+ -+ /* check source array */ -+ CHECK_SRC(); -+ - srcLUT = (int *) (*env)->GetPrimitiveArrayCritical(env, jlut, NULL); - if (srcLUT == NULL) { - JNU_ThrowNullPointerException(env, "Null IndexColorModel LUT"); -- return; -+ return JNI_FALSE; - } - - srcData = (unsigned char *) (*env)->GetPrimitiveArrayCritical(env, jpix, -@@ -104,27 +199,18 @@ Java_sun_awt_image_ImageRepresentation_s - if (srcData == NULL) { - (*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT, JNI_ABORT); - JNU_ThrowNullPointerException(env, "Null data array"); -- return; -- } -- -- cOffs = (int *) (*env)->GetPrimitiveArrayCritical(env, joffs, NULL); -- if (cOffs == NULL) { -- (*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT, JNI_ABORT); -- (*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT); -- JNU_ThrowNullPointerException(env, "Null channel offset array"); -- return; -+ return JNI_FALSE; - } - - dstData = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, NULL); - if (dstData == NULL) { - (*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT, JNI_ABORT); - (*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT); -- (*env)->ReleasePrimitiveArrayCritical(env, joffs, cOffs, JNI_ABORT); - JNU_ThrowNullPointerException(env, "Null tile data array"); -- return; -+ return JNI_FALSE; - } - -- dstyP = dstData + cOffs[0] + y*sStride + x*pixelStride; -+ dstyP = dstData + dstDataOff + y*sStride + x*pixelStride; - srcyP = srcData + off; - for (yIdx = 0; yIdx < h; yIdx++, srcyP += scansize, dstyP+=sStride) { - srcP = srcyP; -@@ -137,12 +223,12 @@ Java_sun_awt_image_ImageRepresentation_s - /* Release the locked arrays */ - (*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT, JNI_ABORT); - (*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT); -- (*env)->ReleasePrimitiveArrayCritical(env, joffs, cOffs, JNI_ABORT); - (*env)->ReleasePrimitiveArrayCritical(env, jdata, dstData, JNI_ABORT); - -+ return JNI_TRUE; - } - --JNIEXPORT jint JNICALL -+JNIEXPORT jboolean JNICALL - Java_sun_awt_image_ImageRepresentation_setDiffICM(JNIEnv *env, jclass cls, - jint x, jint y, jint w, - jint h, jintArray jlut, -@@ -150,7 +236,7 @@ Java_sun_awt_image_ImageRepresentation_s - jobject jicm, - jbyteArray jpix, jint off, - jint scansize, -- jobject jbct, jint chanOff) -+ jobject jbct, jint dstDataOff) - { - unsigned int *srcLUT = NULL; - unsigned int *newLUT = NULL; -@@ -159,6 +245,8 @@ Java_sun_awt_image_ImageRepresentation_s - int mapSize; - jobject jdata = NULL; - jobject jnewlut = NULL; -+ jint srcDataLength; -+ jint dstDataLength; - unsigned char *srcData; - unsigned char *dstData; - unsigned char *dataP; -@@ -174,13 +262,22 @@ Java_sun_awt_image_ImageRepresentation_s - - if (JNU_IsNull(env, jlut)) { - JNU_ThrowNullPointerException(env, "NullPointerException"); -- return 0; -+ return JNI_FALSE; - } - - if (JNU_IsNull(env, jpix)) { - JNU_ThrowNullPointerException(env, "NullPointerException"); -- return 0; -+ return JNI_FALSE; - } -+ -+ if (x < 0 || w < 1 || (0x7fffffff - x) < w) { -+ return JNI_FALSE; -+ } -+ -+ if (y < 0 || h < 1 || (0x7fffffff - y) < h) { -+ return JNI_FALSE; -+ } -+ - - sStride = (*env)->GetIntField(env, jbct, g_BCRscanstrID); - pixelStride =(*env)->GetIntField(env, jbct, g_BCRpixstrID); -@@ -193,14 +290,31 @@ Java_sun_awt_image_ImageRepresentation_s - of byte data type, so we have to convert the image data - to default representation. - */ -- return 0; -+ return JNI_FALSE; - } - -+ if (JNU_IsNull(env, jdata)) { -+ /* no destination buffer */ -+ return JNI_FALSE; -+ } -+ -+ srcDataLength = (*env)->GetArrayLength(env, jpix); -+ dstDataLength = (*env)->GetArrayLength(env, jdata); -+ -+ CHECK_STRIDE(y, h, sStride); -+ CHECK_STRIDE(x, w, pixelStride); -+ -+ CHECK_DST(x, y); -+ CHECK_DST(x + w -1, y + h - 1); -+ -+ /* check source array */ -+ CHECK_SRC(); -+ - srcLUT = (unsigned int *) (*env)->GetPrimitiveArrayCritical(env, jlut, - NULL); - if (srcLUT == NULL) { - /* out of memory error already thrown */ -- return 0; -+ return JNI_FALSE; - } - - newLUT = (unsigned int *) (*env)->GetPrimitiveArrayCritical(env, jnewlut, -@@ -208,7 +323,7 @@ Java_sun_awt_image_ImageRepresentation_s - (*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT, - JNI_ABORT); - /* out of memory error already thrown */ -- return 0; -+ return JNI_FALSE; - } - - newNumLut = numLut; -@@ -219,7 +334,7 @@ Java_sun_awt_image_ImageRepresentation_s - (*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT, - JNI_ABORT); - (*env)->ReleasePrimitiveArrayCritical(env, jnewlut, newLUT, JNI_ABORT); -- return 0; -+ return JNI_FALSE; - } - - /* Don't need these any more */ -@@ -239,7 +354,7 @@ Java_sun_awt_image_ImageRepresentation_s - NULL); - if (srcData == NULL) { - /* out of memory error already thrown */ -- return 0; -+ return JNI_FALSE; - } - - dstData = (unsigned char *) (*env)->GetPrimitiveArrayCritical(env, jdata, -@@ -247,10 +362,10 @@ Java_sun_awt_image_ImageRepresentation_s - if (dstData == NULL) { - (*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT); - /* out of memory error already thrown */ -- return 0; -+ return JNI_FALSE; - } - -- ydataP = dstData + chanOff + y*sStride + x*pixelStride; -+ ydataP = dstData + dstDataOff + y*sStride + x*pixelStride; - ypixP = srcData + off; - - for (i=0; i < h; i++) { -@@ -268,7 +383,7 @@ Java_sun_awt_image_ImageRepresentation_s - (*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT); - (*env)->ReleasePrimitiveArrayCritical(env, jdata, dstData, JNI_ABORT); - -- return 1; -+ return JNI_TRUE; - } - - static int compareLUTs(unsigned int *lut1, int numLut1, int transIdx, diff --git a/java/openjdk6/files/icedtea/security/20130416/8007667.patch b/java/openjdk6/files/icedtea/security/20130416/8007667.patch deleted file mode 100644 index 132760bf08ea..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8007667.patch +++ /dev/null @@ -1,579 +0,0 @@ -# HG changeset patch -# User bae -# Date 1361823317 -14400 -# Node ID d868fe7c7618e5b55eea8dd69ee5d099c71816e0 -# Parent 6784c9903db7f65a93279ac12b7fc00c57dbaaa5 -8007667: Better image reading -Reviewed-by: prr, jgodinez - -diff --git openjdk/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java openjdk/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java ---- jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java -+++ jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java -@@ -281,12 +281,17 @@ - * sending warnings to listeners. - */ - protected void warningOccurred(int code) { -- if ((code < 0) || (code > MAX_WARNING)){ -- throw new InternalError("Invalid warning index"); -- } -- processWarningOccurred -- ("com.sun.imageio.plugins.jpeg.JPEGImageReaderResources", -- Integer.toString(code)); -+ cbLock.lock(); -+ try { -+ if ((code < 0) || (code > MAX_WARNING)){ -+ throw new InternalError("Invalid warning index"); -+ } -+ processWarningOccurred -+ ("com.sun.imageio.plugins.jpeg.JPEGImageReaderResources", -+ Integer.toString(code)); -+ } finally { -+ cbLock.unlock(); -+ } - } - - /** -@@ -303,7 +308,12 @@ - * library warnings from being printed to stderr. - */ - protected void warningWithMessage(String msg) { -- processWarningOccurred(msg); -+ cbLock.lock(); -+ try { -+ processWarningOccurred(msg); -+ } finally { -+ cbLock.unlock(); -+ } - } - - public void setInput(Object input, -@@ -312,18 +322,55 @@ - { - setThreadLock(); - try { -+ cbLock.check(); -+ - super.setInput(input, seekForwardOnly, ignoreMetadata); - this.ignoreMetadata = ignoreMetadata; - resetInternalState(); - iis = (ImageInputStream) input; // Always works -- setSource(structPointer, iis); -+ setSource(structPointer); - } finally { - clearThreadLock(); - } - } - -- private native void setSource(long structPointer, -- ImageInputStream source); -+ /** -+ * This method is called from native code in order to fill -+ * native input buffer. -+ * -+ * We block any attempt to change the reading state during this -+ * method, in order to prevent a corruption of the native decoder -+ * state. -+ * -+ * @return number of bytes read from the stream. -+ */ -+ private int readInputData(byte[] buf, int off, int len) throws IOException { -+ cbLock.lock(); -+ try { -+ return iis.read(buf, off, len); -+ } finally { -+ cbLock.unlock(); -+ } -+ } -+ -+ /** -+ * This method is called from the native code in order to -+ * skip requested number of bytes in the input stream. -+ * -+ * @param n -+ * @return -+ * @throws IOException -+ */ -+ private long skipInputBytes(long n) throws IOException { -+ cbLock.lock(); -+ try { -+ return iis.skipBytes(n); -+ } finally { -+ cbLock.unlock(); -+ } -+ } -+ -+ private native void setSource(long structPointer); - - private void checkTablesOnly() throws IOException { - if (debug) { -@@ -375,6 +422,8 @@ - public int getNumImages(boolean allowSearch) throws IOException { - setThreadLock(); - try { // locked thread -+ cbLock.check(); -+ - return getNumImagesOnThread(allowSearch); - } finally { - clearThreadLock(); -@@ -574,8 +623,13 @@ - if (debug) { - System.out.println("pushing back " + num + " bytes"); - } -- iis.seek(iis.getStreamPosition()-num); -- // The buffer is clear after this, so no need to set haveSeeked. -+ cbLock.lock(); -+ try { -+ iis.seek(iis.getStreamPosition()-num); -+ // The buffer is clear after this, so no need to set haveSeeked. -+ } finally { -+ cbLock.unlock(); -+ } - } - - /** -@@ -645,7 +699,12 @@ - * Ignore this profile. - */ - iccCS = null; -- warningOccurred(WARNING_IGNORE_INVALID_ICC); -+ cbLock.lock(); -+ try { -+ warningOccurred(WARNING_IGNORE_INVALID_ICC); -+ } finally { -+ cbLock.unlock(); -+ } - - return; - } -@@ -680,6 +739,7 @@ - setThreadLock(); - try { - if (currentImage != imageIndex) { -+ cbLock.check(); - readHeader(imageIndex, true); - } - return width; -@@ -692,6 +752,7 @@ - setThreadLock(); - try { - if (currentImage != imageIndex) { -+ cbLock.check(); - readHeader(imageIndex, true); - } - return height; -@@ -720,6 +781,8 @@ - setThreadLock(); - try { - if (currentImage != imageIndex) { -+ cbLock.check(); -+ - readHeader(imageIndex, true); - } - -@@ -743,6 +806,7 @@ - private Iterator getImageTypesOnThread(int imageIndex) - throws IOException { - if (currentImage != imageIndex) { -+ cbLock.check(); - readHeader(imageIndex, true); - } - -@@ -944,6 +1008,7 @@ - setThreadLock(); - try { - if (!tablesOnlyChecked) { -+ cbLock.check(); - checkTablesOnly(); - } - return streamMetadata; -@@ -964,6 +1029,8 @@ - return imageMetadata; - } - -+ cbLock.check(); -+ - gotoImage(imageIndex); - - imageMetadata = new JPEGMetadata(false, false, iis, this); -@@ -980,6 +1047,7 @@ - throws IOException { - setThreadLock(); - try { -+ cbLock.check(); - try { - readInternal(imageIndex, param, false); - } catch (RuntimeException e) { -@@ -1209,58 +1277,63 @@ - } - target.setRect(destROI.x, destROI.y + y, raster); - -- processImageUpdate(image, -- destROI.x, destROI.y+y, -- raster.getWidth(), 1, -- 1, 1, -- destinationBands); -- if ((y > 0) && (y%progInterval == 0)) { -- int height = target.getHeight()-1; -- float percentOfPass = ((float)y)/height; -- if (progressive) { -- if (knownPassCount != UNKNOWN) { -- processImageProgress((pass + percentOfPass)*100.0F -- / knownPassCount); -- } else if (maxProgressivePass != Integer.MAX_VALUE) { -- // Use the range of allowed progressive passes -- processImageProgress((pass + percentOfPass)*100.0F -- / (maxProgressivePass - minProgressivePass + 1)); -+ cbLock.lock(); -+ try { -+ processImageUpdate(image, -+ destROI.x, destROI.y+y, -+ raster.getWidth(), 1, -+ 1, 1, -+ destinationBands); -+ if ((y > 0) && (y%progInterval == 0)) { -+ int height = target.getHeight()-1; -+ float percentOfPass = ((float)y)/height; -+ if (progressive) { -+ if (knownPassCount != UNKNOWN) { -+ processImageProgress((pass + percentOfPass)*100.0F -+ / knownPassCount); -+ } else if (maxProgressivePass != Integer.MAX_VALUE) { -+ // Use the range of allowed progressive passes -+ processImageProgress((pass + percentOfPass)*100.0F -+ / (maxProgressivePass - minProgressivePass + 1)); -+ } else { -+ // Assume there are a minimum of MIN_ESTIMATED_PASSES -+ // and that there is always one more pass -+ // Compute the percentage as the percentage at the end -+ // of the previous pass, plus the percentage of this -+ // pass scaled to be the percentage of the total remaining, -+ // assuming a minimum of MIN_ESTIMATED_PASSES passes and -+ // that there is always one more pass. This is monotonic -+ // and asymptotic to 1.0, which is what we need. -+ int remainingPasses = // including this one -+ Math.max(2, MIN_ESTIMATED_PASSES-pass); -+ int totalPasses = pass + remainingPasses-1; -+ progInterval = Math.max(height/20*totalPasses, -+ totalPasses); -+ if (y%progInterval == 0) { -+ percentToDate = previousPassPercentage + -+ (1.0F - previousPassPercentage) -+ * (percentOfPass)/remainingPasses; -+ if (debug) { -+ System.out.print("pass= " + pass); -+ System.out.print(", y= " + y); -+ System.out.print(", progInt= " + progInterval); -+ System.out.print(", % of pass: " + percentOfPass); -+ System.out.print(", rem. passes: " -+ + remainingPasses); -+ System.out.print(", prev%: " -+ + previousPassPercentage); -+ System.out.print(", %ToDate: " + percentToDate); -+ System.out.print(" "); -+ } -+ processImageProgress(percentToDate*100.0F); -+ } -+ } - } else { -- // Assume there are a minimum of MIN_ESTIMATED_PASSES -- // and that there is always one more pass -- // Compute the percentage as the percentage at the end -- // of the previous pass, plus the percentage of this -- // pass scaled to be the percentage of the total remaining, -- // assuming a minimum of MIN_ESTIMATED_PASSES passes and -- // that there is always one more pass. This is monotonic -- // and asymptotic to 1.0, which is what we need. -- int remainingPasses = // including this one -- Math.max(2, MIN_ESTIMATED_PASSES-pass); -- int totalPasses = pass + remainingPasses-1; -- progInterval = Math.max(height/20*totalPasses, -- totalPasses); -- if (y%progInterval == 0) { -- percentToDate = previousPassPercentage + -- (1.0F - previousPassPercentage) -- * (percentOfPass)/remainingPasses; -- if (debug) { -- System.out.print("pass= " + pass); -- System.out.print(", y= " + y); -- System.out.print(", progInt= " + progInterval); -- System.out.print(", % of pass: " + percentOfPass); -- System.out.print(", rem. passes: " -- + remainingPasses); -- System.out.print(", prev%: " -- + previousPassPercentage); -- System.out.print(", %ToDate: " + percentToDate); -- System.out.print(" "); -- } -- processImageProgress(percentToDate*100.0F); -- } -+ processImageProgress(percentOfPass * 100.0F); - } -- } else { -- processImageProgress(percentOfPass * 100.0F); -- } -+ } -+ } finally { -+ cbLock.unlock(); - } - } - -@@ -1273,33 +1346,58 @@ - } - - private void passStarted (int pass) { -- this.pass = pass; -- previousPassPercentage = percentToDate; -- processPassStarted(image, -- pass, -- minProgressivePass, -- maxProgressivePass, -- 0, 0, -- 1,1, -- destinationBands); -+ cbLock.lock(); -+ try { -+ this.pass = pass; -+ previousPassPercentage = percentToDate; -+ processPassStarted(image, -+ pass, -+ minProgressivePass, -+ maxProgressivePass, -+ 0, 0, -+ 1,1, -+ destinationBands); -+ } finally { -+ cbLock.unlock(); -+ } - } - - private void passComplete () { -- processPassComplete(image); -+ cbLock.lock(); -+ try { -+ processPassComplete(image); -+ } finally { -+ cbLock.unlock(); -+ } - } - - void thumbnailStarted(int thumbnailIndex) { -- processThumbnailStarted(currentImage, thumbnailIndex); -+ cbLock.lock(); -+ try { -+ processThumbnailStarted(currentImage, thumbnailIndex); -+ } finally { -+ cbLock.unlock(); -+ } - } - - // Provide access to protected superclass method - void thumbnailProgress(float percentageDone) { -- processThumbnailProgress(percentageDone); -+ cbLock.lock(); -+ try { -+ processThumbnailProgress(percentageDone); -+ } finally { -+ cbLock.unlock(); -+ } - } - - // Provide access to protected superclass method - void thumbnailComplete() { -- processThumbnailComplete(); -+ cbLock.lock(); -+ try { -+ processThumbnailComplete(); -+ } finally { -+ cbLock.unlock(); -+ } - } - - /** -@@ -1323,6 +1421,11 @@ - public void abort() { - setThreadLock(); - try { -+ /** -+ * NB: we do not check the call back lock here, -+ * we allow to abort the reader any time. -+ */ -+ - super.abort(); - abortRead(structPointer); - } finally { -@@ -1345,6 +1448,7 @@ - setThreadLock(); - Raster retval = null; - try { -+ cbLock.check(); - /* - * This could be further optimized by not resetting the dest. - * offset and creating a translated raster in readInternal() -@@ -1384,6 +1488,8 @@ - public int getNumThumbnails(int imageIndex) throws IOException { - setThreadLock(); - try { -+ cbLock.check(); -+ - getImageMetadata(imageIndex); // checks iis state for us - // Now check the jfif segments - JFIFMarkerSegment jfif = -@@ -1404,6 +1510,8 @@ - throws IOException { - setThreadLock(); - try { -+ cbLock.check(); -+ - if ((thumbnailIndex < 0) - || (thumbnailIndex >= getNumThumbnails(imageIndex))) { - throw new IndexOutOfBoundsException("No such thumbnail"); -@@ -1422,6 +1530,8 @@ - throws IOException { - setThreadLock(); - try { -+ cbLock.check(); -+ - if ((thumbnailIndex < 0) - || (thumbnailIndex >= getNumThumbnails(imageIndex))) { - throw new IndexOutOfBoundsException("No such thumbnail"); -@@ -1441,6 +1551,8 @@ - throws IOException { - setThreadLock(); - try { -+ cbLock.check(); -+ - if ((thumbnailIndex < 0) - || (thumbnailIndex >= getNumThumbnails(imageIndex))) { - throw new IndexOutOfBoundsException("No such thumbnail"); -@@ -1481,6 +1593,7 @@ - public void reset() { - setThreadLock(); - try { -+ cbLock.check(); - super.reset(); - } finally { - clearThreadLock(); -@@ -1492,6 +1605,8 @@ - public void dispose() { - setThreadLock(); - try { -+ cbLock.check(); -+ - if (structPointer != 0) { - disposerRecord.dispose(); - structPointer = 0; -@@ -1553,4 +1668,34 @@ - theThread = null; - } - } -+ -+ private CallBackLock cbLock = new CallBackLock(); -+ -+ private static class CallBackLock { -+ -+ private State lockState; -+ -+ CallBackLock() { -+ lockState = State.Unlocked; -+ } -+ -+ void check() { -+ if (lockState != State.Unlocked) { -+ throw new IllegalStateException("Access to the reader is not allowed"); -+ } -+ } -+ -+ private void lock() { -+ lockState = State.Locked; -+ } -+ -+ private void unlock() { -+ lockState = State.Unlocked; -+ } -+ -+ private static enum State { -+ Unlocked, -+ Locked -+ } -+ } - } -diff --git openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c ---- jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c -+++ jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c -@@ -57,8 +57,8 @@ - #define MAX(a,b) ((a) > (b) ? (a) : (b)) - - /* Cached Java method ids */ --static jmethodID ImageInputStream_readID; --static jmethodID ImageInputStream_skipBytesID; -+static jmethodID JPEGImageReader_readInputDataID; -+static jmethodID JPEGImageReader_skipInputBytesID; - static jmethodID JPEGImageReader_warningOccurredID; - static jmethodID JPEGImageReader_warningWithMessageID; - static jmethodID JPEGImageReader_setImageDataID; -@@ -923,7 +923,7 @@ imageio_fill_input_buffer(j_decompress_p - RELEASE_ARRAYS(env, data, src->next_input_byte); - ret = (*env)->CallIntMethod(env, - sb->stream, -- ImageInputStream_readID, -+ JPEGImageReader_readInputDataID, - sb->hstreamBuffer, 0, - sb->bufferLength); - if ((*env)->ExceptionOccurred(env) -@@ -1013,7 +1013,7 @@ imageio_fill_suspended_buffer(j_decompre - } - - ret = (*env)->CallIntMethod(env, sb->stream, -- ImageInputStream_readID, -+ JPEGImageReader_readInputDataID, - sb->hstreamBuffer, - offset, buflen); - if ((*env)->ExceptionOccurred(env) -@@ -1107,7 +1107,7 @@ imageio_skip_input_data(j_decompress_ptr - RELEASE_ARRAYS(env, data, src->next_input_byte); - ret = (*env)->CallLongMethod(env, - sb->stream, -- ImageInputStream_skipBytesID, -+ JPEGImageReader_skipInputBytesID, - (jlong) num_bytes); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { -@@ -1382,13 +1382,13 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm - jclass qTableClass, - jclass huffClass) { - -- ImageInputStream_readID = (*env)->GetMethodID(env, -- ImageInputStreamClass, -- "read", -+ JPEGImageReader_readInputDataID = (*env)->GetMethodID(env, -+ cls, -+ "readInputData", - "([BII)I"); -- ImageInputStream_skipBytesID = (*env)->GetMethodID(env, -- ImageInputStreamClass, -- "skipBytes", -+ JPEGImageReader_skipInputBytesID = (*env)->GetMethodID(env, -+ cls, -+ "skipInputBytes", - "(J)J"); - JPEGImageReader_warningOccurredID = (*env)->GetMethodID(env, - cls, -@@ -1531,8 +1531,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setSource - (JNIEnv *env, - jobject this, -- jlong ptr, -- jobject source) { -+ jlong ptr) { - - imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); - j_common_ptr cinfo; -@@ -1546,7 +1545,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm - - cinfo = data->jpegObj; - -- imageio_set_stream(env, cinfo, data, source); -+ imageio_set_stream(env, cinfo, data, this); - - imageio_init_source((j_decompress_ptr) cinfo); - } diff --git a/java/openjdk6/files/icedtea/security/20130416/8007918.patch b/java/openjdk6/files/icedtea/security/20130416/8007918.patch deleted file mode 100644 index 35ee96352ef9..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8007918.patch +++ /dev/null @@ -1,357 +0,0 @@ -# HG changeset patch -# User bae -# Date 1361827637 -14400 -# Node ID 90c9f1577a0b09128174b4d26404b438585428c5 -# Parent d868fe7c7618e5b55eea8dd69ee5d099c71816e0 -8007918: Better image writing -Reviewed-by: prr, jgodinez - -diff --git openjdk/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java openjdk/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java ---- jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java -+++ jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java -@@ -178,8 +178,7 @@ public class JPEGImageWriter extends Ima - static { - java.security.AccessController.doPrivileged( - new sun.security.action.LoadLibraryAction("jpeg")); -- initWriterIDs(ImageOutputStream.class, -- JPEGQTable.class, -+ initWriterIDs(JPEGQTable.class, - JPEGHuffmanTable.class); - } - -@@ -195,11 +194,13 @@ public class JPEGImageWriter extends Ima - public void setOutput(Object output) { - setThreadLock(); - try { -+ cbLock.check(); -+ - super.setOutput(output); // validates output - resetInternalState(); - ios = (ImageOutputStream) output; // so this will always work - // Set the native destination -- setDest(structPointer, ios); -+ setDest(structPointer); - } finally { - clearThreadLock(); - } -@@ -354,6 +355,8 @@ public class JPEGImageWriter extends Ima - ImageWriteParam param) throws IOException { - setThreadLock(); - try { -+ cbLock.check(); -+ - writeOnThread(streamMetadata, image, param); - } finally { - clearThreadLock(); -@@ -1077,13 +1080,18 @@ public class JPEGImageWriter extends Ima - haveMetadata, - restartInterval); - -- if (aborted) { -- processWriteAborted(); -- } else { -- processImageComplete(); -+ cbLock.lock(); -+ try { -+ if (aborted) { -+ processWriteAborted(); -+ } else { -+ processImageComplete(); -+ } -+ -+ ios.flush(); -+ } finally { -+ cbLock.unlock(); - } -- -- ios.flush(); - currentImage++; // After a successful write - } - -@@ -1091,6 +1099,8 @@ public class JPEGImageWriter extends Ima - throws IOException { - setThreadLock(); - try { -+ cbLock.check(); -+ - prepareWriteSequenceOnThread(streamMetadata); - } finally { - clearThreadLock(); -@@ -1170,6 +1180,8 @@ public class JPEGImageWriter extends Ima - throws IOException { - setThreadLock(); - try { -+ cbLock.check(); -+ - if (sequencePrepared == false) { - throw new IllegalStateException("sequencePrepared not called!"); - } -@@ -1183,6 +1195,8 @@ public class JPEGImageWriter extends Ima - public void endWriteSequence() throws IOException { - setThreadLock(); - try { -+ cbLock.check(); -+ - if (sequencePrepared == false) { - throw new IllegalStateException("sequencePrepared not called!"); - } -@@ -1195,6 +1209,10 @@ public class JPEGImageWriter extends Ima - public synchronized void abort() { - setThreadLock(); - try { -+ /** -+ * NB: we do not check the call back lock here, we allow to abort -+ * the reader any time. -+ */ - super.abort(); - abortWrite(structPointer); - } finally { -@@ -1218,6 +1236,8 @@ public class JPEGImageWriter extends Ima - public void reset() { - setThreadLock(); - try { -+ cbLock.check(); -+ - super.reset(); - } finally { - clearThreadLock(); -@@ -1227,6 +1247,8 @@ public class JPEGImageWriter extends Ima - public void dispose() { - setThreadLock(); - try { -+ cbLock.check(); -+ - if (structPointer != 0) { - disposerRecord.dispose(); - structPointer = 0; -@@ -1246,13 +1268,18 @@ public class JPEGImageWriter extends Ima - * sending warnings to listeners. - */ - void warningOccurred(int code) { -- if ((code < 0) || (code > MAX_WARNING)){ -- throw new InternalError("Invalid warning index"); -+ cbLock.lock(); -+ try { -+ if ((code < 0) || (code > MAX_WARNING)){ -+ throw new InternalError("Invalid warning index"); -+ } -+ processWarningOccurred -+ (currentImage, -+ "com.sun.imageio.plugins.jpeg.JPEGImageWriterResources", -+ Integer.toString(code)); -+ } finally { -+ cbLock.unlock(); - } -- processWarningOccurred -- (currentImage, -- "com.sun.imageio.plugins.jpeg.JPEGImageWriterResources", -- Integer.toString(code)); - } - - /** -@@ -1269,21 +1296,41 @@ public class JPEGImageWriter extends Ima - * library warnings from being printed to stderr. - */ - void warningWithMessage(String msg) { -- processWarningOccurred(currentImage, msg); -+ cbLock.lock(); -+ try { -+ processWarningOccurred(currentImage, msg); -+ } finally { -+ cbLock.unlock(); -+ } - } - - void thumbnailStarted(int thumbnailIndex) { -- processThumbnailStarted(currentImage, thumbnailIndex); -+ cbLock.lock(); -+ try { -+ processThumbnailStarted(currentImage, thumbnailIndex); -+ } finally { -+ cbLock.unlock(); -+ } - } - - // Provide access to protected superclass method - void thumbnailProgress(float percentageDone) { -- processThumbnailProgress(percentageDone); -+ cbLock.lock(); -+ try { -+ processThumbnailProgress(percentageDone); -+ } finally { -+ cbLock.unlock(); -+ } - } - - // Provide access to protected superclass method - void thumbnailComplete() { -- processThumbnailComplete(); -+ cbLock.lock(); -+ try { -+ processThumbnailComplete(); -+ } finally { -+ cbLock.unlock(); -+ } - } - - ///////// End of Package-access API -@@ -1610,16 +1657,14 @@ public class JPEGImageWriter extends Ima - ////////////// Native methods and callbacks - - /** Sets up static native structures. */ -- private static native void initWriterIDs(Class iosClass, -- Class qTableClass, -+ private static native void initWriterIDs(Class qTableClass, - Class huffClass); - - /** Sets up per-writer native structure and returns a pointer to it. */ - private native long initJPEGImageWriter(); - - /** Sets up native structures for output stream */ -- private native void setDest(long structPointer, -- ImageOutputStream ios); -+ private native void setDest(long structPointer); - - /** - * Returns <code>true</code> if the write was aborted. -@@ -1744,7 +1789,12 @@ public class JPEGImageWriter extends Ima - } - raster.setRect(sourceLine); - if ((y > 7) && (y%8 == 0)) { // Every 8 scanlines -- processImageProgress((float) y / (float) sourceHeight * 100.0F); -+ cbLock.lock(); -+ try { -+ processImageProgress((float) y / (float) sourceHeight * 100.0F); -+ } finally { -+ cbLock.unlock(); -+ } - } - } - -@@ -1769,6 +1819,25 @@ public class JPEGImageWriter extends Ima - disposeWriter(pData); - pData = 0; - } -+ } -+ } -+ -+ /** -+ * This method is called from native code in order to write encoder -+ * output to the destination. -+ * -+ * We block any attempt to change the writer state during this -+ * method, in order to prevent a corruption of the native encoder -+ * state. -+ */ -+ private void writeOutputData(byte[] data, int offset, int len) -+ throws IOException -+ { -+ cbLock.lock(); -+ try { -+ ios.write(data, offset, len); -+ } finally { -+ cbLock.unlock(); - } - } - -@@ -1806,4 +1875,34 @@ public class JPEGImageWriter extends Ima - theThread = null; - } - } -+ -+ private CallBackLock cbLock = new CallBackLock(); -+ -+ private static class CallBackLock { -+ -+ private State lockState; -+ -+ CallBackLock() { -+ lockState = State.Unlocked; -+ } -+ -+ void check() { -+ if (lockState != State.Unlocked) { -+ throw new IllegalStateException("Access to the writer is not allowed"); -+ } -+ } -+ -+ private void lock() { -+ lockState = State.Locked; -+ } -+ -+ private void unlock() { -+ lockState = State.Unlocked; -+ } -+ -+ private static enum State { -+ Unlocked, -+ Locked -+ } -+ } - } -diff --git openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c ---- jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c -+++ jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c -@@ -66,7 +66,7 @@ static jmethodID JPEGImageReader_pushBac - static jmethodID JPEGImageReader_pushBackID; - static jmethodID JPEGImageReader_passStartedID; - static jmethodID JPEGImageReader_passCompleteID; --static jmethodID ImageOutputStream_writeID; -+static jmethodID JPEGImageWriter_writeOutputDataID; - static jmethodID JPEGImageWriter_warningOccurredID; - static jmethodID JPEGImageWriter_warningWithMessageID; - static jmethodID JPEGImageWriter_writeMetadataID; -@@ -2290,7 +2290,7 @@ imageio_empty_output_buffer (j_compress_ - - (*env)->CallVoidMethod(env, - sb->stream, -- ImageOutputStream_writeID, -+ JPEGImageWriter_writeOutputDataID, - sb->hstreamBuffer, - 0, - sb->bufferLength); -@@ -2327,7 +2327,7 @@ imageio_term_destination (j_compress_ptr - - (*env)->CallVoidMethod(env, - sb->stream, -- ImageOutputStream_writeID, -+ JPEGImageWriter_writeOutputDataID, - sb->hstreamBuffer, - 0, - datacount); -@@ -2365,13 +2365,12 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initWriterIDs - (JNIEnv *env, - jclass cls, -- jclass IOSClass, - jclass qTableClass, - jclass huffClass) { - -- ImageOutputStream_writeID = (*env)->GetMethodID(env, -- IOSClass, -- "write", -+ JPEGImageWriter_writeOutputDataID = (*env)->GetMethodID(env, -+ cls, -+ "writeOutputData", - "([BII)V"); - - JPEGImageWriter_warningOccurredID = (*env)->GetMethodID(env, -@@ -2495,8 +2494,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_setDest - (JNIEnv *env, - jobject this, -- jlong ptr, -- jobject destination) { -+ jlong ptr) { - - imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); - j_compress_ptr cinfo; -@@ -2510,7 +2508,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm - - cinfo = (j_compress_ptr) data->jpegObj; - -- imageio_set_stream(env, data->jpegObj, data, destination); -+ imageio_set_stream(env, data->jpegObj, data, this); - - - // Don't call the init method, as that depends on pinned arrays diff --git a/java/openjdk6/files/icedtea/security/20130416/8009063.patch b/java/openjdk6/files/icedtea/security/20130416/8009063.patch deleted file mode 100644 index a15331af4bbc..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8009063.patch +++ /dev/null @@ -1,67 +0,0 @@ -# HG changeset patch -# User chegar -# Date 1362305505 0 -# Node ID 98ad2f1e25d13aca196ad77b2f227f85072c9b16 -# Parent 17ac71e7b72087f0f7b7ac793ae93a816ef22d96 -8009063: Improve reliability of ConcurrentHashMap -Reviewed-by: alanb, ahgross - -diff --git a/src/share/classes/java/util/concurrent/ConcurrentHashMap.java b/src/share/classes/java/util/concurrent/ConcurrentHashMap.java ---- jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java -+++ jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java -@@ -40,6 +40,7 @@ import java.io.IOException; - import java.io.IOException; - import java.io.ObjectInputStream; - import java.io.ObjectOutputStream; -+import java.io.ObjectStreamField; - - /** - * A hash table supporting full concurrency of retrievals and -@@ -1535,7 +1536,23 @@ public class ConcurrentHashMap<K, V> ext - @SuppressWarnings("unchecked") - private void readObject(java.io.ObjectInputStream s) - throws IOException, ClassNotFoundException { -- s.defaultReadObject(); -+ // Don't call defaultReadObject() -+ ObjectInputStream.GetField oisFields = s.readFields(); -+ final Segment<K,V>[] oisSegments = (Segment<K,V>[])oisFields.get("segments", null); -+ -+ final int ssize = oisSegments.length; -+ if (ssize < 1 || ssize > MAX_SEGMENTS -+ || (ssize & (ssize-1)) != 0 ) // ssize not power of two -+ throw new java.io.InvalidObjectException("Bad number of segments:" -+ + ssize); -+ int sshift = 0, ssizeTmp = ssize; -+ while (ssizeTmp > 1) { -+ ++sshift; -+ ssizeTmp >>>= 1; -+ } -+ UNSAFE.putIntVolatile(this, SEGSHIFT_OFFSET, 32 - sshift); -+ UNSAFE.putIntVolatile(this, SEGMASK_OFFSET, ssize - 1); -+ UNSAFE.putObjectVolatile(this, SEGMENTS_OFFSET, oisSegments); - - // set hashMask - UNSAFE.putIntVolatile(this, HASHSEED_OFFSET, randomHashSeed(this)); -@@ -1568,6 +1585,9 @@ public class ConcurrentHashMap<K, V> ext - private static final int SSHIFT; - private static final long TBASE; - private static final int TSHIFT; -+ private static final long SEGSHIFT_OFFSET; -+ private static final long SEGMASK_OFFSET; -+ private static final long SEGMENTS_OFFSET; - - static { - int ss, ts; -@@ -1581,6 +1601,12 @@ public class ConcurrentHashMap<K, V> ext - SBASE = UNSAFE.arrayBaseOffset(sc); - ts = UNSAFE.arrayIndexScale(tc); - ss = UNSAFE.arrayIndexScale(sc); -+ SEGSHIFT_OFFSET = UNSAFE.objectFieldOffset( -+ ConcurrentHashMap.class.getDeclaredField("segmentShift")); -+ SEGMASK_OFFSET = UNSAFE.objectFieldOffset( -+ ConcurrentHashMap.class.getDeclaredField("segmentMask")); -+ SEGMENTS_OFFSET = UNSAFE.objectFieldOffset( -+ ConcurrentHashMap.class.getDeclaredField("segments")); - } catch (Exception e) { - throw new Error(e); - } diff --git a/java/openjdk6/files/icedtea/security/20130416/8009305.patch b/java/openjdk6/files/icedtea/security/20130416/8009305.patch deleted file mode 100644 index d469d5748708..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8009305.patch +++ /dev/null @@ -1,68 +0,0 @@ -# HG changeset patch -# User dfuchs -# Date 1363278452 -3600 -# Node ID 31c782610044b0f04f981c2b97355804a1c57407 -# Parent 87bacc5ee8e430aadd200ae13a2d15fe9c8f4350 -8009305: Improve AWT data transfer -Reviewed-by: art, skoivu, smarks, ant - -diff --git openjdk/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java openjdk/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java ---- jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java -+++ jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java -@@ -102,11 +102,11 @@ public class TransferableProxy implement - protected final boolean isLocal; - } - --class ClassLoaderObjectOutputStream extends ObjectOutputStream { -+final class ClassLoaderObjectOutputStream extends ObjectOutputStream { - private final Map<Set<String>, ClassLoader> map = - new HashMap<Set<String>, ClassLoader>(); - -- public ClassLoaderObjectOutputStream(OutputStream os) throws IOException { -+ ClassLoaderObjectOutputStream(OutputStream os) throws IOException { - super(os); - } - -@@ -140,15 +140,15 @@ class ClassLoaderObjectOutputStream exte - map.put(s, classLoader); - } - -- public Map<Set<String>, ClassLoader> getClassLoaderMap() { -+ Map<Set<String>, ClassLoader> getClassLoaderMap() { - return new HashMap(map); - } - } - --class ClassLoaderObjectInputStream extends ObjectInputStream { -+final class ClassLoaderObjectInputStream extends ObjectInputStream { - private final Map<Set<String>, ClassLoader> map; - -- public ClassLoaderObjectInputStream(InputStream is, -+ ClassLoaderObjectInputStream(InputStream is, - Map<Set<String>, ClassLoader> map) - throws IOException { - super(is); -@@ -166,8 +166,11 @@ class ClassLoaderObjectInputStream exten - s.add(className); - - ClassLoader classLoader = map.get(s); -- -- return Class.forName(className, false, classLoader); -+ if (classLoader != null) { -+ return Class.forName(className, false, classLoader); -+ } else { -+ return super.resolveClass(classDesc); -+ } - } - - protected Class<?> resolveProxyClass(String[] interfaces) -@@ -179,6 +182,9 @@ class ClassLoaderObjectInputStream exten - } - - ClassLoader classLoader = map.get(s); -+ if (classLoader == null) { -+ return super.resolveProxyClass(interfaces); -+ } - - // The code below is mostly copied from the superclass. - ClassLoader nonPublicLoader = null; diff --git a/java/openjdk6/files/icedtea/security/20130416/8009699.patch b/java/openjdk6/files/icedtea/security/20130416/8009699.patch deleted file mode 100644 index f4a15a33693f..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8009699.patch +++ /dev/null @@ -1,25 +0,0 @@ -# HG changeset patch -# User andrew -# Date 1365790031 -3600 -# Node ID e95f24ac8e1e3c54e389b55c6992a8fc0266a698 -# Parent ef36be1ae9bc7d061721f8890797e5d89c901846 -8009699: Methodhandle lookup -Reviewed-by: ahgross, jrose, jdn - -diff --git a/src/share/vm/prims/methodHandles.cpp b/src/share/vm/prims/methodHandles.cpp ---- hotspot/src/share/vm/prims/methodHandles.cpp -+++ hotspot/src/share/vm/prims/methodHandles.cpp -@@ -536,6 +536,13 @@ - } - } - methodHandle m = result.resolved_method(); -+ KlassHandle mklass = m->method_holder(); -+ KlassHandle receiver_limit = result.resolved_klass(); -+ if (receiver_limit.is_null() || -+ // ignore passed-in limit; interfaces are interconvertible -+ receiver_limit->is_interface() && mklass->is_interface()) { -+ receiver_limit = mklass; -+ } - oop vmtarget = NULL; - int vmindex = methodOopDesc::nonvirtual_vtable_index; - if (defc->is_interface()) { diff --git a/java/openjdk6/files/icedtea/security/20130416/8009814.patch b/java/openjdk6/files/icedtea/security/20130416/8009814.patch deleted file mode 100644 index 322b4c1f5f87..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8009814.patch +++ /dev/null @@ -1,27 +0,0 @@ -# HG changeset patch -# User lancea -# Date 1363442894 14400 -# Node ID a19614a3dabb1754f4e8b3f0eaf29053debce05f -# Parent 0cf73f53c7e1236286ea600d766a0651fdf9b660 -8009814: Better driver management -Reviewed-by: alanb, skoivu - -diff --git openjdk/jdk/src/share/classes/java/sql/DriverManager.java openjdk/jdk/src/share/classes/java/sql/DriverManager.java ---- jdk/src/share/classes/java/sql/DriverManager.java -+++ jdk/src/share/classes/java/sql/DriverManager.java -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -516,7 +516,7 @@ public class DriverManager { - */ - try{ - while(driversIterator.hasNext()) { -- println(" Loading done by the java.util.ServiceLoader : "+driversIterator.next()); -+ driversIterator.next(); - } - } catch(Throwable t) { - // Do nothing diff --git a/java/openjdk6/files/icedtea/security/20130416/8009857.patch b/java/openjdk6/files/icedtea/security/20130416/8009857.patch deleted file mode 100644 index 7e042c905ba5..000000000000 --- a/java/openjdk6/files/icedtea/security/20130416/8009857.patch +++ /dev/null @@ -1,66 +0,0 @@ -# HG changeset patch -# User smarks -# Date 1363655131 25200 -# Node ID 2899c3dbf5e8791b559c39a75a820c17c729c20f -# Parent b453d9be6b3f5496aa217ade7478d3b7fa32b13b -8009857: Problem with plugin -Reviewed-by: jdn, mchung - -diff --git openjdk/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java openjdk/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java ---- jdk/src/share/classes/sun/reflect/misc/MethodUtil.java -+++ jdk/src/share/classes/sun/reflect/misc/MethodUtil.java -@@ -50,8 +50,27 @@ import sun.security.util.SecurityConstan - - - class Trampoline { -+ static { -+ if (Trampoline.class.getClassLoader() == null) { -+ throw new Error( -+ "Trampoline must not be defined by the bootstrap classloader"); -+ } -+ } -+ -+ private static void ensureInvocableMethod(Method m) -+ throws InvocationTargetException -+ { -+ Class<?> clazz = m.getDeclaringClass(); -+ if (clazz.equals(AccessController.class) || -+ clazz.equals(Method.class)) -+ throw new InvocationTargetException( -+ new UnsupportedOperationException("invocation not supported")); -+ } -+ - private static Object invoke(Method m, Object obj, Object[] params) -- throws InvocationTargetException, IllegalAccessException { -+ throws InvocationTargetException, IllegalAccessException -+ { -+ ensureInvocableMethod(m); - return m.invoke(obj, params); - } - } -@@ -255,10 +275,6 @@ public final class MethodUtil extends Se - */ - public static Object invoke(Method m, Object obj, Object[] params) - throws InvocationTargetException, IllegalAccessException { -- if (m.getDeclaringClass().equals(AccessController.class) || -- m.getDeclaringClass().equals(Method.class)) -- throw new InvocationTargetException( -- new UnsupportedOperationException("invocation not supported")); - try { - return bounce.invoke(null, new Object[] {m, obj, params}); - } catch (InvocationTargetException ie) { -@@ -292,10 +307,10 @@ public final class MethodUtil extends Se - - types = new Class[] {Method.class, Object.class, Object[].class}; - b = t.getDeclaredMethod("invoke", types); -- ((AccessibleObject)b).setAccessible(true); -- return b; -- } -- }); -+ b.setAccessible(true); -+ return b; -+ } -+ }); - } catch (Exception e) { - throw new InternalError("bouncer cannot be found"); - } |