# HG changeset patch # User dfuchs # Date 1370544433 -7200 # Node ID ade6118af296d66075212aeac28b5be49b790eb3 # Parent 9849cc530d6d104a007fce0420a6064ce8108642 8013434: Xalan and Xerces internal ObjectFactory need rework Summary: With this changeset, DTMManager and XSLTCDTMManager will always use their own default implementation. Reviewed-by: joehw, alanb diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xalan/META-INF/services/javax.xml.transform.TransformerFactory --- a/drop_included/jaxp_src/src/com/sun/org/apache/xalan/META-INF/services/javax.xml.transform.TransformerFactory Tue May 23 13:19:17 2017 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xalan/META-INF/services/javax.xml.xpath.XPathFactory --- a/drop_included/jaxp_src/src/com/sun/org/apache/xalan/META-INF/services/javax.xml.xpath.XPathFactory Tue May 23 13:19:17 2017 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl \ No newline at end of file diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xalan/META-INF/services/org.apache.xml.dtm.DTMManager --- a/drop_included/jaxp_src/src/com/sun/org/apache/xalan/META-INF/services/org.apache.xml.dtm.DTMManager Tue May 23 13:19:17 2017 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java Tue May 23 13:19:17 2017 +0300 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java Thu Jun 06 20:47:13 2013 +0200 @@ -23,26 +23,11 @@ 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. *

- * 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. - *

* This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. @@ -57,329 +42,9 @@ private static final String JAXP_INTERNAL = "com.sun.org.apache"; private static final String STAX_INTERNAL = "com.sun.xml.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: - *

    - *
  1. query the system property using System.getProperty - *
  2. read META-INF/services/factoryId file - *
  3. use fallback classname - *
- * - * @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: - *
    - *
  1. query the system property using System.getProperty - *
  2. read $java.home/lib/propertiesFilename file - *
  3. read META-INF/services/factoryId file - *
  4. use fallback classname - *
- * - * @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: - *
    - *
  1. query the system property using System.getProperty - *
  2. read $java.home/lib/propertiesFilename file - *
  3. read META-INF/services/factoryId file - *
  4. use fallback classname - *
- * - * @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: - *
    - *
  1. query the system property using System.getProperty - *
  2. read $java.home/lib/propertiesFilename file - *
  3. read META-INF/services/factoryId file - *
  4. use fallback classname - *
- * - * @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: - *
    - *
  1. query the system property using System.getProperty - *
  2. read $java.home/lib/propertiesFilename file - *
  3. read META-INF/services/factoryId file - *
  4. use fallback classname - *
- * - * @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) { @@ -393,7 +58,6 @@ * the context ClassLoader. */ public static ClassLoader findClassLoader() - throws ConfigurationError { if (System.getSecurityManager()!=null) { //this will ensure bootclassloader is used @@ -452,8 +116,8 @@ } // 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 + * Create an instance of a class using the same class loader for the ObjectFactory by default + * or boot class loader when Security Manager is in place */ public static Object newInstance(String className, boolean doFallback) throws ConfigurationError @@ -491,10 +155,10 @@ } /** - * Find a Class using the same classloader for the ObjectFactory by default - * or bootclassloader when Security Manager is in place + * Find a Class using the same class loader for the ObjectFactory by default + * or boot class loader when Security Manager is in place */ - public static Class findProviderClass(String className, boolean doFallback) + public static Class findProviderClass(String className, boolean doFallback) throws ClassNotFoundException, ConfigurationError { return findProviderClass (className, @@ -504,7 +168,7 @@ /** * Find a Class using the specified ClassLoader */ - static Class findProviderClass(String className, ClassLoader cl, + private static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { @@ -527,7 +191,7 @@ throw e; } - Class providerClass; + Class providerClass; if (cl == null) { providerClass = Class.forName(className, false, ObjectFactory.class.getClassLoader()); } else { @@ -554,93 +218,4 @@ 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 diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Transform.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Transform.java Tue May 23 13:19:17 2017 +0300 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Transform.java Thu Jun 06 20:47:13 2013 +0200 @@ -115,8 +115,7 @@ // Set the DOM's DOM builder as the XMLReader's SAX2 content handler XSLTCDTMManager dtmManager = - (XSLTCDTMManager)XSLTCDTMManager.getDTMManagerClass() - .newInstance(); + XSLTCDTMManager.createNewDTMManagerInstance(); DTMWSFilter wsfilter; if (translet != null && translet instanceof StripFilter) { diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/DocumentCache.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/DocumentCache.java Tue May 23 13:19:17 2017 +0300 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/DocumentCache.java Thu Jun 06 20:47:13 2013 +0200 @@ -154,8 +154,7 @@ public DocumentCache(int size) throws SAXException { this(size, null); try { - _dtmManager = (XSLTCDTMManager)XSLTCDTMManager.getDTMManagerClass() - .newInstance(); + _dtmManager = XSLTCDTMManager.createNewDTMManagerInstance(); } catch (Exception e) { throw new SAXException(e); } @@ -252,6 +251,7 @@ * Returns a document either by finding it in the cache or * downloading it and putting it in the cache. */ + @Override public DOM retrieveDocument(String baseURI, String href, Translet trs) { CachedDocument doc; diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/XSLTCDTMManager.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/XSLTCDTMManager.java Tue May 23 13:19:17 2017 +0300 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/XSLTCDTMManager.java Thu Jun 06 20:47:13 2013 +0200 @@ -30,7 +30,6 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stax.StAXSource; - import com.sun.org.apache.xml.internal.dtm.DTM; import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase; import com.sun.org.apache.xml.internal.dtm.DTMException; @@ -54,13 +53,6 @@ public class XSLTCDTMManager extends DTMManagerDefault { - /** The default class name to use as the manager. */ - private static final String DEFAULT_CLASS_NAME = - "com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager"; - - private static final String DEFAULT_PROP_NAME = - "com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager"; - /** Set this to true if you want a dump of the DTM after creation */ private static final boolean DUMPTREE = false; @@ -87,28 +79,12 @@ } /** - * Look up the class that provides the XSLTC DTM Manager service. - * The following lookup procedure is used to find the service provider. - *
    - *
  1. The value of the - * com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager property, is - * checked.
  2. - *
  3. The xalan.propeties file is checked for a property - * of the same name.
  4. - *
  5. The - * META-INF/services/com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager - * file is checked. - *
- * The default is com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager. + * Creates a new instance of the XSLTC DTM Manager service. + * Creates a new instance of the default class + * com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager. */ - public static Class getDTMManagerClass() { - Class mgrClass = ObjectFactory.lookUpFactoryClass(DEFAULT_PROP_NAME, - null, - DEFAULT_CLASS_NAME); - // If no class found, default to this one. (This should never happen - - // the ObjectFactory has already been told that the current class is - // the default). - return (mgrClass != null) ? mgrClass : XSLTCDTMManager.class; + public static XSLTCDTMManager createNewDTMManagerInstance() { + return newInstance(); } /** @@ -132,6 +108,7 @@ * * @return a non-null DTM reference. */ + @Override public DTM getDTM(Source source, boolean unique, DTMWSFilter whiteSpaceFilter, boolean incremental, boolean doIndexing) diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java Tue May 23 13:19:17 2017 +0300 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java Thu Jun 06 20:47:13 2013 +0200 @@ -200,14 +200,6 @@ private int _indentNumber = -1; /** - * The provider of the XSLTC DTM Manager service. This is fixed for any - * instance of this class. In order to change service providers, a new - * XSLTC TransformerFactory must be instantiated. - * @see XSLTCDTMManager#getDTMManagerClass() - */ - private Class m_DTMManagerClass; - - /** *

State of secure processing feature.

*/ private boolean _isNotSecureProcessing = true; @@ -219,7 +211,6 @@ * javax.xml.transform.sax.TransformerFactory implementation. */ public TransformerFactoryImpl() { - m_DTMManagerClass = XSLTCDTMManager.getDTMManagerClass(); if (System.getSecurityManager() != null) { _isSecureMode = true; _isNotSecureProcessing = false; @@ -240,6 +231,7 @@ * @param listener The error listener to use with the TransformerFactory * @throws IllegalArgumentException */ + @Override public void setErrorListener(ErrorListener listener) throws IllegalArgumentException { @@ -257,6 +249,7 @@ * * @return The error listener used with the TransformerFactory */ + @Override public ErrorListener getErrorListener() { return _errorListener; } @@ -269,6 +262,7 @@ * @return An object representing the attribute value * @throws IllegalArgumentException */ + @Override public Object getAttribute(String name) throws IllegalArgumentException { @@ -305,6 +299,7 @@ * @param value An object representing the attribute value * @throws IllegalArgumentException */ + @Override public void setAttribute(String name, Object value) throws IllegalArgumentException { @@ -424,6 +419,7 @@ * or the Transformers or Templates it creates cannot support this feature. * @throws NullPointerException If the name parameter is null. */ + @Override public void setFeature(String name, boolean value) throws TransformerConfigurationException { @@ -459,6 +455,7 @@ * @param name The feature name * @return 'true' if feature is supported, 'false' if not */ + @Override public boolean getFeature(String name) { // All supported features should be listed here String[] features = { @@ -502,7 +499,8 @@ * * @return The URLResolver used for this TransformerFactory and all * Templates and Transformer objects created using this factory - */ + */ + @Override public URIResolver getURIResolver() { return _uriResolver; } @@ -516,7 +514,8 @@ * * @param resolver The URLResolver used for this TransformerFactory and all * Templates and Transformer objects created using this factory - */ + */ + @Override public void setURIResolver(URIResolver resolver) { _uriResolver = resolver; } @@ -536,13 +535,14 @@ * @return A Source object suitable for passing to the TransformerFactory. * @throws TransformerConfigurationException */ + @Override public Source getAssociatedStylesheet(Source source, String media, String title, String charset) throws TransformerConfigurationException { String baseId; - XMLReader reader = null; - InputSource isource = null; + XMLReader reader; + InputSource isource; /** @@ -623,7 +623,8 @@ * * @return A Transformer object that simply copies the source to the result. * @throws TransformerConfigurationException - */ + */ + @Override public Transformer newTransformer() throws TransformerConfigurationException { @@ -649,6 +650,7 @@ * @return A Templates object that can be used to create Transformers. * @throws TransformerConfigurationException */ + @Override public Transformer newTransformer(Source source) throws TransformerConfigurationException { @@ -712,6 +714,7 @@ * @return A Templates object that can be used to create Transformers. * @throws TransformerConfigurationException */ + @Override public Templates newTemplates(Source source) throws TransformerConfigurationException { @@ -746,7 +749,7 @@ // If _autoTranslet is true, we will try to load the bytecodes // from the translet classes without compiling the stylesheet. if (_autoTranslet) { - byte[][] bytecodes = null; + byte[][] bytecodes; String transletClassName = getTransletBaseName(source); if (_packageName != null) @@ -864,7 +867,7 @@ if (bytecodes == null) { Vector errs = xsltc.getErrors(); - ErrorMsg err = null; + ErrorMsg err; if (errs != null) { err = (ErrorMsg)errs.get(errs.size()-1); } else { @@ -909,6 +912,7 @@ * @return A TemplatesHandler object that can handle SAX events * @throws TransformerConfigurationException */ + @Override public TemplatesHandler newTemplatesHandler() throws TransformerConfigurationException { @@ -928,6 +932,7 @@ * @return A TransformerHandler object that can handle SAX events * @throws TransformerConfigurationException */ + @Override public TransformerHandler newTransformerHandler() throws TransformerConfigurationException { @@ -948,6 +953,7 @@ * @return A TransformerHandler object that can handle SAX events * @throws TransformerConfigurationException */ + @Override public TransformerHandler newTransformerHandler(Source src) throws TransformerConfigurationException { @@ -967,7 +973,8 @@ * @param templates Represents a pre-processed stylesheet * @return A TransformerHandler object that can handle SAX events * @throws TransformerConfigurationException - */ + */ + @Override public TransformerHandler newTransformerHandler(Templates templates) throws TransformerConfigurationException { @@ -985,6 +992,7 @@ * @return An XMLFilter object, or null if this feature is not supported. * @throws TransformerConfigurationException */ + @Override public XMLFilter newXMLFilter(Source src) throws TransformerConfigurationException { @@ -1002,6 +1010,7 @@ * @return An XMLFilter object, or null if this feature is not supported. * @throws TransformerConfigurationException */ + @Override public XMLFilter newXMLFilter(Templates templates) throws TransformerConfigurationException { @@ -1033,6 +1042,7 @@ * @throws TransformerException if the application chooses to discontinue * the transformation (always does in our case). */ + @Override public void error(TransformerException e) throws TransformerException { @@ -1061,6 +1071,7 @@ * @throws TransformerException if the application chooses to discontinue * the transformation (always does in our case). */ + @Override public void fatalError(TransformerException e) throws TransformerException { @@ -1089,6 +1100,7 @@ * @throws TransformerException if the application chooses to discontinue * the transformation (never does in our case). */ + @Override public void warning(TransformerException e) throws TransformerException { @@ -1112,6 +1124,7 @@ * @param xsltc The compiler that resuests the document * @return An InputSource with the loaded document */ + @Override public InputSource loadSource(String href, String context, XSLTC xsltc) { try { if (_uriResolver != null) { @@ -1198,7 +1211,7 @@ Vector bytecodes = new Vector(); int fileLength = (int)transletFile.length(); if (fileLength > 0) { - FileInputStream input = null; + FileInputStream input; try { input = new FileInputStream(transletFile); } @@ -1230,6 +1243,7 @@ // Find all the auxiliary files which have a name pattern of "transletClass$nnn.class". final String transletAuxPrefix = transletName + "$"; File[] auxfiles = transletParentFile.listFiles(new FilenameFilter() { + @Override public boolean accept(File dir, String name) { return (name.endsWith(".class") && name.startsWith(transletAuxPrefix)); @@ -1293,7 +1307,7 @@ xslFile = new File(xslFileName); // Construct the path for the jar file - String jarPath = null; + String jarPath; if (_destinationDirectory != null) jarPath = _destinationDirectory + "/" + _jarFileName; else { @@ -1318,7 +1332,7 @@ } // Create a ZipFile object for the jar file - ZipFile jarFile = null; + ZipFile jarFile; try { jarFile = new ZipFile(file); } @@ -1436,7 +1450,7 @@ if (file.exists()) return systemId; else { - URL url = null; + URL url; try { url = new URL(systemId); } @@ -1455,9 +1469,9 @@ } /** - * Returns the Class object the provides the XSLTC DTM Manager service. + * Returns a new instance of the XSLTC DTM Manager service. */ - protected Class getDTMManagerClass() { - return m_DTMManagerClass; + protected final XSLTCDTMManager createNewDTMManagerInstance() { + return XSLTCDTMManager.newInstance(); } } diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerHandlerImpl.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerHandlerImpl.java Tue May 23 13:19:17 2017 +0300 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerHandlerImpl.java Thu Jun 06 20:47:13 2013 +0200 @@ -96,6 +96,7 @@ * resolved. * @return The systemID that was set with setSystemId(String id) */ + @Override public String getSystemId() { return _systemId; } @@ -106,6 +107,7 @@ * resolved. * @param id Base URI for this stylesheet */ + @Override public void setSystemId(String id) { _systemId = id; } @@ -116,6 +118,7 @@ * order to set parameters and output properties. * @return The Transformer object */ + @Override public Transformer getTransformer() { return _transformer; } @@ -127,6 +130,7 @@ * @param result A Result instance, should not be null * @throws IllegalArgumentException if result is invalid for some reason */ + @Override public void setResult(Result result) throws IllegalArgumentException { _result = result; @@ -166,6 +170,7 @@ * Implements org.xml.sax.ContentHandler.characters() * Receive notification of character data. */ + @Override public void characters(char[] ch, int start, int length) throws SAXException { @@ -176,6 +181,7 @@ * Implements org.xml.sax.ContentHandler.startDocument() * Receive notification of the beginning of a document. */ + @Override public void startDocument() throws SAXException { // Make sure setResult() was called before the first SAX event if (_result == null) { @@ -189,10 +195,8 @@ // Create an internal DOM (not W3C) and get SAX2 input handler try { - dtmManager = - (XSLTCDTMManager)_transformer.getTransformerFactory() - .getDTMManagerClass() - .newInstance(); + dtmManager = _transformer.getTransformerFactory() + .createNewDTMManagerInstance(); } catch (Exception e) { throw new SAXException(e); } @@ -230,6 +234,7 @@ * Implements org.xml.sax.ContentHandler.endDocument() * Receive notification of the end of a document. */ + @Override public void endDocument() throws SAXException { // Signal to the DOMBuilder that the document is complete _handler.endDocument(); @@ -260,6 +265,7 @@ * Implements org.xml.sax.ContentHandler.startElement() * Receive notification of the beginning of an element. */ + @Override public void startElement(String uri, String localName, String qname, Attributes attributes) throws SAXException @@ -271,6 +277,7 @@ * Implements org.xml.sax.ContentHandler.endElement() * Receive notification of the end of an element. */ + @Override public void endElement(String namespaceURI, String localName, String qname) throws SAXException { @@ -281,6 +288,7 @@ * Implements org.xml.sax.ContentHandler.processingInstruction() * Receive notification of a processing instruction. */ + @Override public void processingInstruction(String target, String data) throws SAXException { @@ -290,6 +298,7 @@ /** * Implements org.xml.sax.ext.LexicalHandler.startCDATA() */ + @Override public void startCDATA() throws SAXException { if (_lexHandler != null) { _lexHandler.startCDATA(); @@ -299,6 +308,7 @@ /** * Implements org.xml.sax.ext.LexicalHandler.endCDATA() */ + @Override public void endCDATA() throws SAXException { if (_lexHandler != null) { _lexHandler.endCDATA(); @@ -309,6 +319,7 @@ * Implements org.xml.sax.ext.LexicalHandler.comment() * Receieve notification of a comment */ + @Override public void comment(char[] ch, int start, int length) throws SAXException { @@ -322,6 +333,7 @@ * Receive notification of ignorable whitespace in element * content. Similar to characters(char[], int, int). */ + @Override public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { @@ -332,6 +344,7 @@ * Implements org.xml.sax.ContentHandler.setDocumentLocator() * Receive an object for locating the origin of SAX document events. */ + @Override public void setDocumentLocator(Locator locator) { _locator = locator; @@ -344,6 +357,7 @@ * Implements org.xml.sax.ContentHandler.skippedEntity() * Receive notification of a skipped entity. */ + @Override public void skippedEntity(String name) throws SAXException { _handler.skippedEntity(name); } @@ -352,6 +366,7 @@ * Implements org.xml.sax.ContentHandler.startPrefixMapping() * Begin the scope of a prefix-URI Namespace mapping. */ + @Override public void startPrefixMapping(String prefix, String uri) throws SAXException { _handler.startPrefixMapping(prefix, uri); @@ -361,6 +376,7 @@ * Implements org.xml.sax.ContentHandler.endPrefixMapping() * End the scope of a prefix-URI Namespace mapping. */ + @Override public void endPrefixMapping(String prefix) throws SAXException { _handler.endPrefixMapping(prefix); } @@ -368,6 +384,7 @@ /** * Implements org.xml.sax.ext.LexicalHandler.startDTD() */ + @Override public void startDTD(String name, String publicId, String systemId) throws SAXException { @@ -379,6 +396,7 @@ /** * Implements org.xml.sax.ext.LexicalHandler.endDTD() */ + @Override public void endDTD() throws SAXException { if (_lexHandler != null) { _lexHandler.endDTD(); @@ -388,6 +406,7 @@ /** * Implements org.xml.sax.ext.LexicalHandler.startEntity() */ + @Override public void startEntity(String name) throws SAXException { if (_lexHandler != null) { _lexHandler.startEntity(name); @@ -397,6 +416,7 @@ /** * Implements org.xml.sax.ext.LexicalHandler.endEntity() */ + @Override public void endEntity(String name) throws SAXException { if (_lexHandler != null) { _lexHandler.endEntity(name); @@ -406,6 +426,7 @@ /** * Implements org.xml.sax.DTDHandler.unparsedEntityDecl() */ + @Override public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException { @@ -418,6 +439,7 @@ /** * Implements org.xml.sax.DTDHandler.notationDecl() */ + @Override public void notationDecl(String name, String publicId, String systemId) throws SAXException { @@ -429,6 +451,7 @@ /** * Implements org.xml.sax.ext.DeclHandler.attributeDecl() */ + @Override public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException { @@ -440,6 +463,7 @@ /** * Implements org.xml.sax.ext.DeclHandler.elementDecl() */ + @Override public void elementDecl(String name, String model) throws SAXException { @@ -451,6 +475,7 @@ /** * Implements org.xml.sax.ext.DeclHandler.externalEntityDecl() */ + @Override public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException { @@ -462,6 +487,7 @@ /** * Implements org.xml.sax.ext.DeclHandler.externalEntityDecl() */ + @Override public void internalEntityDecl(String name, String value) throws SAXException { diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java Tue May 23 13:19:17 2017 +0300 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java Thu Jun 06 20:47:13 2013 +0200 @@ -100,10 +100,6 @@ public final class TransformerImpl extends Transformer implements DOMCache, ErrorListener { - private final static String EMPTY_STRING = ""; - private final static String NO_STRING = "no"; - private final static String YES_STRING = "yes"; - private final static String XML_STRING = "xml"; private final static String LEXICAL_HANDLER_PROPERTY = "http://xml.org/sax/properties/lexical-handler"; @@ -157,7 +153,7 @@ private TransletOutputHandlerFactory _tohFactory = null; /** - * A reference to a internal DOM represenation of the input. + * A reference to a internal DOM representation of the input. */ private DOM _dom = null; @@ -224,7 +220,8 @@ public MessageHandler(ErrorListener errorListener) { _errorListener = errorListener; } - + + @Override public void displayMessage(String msg) { if(_errorListener == null) { System.err.println(msg); @@ -296,6 +293,7 @@ * @param result Will contain the output from the transformation * @throws TransformerException */ + @Override public void transform(Source source, Result result) throws TransformerException { @@ -438,7 +436,7 @@ // System Id may be in one of several forms, (1) a uri // that starts with 'file:', (2) uri that starts with 'http:' // or (3) just a filename on the local system. - URL url = null; + URL url; if (systemId.startsWith("file:")) { // if StreamResult(File) or setSystemID(File) was used, // the systemId will be URI encoded as a result of File.toURI(), @@ -516,7 +514,7 @@ */ private DOM getDOM(Source source) throws TransformerException { try { - DOM dom = null; + DOM dom; if (source != null) { DTMWSFilter wsfilter; @@ -531,8 +529,7 @@ if (_dtmManager == null) { _dtmManager = - (XSLTCDTMManager)_tfactory.getDTMManagerClass() - .newInstance(); + _tfactory.createNewDTMManagerInstance(); } dom = (DOM)_dtmManager.getDTM(source, false, wsfilter, true, false, false, 0, hasIdCall); @@ -654,8 +651,8 @@ } } else if (source instanceof StAXSource) { final StAXSource staxSource = (StAXSource)source; - StAXEvent2SAX staxevent2sax = null; - StAXStream2SAX staxStream2SAX = null; + StAXEvent2SAX staxevent2sax; + StAXStream2SAX staxStream2SAX; if (staxSource.getXMLEventReader() != null) { final XMLEventReader xmlEventReader = staxSource.getXMLEventReader(); staxevent2sax = new StAXEvent2SAX(xmlEventReader); @@ -750,6 +747,7 @@ * * @return The error event handler currently in effect */ + @Override public ErrorListener getErrorListener() { return _errorListener; } @@ -763,6 +761,7 @@ * @param listener The error event listener to use * @throws IllegalArgumentException */ + @Override public void setErrorListener(ErrorListener listener) throws IllegalArgumentException { if (listener == null) { @@ -812,6 +811,7 @@ * * @return Properties in effect for this Transformer */ + @Override public Properties getOutputProperties() { return (Properties) _properties.clone(); } @@ -825,6 +825,7 @@ * @param name A non-null string that contains the name of the property * @throws IllegalArgumentException if the property name is not known */ + @Override public String getOutputProperty(String name) throws IllegalArgumentException { @@ -844,6 +845,7 @@ * @param properties The properties to use for the Transformer * @throws IllegalArgumentException Never, errors are ignored */ + @Override public void setOutputProperties(Properties properties) throws IllegalArgumentException { @@ -880,6 +882,7 @@ * @param value The value to assign to the property * @throws IllegalArgumentException Never, errors are ignored */ + @Override public void setOutputProperty(String name, String value) throws IllegalArgumentException { @@ -1149,6 +1152,7 @@ * @param name The name of the parameter * @param value The value to assign to the parameter */ + @Override public void setParameter(String name, Object value) { if (value == null) { @@ -1172,6 +1176,7 @@ * Clear all parameters set with setParameter. Clears the translet's * parameter stack. */ + @Override public void clearParameters() { if (_isIdentity && _parameters != null) { _parameters.clear(); @@ -1189,6 +1194,7 @@ * @param name The name of the parameter * @return An object that contains the value assigned to the parameter */ + @Override public final Object getParameter(String name) { if (_isIdentity) { return (_parameters != null) ? _parameters.get(name) : null; @@ -1204,6 +1210,7 @@ * * @return The URLResolver object currently in use */ + @Override public URIResolver getURIResolver() { return _uriResolver; } @@ -1214,6 +1221,7 @@ * * @param resolver The URIResolver to use in document() */ + @Override public void setURIResolver(URIResolver resolver) { _uriResolver = resolver; } @@ -1232,6 +1240,7 @@ * @param href The href argument passed to the document function. * @param translet A reference to the translet requesting the document */ + @Override public DOM retrieveDocument(String baseURI, String href, Translet translet) { try { // Argument to document function was: document(''); @@ -1274,6 +1283,7 @@ * @throws TransformerException if the application chooses to discontinue * the transformation (always does in our case). */ + @Override public void error(TransformerException e) throws TransformerException { @@ -1302,6 +1312,7 @@ * @throws TransformerException if the application chooses to discontinue * the transformation (always does in our case). */ + @Override public void fatalError(TransformerException e) throws TransformerException { @@ -1330,6 +1341,7 @@ * @throws TransformerException if the application chooses to discontinue * the transformation (never does in our case). */ + @Override public void warning(TransformerException e) throws TransformerException { @@ -1350,6 +1362,7 @@ * created * @since 1.5 */ + @Override public void reset() { _method = null; diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java Tue May 23 13:19:17 2017 +0300 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java Thu Jun 06 20:47:13 2013 +0200 @@ -20,15 +20,6 @@ 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 @@ -51,113 +42,9 @@ private static final String JAXP_INTERNAL = "com.sun.org.apache"; private static final String STAX_INTERNAL = "com.sun.xml.internal"; - // 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: - *
    - *
  1. query the system property using System.getProperty - *
  2. read META-INF/services/factoryId file - *
  3. use fallback classname - *
- * - * @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: - *
    - *
  1. query the system property using System.getProperty - *
  2. read $java.home/lib/propertiesFilename file - *
  3. read META-INF/services/factoryId file - *
  4. use fallback classname - *
- * - * @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 @@ -236,7 +123,7 @@ // 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 @@ -341,94 +228,4 @@ 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 diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java Tue May 23 13:19:17 2017 +0300 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java Thu Jun 06 20:47:13 2013 +0200 @@ -51,14 +51,6 @@ public abstract class DTMManager { - /** The default property name to load the manager. */ - private static final String defaultPropName = - "com.sun.org.apache.xml.internal.dtm.DTMManager"; - - /** The default class name to use as the manager. */ - private static String defaultClassName = - "com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault"; - /** * Factory for creating XMLString objects. * %TBD% Make this set by the caller. @@ -95,29 +87,7 @@ /** * Obtain a new instance of a DTMManager. * This static method creates a new factory instance - * This method uses the following ordered lookup procedure to determine - * the DTMManager implementation class to - * load: - * @@ -131,32 +101,11 @@ * @throws DTMConfigurationException * if the implementation is not available or cannot be instantiated. */ - public static DTMManager newInstance(XMLStringFactory xsf) - throws DTMConfigurationException - { - DTMManager factoryImpl = null; - try - { - factoryImpl = (DTMManager) ObjectFactory - .createObject(defaultPropName, defaultClassName); - } - catch (ObjectFactory.ConfigurationError e) - { - throw new DTMConfigurationException(XMLMessages.createXMLMessage( - XMLErrorResources.ER_NO_DEFAULT_IMPL, null), e.getException()); - //"No default implementation found"); - } + public static DTMManager newInstance(XMLStringFactory xsf) { + final DTMManager factoryImpl = new com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault(); + factoryImpl.setXMLStringFactory(xsf); - if (factoryImpl == null) - { - throw new DTMConfigurationException(XMLMessages.createXMLMessage( - XMLErrorResources.ER_NO_DEFAULT_IMPL, null)); - //"No default implementation found"); - } - - factoryImpl.setXMLStringFactory(xsf); - - return factoryImpl; + return factoryImpl; } /** diff -r 9849cc530d6d -r ade6118af296 drop_included/jaxp_src/src/com/sun/org/apache/xpath/internal/XPathContext.java --- a/drop_included/jaxp_src/src/com/sun/org/apache/xpath/internal/XPathContext.java Tue May 23 13:19:17 2017 +0300 +++ b/drop_included/jaxp_src/src/com/sun/org/apache/xpath/internal/XPathContext.java Thu Jun 06 20:47:13 2013 +0200 @@ -22,17 +22,6 @@ */ package com.sun.org.apache.xpath.internal; -import java.lang.reflect.Method; -import java.util.Stack; -import java.util.Vector; -import java.util.HashMap; -import java.util.Iterator; - -import javax.xml.transform.ErrorListener; -import javax.xml.transform.SourceLocator; -import javax.xml.transform.TransformerException; -import javax.xml.transform.URIResolver; - import com.sun.org.apache.xalan.internal.extensions.ExpressionContext; import com.sun.org.apache.xalan.internal.res.XSLMessages; import com.sun.org.apache.xml.internal.dtm.Axis; @@ -46,14 +35,21 @@ import com.sun.org.apache.xml.internal.utils.NodeVector; import com.sun.org.apache.xml.internal.utils.ObjectStack; import com.sun.org.apache.xml.internal.utils.PrefixResolver; -import com.sun.org.apache.xml.internal.utils.SAXSourceLocator; import com.sun.org.apache.xml.internal.utils.XMLString; import com.sun.org.apache.xpath.internal.axes.SubContextList; +import com.sun.org.apache.xpath.internal.objects.DTMXRTreeFrag; import com.sun.org.apache.xpath.internal.objects.XObject; -import com.sun.org.apache.xpath.internal.objects.DTMXRTreeFrag; import com.sun.org.apache.xpath.internal.objects.XString; import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; - +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Stack; +import java.util.Vector; +import javax.xml.transform.ErrorListener; +import javax.xml.transform.SourceLocator; +import javax.xml.transform.TransformerException; +import javax.xml.transform.URIResolver; import org.xml.sax.XMLReader; /** @@ -610,32 +606,6 @@ /** Misnamed string manager for XPath messages. */ // private static XSLMessages m_XSLMessages = new XSLMessages(); - /** - * Tell the user of an assertion error, and probably throw an - * exception. - * - * @param b If false, a TransformerException will be thrown. - * @param msg The assertion message, which should be informative. - * - * @throws javax.xml.transform.TransformerException if b is false. - */ - private void assertion(boolean b, String msg) throws javax.xml.transform.TransformerException - { - if (!b) - { - ErrorListener errorHandler = getErrorListener(); - - if (errorHandler != null) - { - errorHandler.fatalError( - new TransformerException( - XSLMessages.createMessage( - XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, - new Object[]{ msg }), (SAXSourceLocator)this.getSAXLocator())); - } - } - } - //========================================================== // SECTION: Execution context state tracking //========================================================== @@ -652,7 +622,7 @@ * Get the current context node list. * * @return the current node list, - * also refered to here as a context node list. + * also referred to here as a context node list. */ public final DTMIterator getContextNodeList() { @@ -667,7 +637,7 @@ * Set the current context node list. * * @param nl the current node list, - * also refered to here as a context node list. + * also referred to here as a context node list. * @xsl.usage internal */ public final void pushContextNodeList(DTMIterator nl) @@ -688,7 +658,7 @@ } /** - * The ammount to use for stacks that record information during the + * The amount to use for stacks that record information during the * recursive execution. */ public static final int RECURSIONLIMIT = (1024*4);