mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8130051: Cleanup usage of reflection in jaxp
Replaced usage of reflection with direct access where possible, removed obsolete code where possible. Reviewed-by: joehw
This commit is contained in:
parent
eb76b21f6d
commit
0c329ac4cf
23 changed files with 135 additions and 1236 deletions
|
@ -1,154 +0,0 @@
|
||||||
/*
|
|
||||||
* reserved comment block
|
|
||||||
* DO NOT REMOVE OR ALTER!
|
|
||||||
*/
|
|
||||||
package com.sun.org.apache.bcel.internal.util;
|
|
||||||
|
|
||||||
/* ====================================================================
|
|
||||||
* The Apache Software License, Version 1.1
|
|
||||||
*
|
|
||||||
* Copyright (c) 2001 The Apache Software Foundation. All rights
|
|
||||||
* reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
*
|
|
||||||
* 3. The end-user documentation included with the redistribution,
|
|
||||||
* if any, must include the following acknowledgment:
|
|
||||||
* "This product includes software developed by the
|
|
||||||
* Apache Software Foundation (http://www.apache.org/)."
|
|
||||||
* Alternately, this acknowledgment may appear in the software itself,
|
|
||||||
* if and wherever such third-party acknowledgments normally appear.
|
|
||||||
*
|
|
||||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
|
||||||
* "Apache BCEL" must not be used to endorse or promote products
|
|
||||||
* derived from this software without prior written permission. For
|
|
||||||
* written permission, please contact apache@apache.org.
|
|
||||||
*
|
|
||||||
* 5. Products derived from this software may not be called "Apache",
|
|
||||||
* "Apache BCEL", nor may "Apache" appear in their name, without
|
|
||||||
* prior written permission of the Apache Software Foundation.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
|
||||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
||||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
* ====================================================================
|
|
||||||
*
|
|
||||||
* This software consists of voluntary contributions made by many
|
|
||||||
* individuals on behalf of the Apache Software Foundation. For more
|
|
||||||
* information on the Apache Software Foundation, please see
|
|
||||||
* <http://www.apache.org/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.lang.reflect.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Java interpreter replacement, i.e., wrapper that uses its own ClassLoader
|
|
||||||
* to modify/generate classes as they're requested. You can take this as a template
|
|
||||||
* for your own applications.<br>
|
|
||||||
* Call this wrapper with
|
|
||||||
* <pre>java com.sun.org.apache.bcel.internal.util.JavaWrapper <real.class.name> [arguments]</pre>
|
|
||||||
* <p>
|
|
||||||
* To use your own class loader you can set the "bcel.classloader" system property
|
|
||||||
* which defaults to "com.sun.org.apache.bcel.internal.util.ClassLoader", e.g., with
|
|
||||||
* <pre>java com.sun.org.apache.bcel.internal.util.JavaWrapper -Dbcel.classloader=foo.MyLoader <real.class.name> [arguments]</pre>
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
|
|
||||||
* @see ClassLoader
|
|
||||||
*/
|
|
||||||
public class JavaWrapper {
|
|
||||||
private java.lang.ClassLoader loader;
|
|
||||||
|
|
||||||
private static java.lang.ClassLoader getClassLoader() {
|
|
||||||
String s = SecuritySupport.getSystemProperty("bcel.classloader");
|
|
||||||
|
|
||||||
if((s == null) || "".equals(s))
|
|
||||||
s = "com.sun.org.apache.bcel.internal.util.ClassLoader";
|
|
||||||
|
|
||||||
try {
|
|
||||||
return (java.lang.ClassLoader)Class.forName(s).newInstance();
|
|
||||||
} catch(Exception e) {
|
|
||||||
throw new RuntimeException(e.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public JavaWrapper(java.lang.ClassLoader loader) {
|
|
||||||
this.loader = loader;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JavaWrapper() {
|
|
||||||
this(getClassLoader());
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Runs the _main method of the given class with the arguments passed in argv
|
|
||||||
*
|
|
||||||
* @param class_name the fully qualified class name
|
|
||||||
* @param argv the arguments just as you would pass them directly
|
|
||||||
*/
|
|
||||||
public void runMain(String class_name, String[] argv) throws ClassNotFoundException
|
|
||||||
{
|
|
||||||
Class cl = loader.loadClass(class_name);
|
|
||||||
Method method = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
method = cl.getMethod("_main", new Class[] { argv.getClass() });
|
|
||||||
|
|
||||||
/* Method _main is sane ?
|
|
||||||
*/
|
|
||||||
int m = method.getModifiers();
|
|
||||||
Class r = method.getReturnType();
|
|
||||||
|
|
||||||
if(!(Modifier.isPublic(m) && Modifier.isStatic(m)) ||
|
|
||||||
Modifier.isAbstract(m) || (r != Void.TYPE))
|
|
||||||
throw new NoSuchMethodException();
|
|
||||||
} catch(NoSuchMethodException no) {
|
|
||||||
System.out.println("In class " + class_name +
|
|
||||||
": public static void _main(String[] argv) is not defined");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
method.invoke(null, new Object[] { argv });
|
|
||||||
} catch(Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Default _main method used as wrapper, expects the fully qualified class name
|
|
||||||
* of the real class as the first argument.
|
|
||||||
*/
|
|
||||||
public static void _main(String[] argv) throws Exception {
|
|
||||||
/* Expects class name as first argument, other arguments are by-passed.
|
|
||||||
*/
|
|
||||||
if(argv.length == 0) {
|
|
||||||
System.out.println("Missing class name.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String class_name = argv[0];
|
|
||||||
String[] new_argv = new String[argv.length - 1];
|
|
||||||
System.arraycopy(argv, 1, new_argv, 0, new_argv.length);
|
|
||||||
|
|
||||||
JavaWrapper wrapper = new JavaWrapper();
|
|
||||||
wrapper.runMain(class_name, new_argv);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -22,20 +22,16 @@
|
||||||
*/
|
*/
|
||||||
package com.sun.org.apache.xalan.internal.lib;
|
package com.sun.org.apache.xalan.internal.lib;
|
||||||
|
|
||||||
import java.util.Hashtable;
|
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import com.sun.org.apache.xalan.internal.extensions.ExpressionContext;
|
import com.sun.org.apache.xalan.internal.extensions.ExpressionContext;
|
||||||
import com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck;
|
|
||||||
import com.sun.org.apache.xpath.internal.NodeSet;
|
import com.sun.org.apache.xpath.internal.NodeSet;
|
||||||
import com.sun.org.apache.xpath.internal.objects.XBoolean;
|
import com.sun.org.apache.xpath.internal.objects.XBoolean;
|
||||||
import com.sun.org.apache.xpath.internal.objects.XNumber;
|
import com.sun.org.apache.xpath.internal.objects.XNumber;
|
||||||
import com.sun.org.apache.xpath.internal.objects.XObject;
|
import com.sun.org.apache.xpath.internal.objects.XObject;
|
||||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.DocumentFragment;
|
import org.w3c.dom.DocumentFragment;
|
||||||
|
@ -275,102 +271,6 @@ public class Extensions
|
||||||
return tokenize(toTokenize, " \t\n\r");
|
return tokenize(toTokenize, " \t\n\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a Node of basic debugging information from the
|
|
||||||
* EnvironmentCheck utility about the Java environment.
|
|
||||||
*
|
|
||||||
* <p>Simply calls the {@link com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck}
|
|
||||||
* utility to grab info about the Java environment and CLASSPATH,
|
|
||||||
* etc., and then returns the resulting Node. Stylesheets can
|
|
||||||
* then maniuplate this data or simply xsl:copy-of the Node. Note
|
|
||||||
* that we first attempt to load the more advanced
|
|
||||||
* org.apache.env.Which utility by reflection; only if that fails
|
|
||||||
* to we still use the internal version. Which is available from
|
|
||||||
* <a href="http://xml.apache.org/commons/">http://xml.apache.org/commons/</a>.</p>
|
|
||||||
*
|
|
||||||
* <p>We throw a WrappedRuntimeException in the unlikely case
|
|
||||||
* that reading information from the environment throws us an
|
|
||||||
* exception. (Is this really the best thing to do?)</p>
|
|
||||||
*
|
|
||||||
* @param myContext an <code>ExpressionContext</code> passed in by the
|
|
||||||
* extension mechanism. This must be an XPathContext.
|
|
||||||
* @return a Node as described above.
|
|
||||||
*/
|
|
||||||
public static Node checkEnvironment(ExpressionContext myContext)
|
|
||||||
{
|
|
||||||
|
|
||||||
Document factoryDocument = getDocument();
|
|
||||||
|
|
||||||
Node resultNode = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// First use reflection to try to load Which, which is a
|
|
||||||
// better version of EnvironmentCheck
|
|
||||||
resultNode = checkEnvironmentUsingWhich(myContext, factoryDocument);
|
|
||||||
|
|
||||||
if (null != resultNode)
|
|
||||||
return resultNode;
|
|
||||||
|
|
||||||
// If reflection failed, fallback to our internal EnvironmentCheck
|
|
||||||
EnvironmentCheck envChecker = new EnvironmentCheck();
|
|
||||||
Hashtable h = envChecker.getEnvironmentHash();
|
|
||||||
resultNode = factoryDocument.createElement("checkEnvironmentExtension");
|
|
||||||
envChecker.appendEnvironmentReport(resultNode, factoryDocument, h);
|
|
||||||
envChecker = null;
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Private worker method to attempt to use org.apache.env.Which.
|
|
||||||
*
|
|
||||||
* @param myContext an <code>ExpressionContext</code> passed in by the
|
|
||||||
* extension mechanism. This must be an XPathContext.
|
|
||||||
* @param factoryDocument providing createElement services, etc.
|
|
||||||
* @return a Node with environment info; null if any error
|
|
||||||
*/
|
|
||||||
private static Node checkEnvironmentUsingWhich(ExpressionContext myContext,
|
|
||||||
Document factoryDocument)
|
|
||||||
{
|
|
||||||
final String WHICH_CLASSNAME = "org.apache.env.Which";
|
|
||||||
final String WHICH_METHODNAME = "which";
|
|
||||||
final Class WHICH_METHOD_ARGS[] = { java.util.Hashtable.class,
|
|
||||||
java.lang.String.class,
|
|
||||||
java.lang.String.class };
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Use reflection to try to find xml-commons utility 'Which'
|
|
||||||
Class clazz = ObjectFactory.findProviderClass(WHICH_CLASSNAME, true);
|
|
||||||
if (null == clazz)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// Fully qualify names since this is the only method they're used in
|
|
||||||
java.lang.reflect.Method method = clazz.getMethod(WHICH_METHODNAME, WHICH_METHOD_ARGS);
|
|
||||||
Hashtable report = new Hashtable();
|
|
||||||
|
|
||||||
// Call the method with our Hashtable, common options, and ignore return value
|
|
||||||
Object[] methodArgs = { report, "XmlCommons;Xalan;Xerces;Crimson;Ant", "" };
|
|
||||||
Object returnValue = method.invoke(null, methodArgs);
|
|
||||||
|
|
||||||
// Create a parent to hold the report and append hash to it
|
|
||||||
Node resultNode = factoryDocument.createElement("checkEnvironmentExtension");
|
|
||||||
com.sun.org.apache.xml.internal.utils.Hashtree2Node.appendHashToNode(report, "whichReport",
|
|
||||||
resultNode, factoryDocument);
|
|
||||||
|
|
||||||
return resultNode;
|
|
||||||
}
|
|
||||||
catch (Throwable t)
|
|
||||||
{
|
|
||||||
// Simply return null; no need to report error
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return an instance of DOM Document
|
* @return an instance of DOM Document
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -121,22 +121,7 @@ public class ObjectFactory {
|
||||||
public static Object newInstance(String className, boolean doFallback)
|
public static Object newInstance(String className, boolean doFallback)
|
||||||
throws ConfigurationError
|
throws ConfigurationError
|
||||||
{
|
{
|
||||||
if (System.getSecurityManager()!=null) {
|
ClassLoader cl = System.getSecurityManager()!=null ? null : findClassLoader();
|
||||||
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{
|
try{
|
||||||
Class providerClass = findProviderClass(className, cl, doFallback);
|
Class providerClass = findProviderClass(className, cl, doFallback);
|
||||||
Object instance = providerClass.newInstance();
|
Object instance = providerClass.newInstance();
|
||||||
|
|
|
@ -1,455 +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: SmartTransformerFactoryImpl.java,v 1.2.4.1 2005/09/14 09:57:13 pvedula Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
package com.sun.org.apache.xalan.internal.xsltc.trax;
|
|
||||||
|
|
||||||
import javax.xml.XMLConstants;
|
|
||||||
import javax.xml.transform.ErrorListener;
|
|
||||||
import javax.xml.transform.Source;
|
|
||||||
import javax.xml.transform.Templates;
|
|
||||||
import javax.xml.transform.Transformer;
|
|
||||||
import javax.xml.transform.TransformerConfigurationException;
|
|
||||||
import javax.xml.transform.TransformerException;
|
|
||||||
import javax.xml.transform.URIResolver;
|
|
||||||
import javax.xml.transform.dom.DOMResult;
|
|
||||||
import javax.xml.transform.dom.DOMSource;
|
|
||||||
import javax.xml.transform.sax.SAXResult;
|
|
||||||
import javax.xml.transform.sax.SAXSource;
|
|
||||||
import javax.xml.transform.sax.SAXTransformerFactory;
|
|
||||||
import javax.xml.transform.sax.TemplatesHandler;
|
|
||||||
import javax.xml.transform.sax.TransformerHandler;
|
|
||||||
import javax.xml.transform.stream.StreamResult;
|
|
||||||
import javax.xml.transform.stream.StreamSource;
|
|
||||||
|
|
||||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
|
||||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
|
||||||
import org.xml.sax.XMLFilter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of a transformer factory that uses an XSLTC
|
|
||||||
* transformer factory for the creation of Templates objects
|
|
||||||
* and uses the Xalan processor transformer factory for the
|
|
||||||
* creation of Transformer objects.
|
|
||||||
* @author G. Todd Miller
|
|
||||||
*/
|
|
||||||
public class SmartTransformerFactoryImpl extends SAXTransformerFactory
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* <p>Name of class as a constant to use for debugging.</p>
|
|
||||||
*/
|
|
||||||
private static final String CLASS_NAME = "SmartTransformerFactoryImpl";
|
|
||||||
|
|
||||||
private SAXTransformerFactory _xsltcFactory = null;
|
|
||||||
private SAXTransformerFactory _xalanFactory = null;
|
|
||||||
private SAXTransformerFactory _currFactory = null;
|
|
||||||
private ErrorListener _errorlistener = null;
|
|
||||||
private URIResolver _uriresolver = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>State of secure processing feature.</p>
|
|
||||||
*/
|
|
||||||
private boolean featureSecureProcessing = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* implementation of the SmartTransformerFactory. This factory
|
|
||||||
* uses com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory
|
|
||||||
* to return Templates objects; and uses
|
|
||||||
* com.sun.org.apache.xalan.internal.processor.TransformerFactory
|
|
||||||
* to return Transformer objects.
|
|
||||||
*/
|
|
||||||
public SmartTransformerFactoryImpl() { }
|
|
||||||
|
|
||||||
private void createXSLTCTransformerFactory() {
|
|
||||||
_xsltcFactory = new TransformerFactoryImpl();
|
|
||||||
_currFactory = _xsltcFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createXalanTransformerFactory() {
|
|
||||||
final String xalanMessage =
|
|
||||||
"com.sun.org.apache.xalan.internal.xsltc.trax.SmartTransformerFactoryImpl "+
|
|
||||||
"could not create an "+
|
|
||||||
"com.sun.org.apache.xalan.internal.processor.TransformerFactoryImpl.";
|
|
||||||
// try to create instance of Xalan factory...
|
|
||||||
try {
|
|
||||||
Class xalanFactClass = ObjectFactory.findProviderClass(
|
|
||||||
"com.sun.org.apache.xalan.internal.processor.TransformerFactoryImpl",
|
|
||||||
true);
|
|
||||||
_xalanFactory = (SAXTransformerFactory)
|
|
||||||
xalanFactClass.newInstance();
|
|
||||||
}
|
|
||||||
catch (ClassNotFoundException e) {
|
|
||||||
System.err.println(xalanMessage);
|
|
||||||
}
|
|
||||||
catch (InstantiationException e) {
|
|
||||||
System.err.println(xalanMessage);
|
|
||||||
}
|
|
||||||
catch (IllegalAccessException e) {
|
|
||||||
System.err.println(xalanMessage);
|
|
||||||
}
|
|
||||||
_currFactory = _xalanFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorListener(ErrorListener listener)
|
|
||||||
throws IllegalArgumentException
|
|
||||||
{
|
|
||||||
_errorlistener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ErrorListener getErrorListener() {
|
|
||||||
return _errorlistener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getAttribute(String name)
|
|
||||||
throws IllegalArgumentException
|
|
||||||
{
|
|
||||||
// GTM: NB: 'debug' should change to something more unique...
|
|
||||||
if ((name.equals("translet-name")) || (name.equals("debug"))) {
|
|
||||||
if (_xsltcFactory == null) {
|
|
||||||
createXSLTCTransformerFactory();
|
|
||||||
}
|
|
||||||
return _xsltcFactory.getAttribute(name);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (_xalanFactory == null) {
|
|
||||||
createXalanTransformerFactory();
|
|
||||||
}
|
|
||||||
return _xalanFactory.getAttribute(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAttribute(String name, Object value)
|
|
||||||
throws IllegalArgumentException {
|
|
||||||
// GTM: NB: 'debug' should change to something more unique...
|
|
||||||
if ((name.equals("translet-name")) || (name.equals("debug"))) {
|
|
||||||
if (_xsltcFactory == null) {
|
|
||||||
createXSLTCTransformerFactory();
|
|
||||||
}
|
|
||||||
_xsltcFactory.setAttribute(name, value);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (_xalanFactory == null) {
|
|
||||||
createXalanTransformerFactory();
|
|
||||||
}
|
|
||||||
_xalanFactory.setAttribute(name, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Set a feature for this <code>SmartTransformerFactory</code> and <code>Transformer</code>s
|
|
||||||
* or <code>Template</code>s created by this factory.</p>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Feature names are fully qualified {@link java.net.URI}s.
|
|
||||||
* Implementations may define their own features.
|
|
||||||
* An {@link TransformerConfigurationException} is thrown if this <code>TransformerFactory</code> or the
|
|
||||||
* <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature.
|
|
||||||
* It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <p>See {@link javax.xml.transform.TransformerFactory} for full documentation of specific features.</p>
|
|
||||||
*
|
|
||||||
* @param name Feature name.
|
|
||||||
* @param value Is feature state <code>true</code> or <code>false</code>.
|
|
||||||
*
|
|
||||||
* @throws TransformerConfigurationException if this <code>TransformerFactory</code>
|
|
||||||
* or the <code>Transformer</code>s or <code>Template</code>s it creates cannot support this feature.
|
|
||||||
* @throws NullPointerException If the <code>name</code> parameter is null.
|
|
||||||
*/
|
|
||||||
public void setFeature(String name, boolean value)
|
|
||||||
throws TransformerConfigurationException {
|
|
||||||
|
|
||||||
// feature name cannot be null
|
|
||||||
if (name == null) {
|
|
||||||
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_FEATURE_NULL_NAME);
|
|
||||||
throw new NullPointerException(err.toString());
|
|
||||||
}
|
|
||||||
// secure processing?
|
|
||||||
else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
|
|
||||||
featureSecureProcessing = value;
|
|
||||||
// all done processing feature
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// unknown feature
|
|
||||||
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name);
|
|
||||||
throw new TransformerConfigurationException(err.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* javax.xml.transform.sax.TransformerFactory implementation.
|
|
||||||
* Look up the value of a feature (to see if it is supported).
|
|
||||||
* This method must be updated as the various methods and features of this
|
|
||||||
* class are implemented.
|
|
||||||
*
|
|
||||||
* @param name The feature name
|
|
||||||
* @return 'true' if feature is supported, 'false' if not
|
|
||||||
*/
|
|
||||||
public boolean getFeature(String name) {
|
|
||||||
// All supported features should be listed here
|
|
||||||
String[] features = {
|
|
||||||
DOMSource.FEATURE,
|
|
||||||
DOMResult.FEATURE,
|
|
||||||
SAXSource.FEATURE,
|
|
||||||
SAXResult.FEATURE,
|
|
||||||
StreamSource.FEATURE,
|
|
||||||
StreamResult.FEATURE
|
|
||||||
};
|
|
||||||
|
|
||||||
// feature name cannot be null
|
|
||||||
if (name == null) {
|
|
||||||
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
|
|
||||||
throw new NullPointerException(err.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inefficient, but it really does not matter in a function like this
|
|
||||||
for (int i = 0; i < features.length; i++) {
|
|
||||||
if (name.equals(features[i]))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// secure processing?
|
|
||||||
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
|
|
||||||
return featureSecureProcessing;
|
|
||||||
}
|
|
||||||
|
|
||||||
// unknown feature
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public URIResolver getURIResolver() {
|
|
||||||
return _uriresolver;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setURIResolver(URIResolver resolver) {
|
|
||||||
_uriresolver = resolver;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Source getAssociatedStylesheet(Source source, String media,
|
|
||||||
String title, String charset)
|
|
||||||
throws TransformerConfigurationException
|
|
||||||
{
|
|
||||||
if (_currFactory == null) {
|
|
||||||
createXSLTCTransformerFactory();
|
|
||||||
}
|
|
||||||
return _currFactory.getAssociatedStylesheet(source, media,
|
|
||||||
title, charset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a Transformer object that copies the input document to the
|
|
||||||
* result. Uses the com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
|
||||||
* @return A Transformer object.
|
|
||||||
*/
|
|
||||||
public Transformer newTransformer()
|
|
||||||
throws TransformerConfigurationException
|
|
||||||
{
|
|
||||||
if (_xalanFactory == null) {
|
|
||||||
createXalanTransformerFactory();
|
|
||||||
}
|
|
||||||
if (_errorlistener != null) {
|
|
||||||
_xalanFactory.setErrorListener(_errorlistener);
|
|
||||||
}
|
|
||||||
if (_uriresolver != null) {
|
|
||||||
_xalanFactory.setURIResolver(_uriresolver);
|
|
||||||
}
|
|
||||||
_currFactory = _xalanFactory;
|
|
||||||
return _currFactory.newTransformer();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a Transformer object that from the input stylesheet
|
|
||||||
* Uses the com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
|
||||||
* @param source the stylesheet.
|
|
||||||
* @return A Transformer object.
|
|
||||||
*/
|
|
||||||
public Transformer newTransformer(Source source) throws
|
|
||||||
TransformerConfigurationException
|
|
||||||
{
|
|
||||||
if (_xalanFactory == null) {
|
|
||||||
createXalanTransformerFactory();
|
|
||||||
}
|
|
||||||
if (_errorlistener != null) {
|
|
||||||
_xalanFactory.setErrorListener(_errorlistener);
|
|
||||||
}
|
|
||||||
if (_uriresolver != null) {
|
|
||||||
_xalanFactory.setURIResolver(_uriresolver);
|
|
||||||
}
|
|
||||||
_currFactory = _xalanFactory;
|
|
||||||
return _currFactory.newTransformer(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a Templates object that from the input stylesheet
|
|
||||||
* Uses the com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
|
||||||
* @param source the stylesheet.
|
|
||||||
* @return A Templates object.
|
|
||||||
*/
|
|
||||||
public Templates newTemplates(Source source)
|
|
||||||
throws TransformerConfigurationException
|
|
||||||
{
|
|
||||||
if (_xsltcFactory == null) {
|
|
||||||
createXSLTCTransformerFactory();
|
|
||||||
}
|
|
||||||
if (_errorlistener != null) {
|
|
||||||
_xsltcFactory.setErrorListener(_errorlistener);
|
|
||||||
}
|
|
||||||
if (_uriresolver != null) {
|
|
||||||
_xsltcFactory.setURIResolver(_uriresolver);
|
|
||||||
}
|
|
||||||
_currFactory = _xsltcFactory;
|
|
||||||
return _currFactory.newTemplates(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a TemplatesHandler object that can process SAX ContentHandler
|
|
||||||
* events into a Templates object. Uses the
|
|
||||||
* com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
|
||||||
*/
|
|
||||||
public TemplatesHandler newTemplatesHandler()
|
|
||||||
throws TransformerConfigurationException
|
|
||||||
{
|
|
||||||
if (_xsltcFactory == null) {
|
|
||||||
createXSLTCTransformerFactory();
|
|
||||||
}
|
|
||||||
if (_errorlistener != null) {
|
|
||||||
_xsltcFactory.setErrorListener(_errorlistener);
|
|
||||||
}
|
|
||||||
if (_uriresolver != null) {
|
|
||||||
_xsltcFactory.setURIResolver(_uriresolver);
|
|
||||||
}
|
|
||||||
return _xsltcFactory.newTemplatesHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a TransformerHandler object that can process SAX ContentHandler
|
|
||||||
* events based on a copy transformer.
|
|
||||||
* Uses com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
|
||||||
*/
|
|
||||||
public TransformerHandler newTransformerHandler()
|
|
||||||
throws TransformerConfigurationException
|
|
||||||
{
|
|
||||||
if (_xalanFactory == null) {
|
|
||||||
createXalanTransformerFactory();
|
|
||||||
}
|
|
||||||
if (_errorlistener != null) {
|
|
||||||
_xalanFactory.setErrorListener(_errorlistener);
|
|
||||||
}
|
|
||||||
if (_uriresolver != null) {
|
|
||||||
_xalanFactory.setURIResolver(_uriresolver);
|
|
||||||
}
|
|
||||||
return _xalanFactory.newTransformerHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a TransformerHandler object that can process SAX ContentHandler
|
|
||||||
* events based on a transformer specified by the stylesheet Source.
|
|
||||||
* Uses com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
|
||||||
*/
|
|
||||||
public TransformerHandler newTransformerHandler(Source src)
|
|
||||||
throws TransformerConfigurationException
|
|
||||||
{
|
|
||||||
if (_xalanFactory == null) {
|
|
||||||
createXalanTransformerFactory();
|
|
||||||
}
|
|
||||||
if (_errorlistener != null) {
|
|
||||||
_xalanFactory.setErrorListener(_errorlistener);
|
|
||||||
}
|
|
||||||
if (_uriresolver != null) {
|
|
||||||
_xalanFactory.setURIResolver(_uriresolver);
|
|
||||||
}
|
|
||||||
return _xalanFactory.newTransformerHandler(src);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a TransformerHandler object that can process SAX ContentHandler
|
|
||||||
* events based on a transformer specified by the stylesheet Source.
|
|
||||||
* Uses com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
|
||||||
*/
|
|
||||||
public TransformerHandler newTransformerHandler(Templates templates)
|
|
||||||
throws TransformerConfigurationException
|
|
||||||
{
|
|
||||||
if (_xsltcFactory == null) {
|
|
||||||
createXSLTCTransformerFactory();
|
|
||||||
}
|
|
||||||
if (_errorlistener != null) {
|
|
||||||
_xsltcFactory.setErrorListener(_errorlistener);
|
|
||||||
}
|
|
||||||
if (_uriresolver != null) {
|
|
||||||
_xsltcFactory.setURIResolver(_uriresolver);
|
|
||||||
}
|
|
||||||
return _xsltcFactory.newTransformerHandler(templates);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an XMLFilter that uses the given source as the
|
|
||||||
* transformation instructions. Uses
|
|
||||||
* com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
|
||||||
*/
|
|
||||||
public XMLFilter newXMLFilter(Source src)
|
|
||||||
throws TransformerConfigurationException {
|
|
||||||
if (_xsltcFactory == null) {
|
|
||||||
createXSLTCTransformerFactory();
|
|
||||||
}
|
|
||||||
if (_errorlistener != null) {
|
|
||||||
_xsltcFactory.setErrorListener(_errorlistener);
|
|
||||||
}
|
|
||||||
if (_uriresolver != null) {
|
|
||||||
_xsltcFactory.setURIResolver(_uriresolver);
|
|
||||||
}
|
|
||||||
Templates templates = _xsltcFactory.newTemplates(src);
|
|
||||||
if (templates == null ) return null;
|
|
||||||
return newXMLFilter(templates);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create an XMLFilter that uses the given source as the
|
|
||||||
* transformation instructions. Uses
|
|
||||||
* com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
|
||||||
*/
|
|
||||||
public XMLFilter newXMLFilter(Templates templates)
|
|
||||||
throws TransformerConfigurationException {
|
|
||||||
try {
|
|
||||||
return new com.sun.org.apache.xalan.internal.xsltc.trax.TrAXFilter(templates);
|
|
||||||
}
|
|
||||||
catch(TransformerConfigurationException e1) {
|
|
||||||
if (_xsltcFactory == null) {
|
|
||||||
createXSLTCTransformerFactory();
|
|
||||||
}
|
|
||||||
ErrorListener errorListener = _xsltcFactory.getErrorListener();
|
|
||||||
if(errorListener != null) {
|
|
||||||
try {
|
|
||||||
errorListener.fatalError(e1);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch( TransformerException e2) {
|
|
||||||
new TransformerConfigurationException(e2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw e1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -371,11 +371,7 @@ public class CoreDOMImplementationImpl
|
||||||
// to restrict the number of validation handlers being
|
// to restrict the number of validation handlers being
|
||||||
// requested
|
// requested
|
||||||
if(freeValidatorIndex < 0) {
|
if(freeValidatorIndex < 0) {
|
||||||
return (RevalidationHandler) (ObjectFactory
|
return new com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator();
|
||||||
.newInstance(
|
|
||||||
"com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator",
|
|
||||||
ObjectFactory.findClassLoader(),
|
|
||||||
true));
|
|
||||||
}
|
}
|
||||||
// return first available validator
|
// return first available validator
|
||||||
RevalidationHandler val = validators[freeValidatorIndex];
|
RevalidationHandler val = validators[freeValidatorIndex];
|
||||||
|
@ -384,11 +380,7 @@ public class CoreDOMImplementationImpl
|
||||||
}
|
}
|
||||||
else if(schemaType == XMLGrammarDescription.XML_DTD) {
|
else if(schemaType == XMLGrammarDescription.XML_DTD) {
|
||||||
if(freeDTDValidatorIndex < 0) {
|
if(freeDTDValidatorIndex < 0) {
|
||||||
return (RevalidationHandler) (ObjectFactory
|
return new com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator();
|
||||||
.newInstance(
|
|
||||||
"com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator",
|
|
||||||
ObjectFactory.findClassLoader(),
|
|
||||||
true));
|
|
||||||
}
|
}
|
||||||
// return first available validator
|
// return first available validator
|
||||||
RevalidationHandler val = dtdValidators[freeDTDValidatorIndex];
|
RevalidationHandler val = dtdValidators[freeDTDValidatorIndex];
|
||||||
|
|
|
@ -638,7 +638,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||||
// set preference for redirection
|
// set preference for redirection
|
||||||
followRedirects = httpInputSource.getFollowHTTPRedirects();
|
followRedirects = httpInputSource.getFollowHTTPRedirects();
|
||||||
if (!followRedirects) {
|
if (!followRedirects) {
|
||||||
setInstanceFollowRedirects(urlConnection, followRedirects);
|
urlConnection.setInstanceFollowRedirects(followRedirects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2192,20 +2192,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||||
|
|
||||||
} // expandSystemIdStrictOn(String,String):String
|
} // expandSystemIdStrictOn(String,String):String
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to set whether redirects will be followed for an <code>HttpURLConnection</code>.
|
|
||||||
* This may fail on earlier JDKs which do not support setting this preference.
|
|
||||||
*/
|
|
||||||
public static void setInstanceFollowRedirects(HttpURLConnection urlCon, boolean followRedirects) {
|
|
||||||
try {
|
|
||||||
Method method = HttpURLConnection.class.getMethod("setInstanceFollowRedirects", new Class[] {Boolean.TYPE});
|
|
||||||
method.invoke(urlCon, new Object[] {followRedirects ? Boolean.TRUE : Boolean.FALSE});
|
|
||||||
}
|
|
||||||
// setInstanceFollowRedirects doesn't exist.
|
|
||||||
catch (Exception exc) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for expandSystemId(String,String,boolean):String
|
* Helper method for expandSystemId(String,String,boolean):String
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -845,13 +845,7 @@ public class DOMUtil {
|
||||||
*/
|
*/
|
||||||
public static DOMException createDOMException(short code, Throwable cause) {
|
public static DOMException createDOMException(short code, Throwable cause) {
|
||||||
DOMException de = new DOMException(code, cause != null ? cause.getMessage() : null);
|
DOMException de = new DOMException(code, cause != null ? cause.getMessage() : null);
|
||||||
if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
|
if (cause != null) de.initCause(cause);
|
||||||
try {
|
|
||||||
ThrowableMethods.fgThrowableInitCauseMethod.invoke(de, new Object [] {cause});
|
|
||||||
}
|
|
||||||
// Something went wrong. There's not much we can do about it.
|
|
||||||
catch (Exception e) {}
|
|
||||||
}
|
|
||||||
return de;
|
return de;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,42 +854,8 @@ public class DOMUtil {
|
||||||
*/
|
*/
|
||||||
public static LSException createLSException(short code, Throwable cause) {
|
public static LSException createLSException(short code, Throwable cause) {
|
||||||
LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
|
LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
|
||||||
if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
|
if (cause != null) lse.initCause(cause);
|
||||||
try {
|
|
||||||
ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
|
|
||||||
}
|
|
||||||
// Something went wrong. There's not much we can do about it.
|
|
||||||
catch (Exception e) {}
|
|
||||||
}
|
|
||||||
return lse;
|
return lse;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Holder of methods from java.lang.Throwable.
|
|
||||||
*/
|
|
||||||
static class ThrowableMethods {
|
|
||||||
|
|
||||||
// Method: java.lang.Throwable.initCause(java.lang.Throwable)
|
|
||||||
private static java.lang.reflect.Method fgThrowableInitCauseMethod = null;
|
|
||||||
|
|
||||||
// Flag indicating whether or not Throwable methods available.
|
|
||||||
private static boolean fgThrowableMethodsAvailable = false;
|
|
||||||
|
|
||||||
private ThrowableMethods() {}
|
|
||||||
|
|
||||||
// Attempt to get methods for java.lang.Throwable on class initialization.
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
fgThrowableInitCauseMethod = Throwable.class.getMethod("initCause", new Class [] {Throwable.class});
|
|
||||||
fgThrowableMethodsAvailable = true;
|
|
||||||
}
|
|
||||||
// ClassNotFoundException, NoSuchMethodException or SecurityException
|
|
||||||
// Whatever the case, we cannot use java.lang.Throwable.initCause(java.lang.Throwable).
|
|
||||||
catch (Exception exc) {
|
|
||||||
fgThrowableInitCauseMethod = null;
|
|
||||||
fgThrowableMethodsAvailable = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // class DOMUtil
|
} // class DOMUtil
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class XIncludeTextReader {
|
||||||
// set preference for redirection
|
// set preference for redirection
|
||||||
boolean followRedirects = httpInputSource.getFollowHTTPRedirects();
|
boolean followRedirects = httpInputSource.getFollowHTTPRedirects();
|
||||||
if (!followRedirects) {
|
if (!followRedirects) {
|
||||||
XMLEntityManager.setInstanceFollowRedirects(urlConnection, followRedirects);
|
urlConnection.setInstanceFollowRedirects(followRedirects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -323,63 +323,5 @@ public class DTMException extends RuntimeException {
|
||||||
super.printStackTrace(s);
|
super.printStackTrace(s);
|
||||||
} catch (Throwable e) {}
|
} catch (Throwable e) {}
|
||||||
|
|
||||||
boolean isJdk14OrHigher = false;
|
|
||||||
try {
|
|
||||||
Throwable.class.getMethod("getCause", (Class[]) null);
|
|
||||||
isJdk14OrHigher = true;
|
|
||||||
} catch (NoSuchMethodException nsme) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
// The printStackTrace method of the Throwable class in jdk 1.4
|
|
||||||
// and higher will include the cause when printing the backtrace.
|
|
||||||
// The following code is only required when using jdk 1.3 or lower
|
|
||||||
if (!isJdk14OrHigher) {
|
|
||||||
Throwable exception = getException();
|
|
||||||
|
|
||||||
for (int i = 0; (i < 10) && (null != exception); i++) {
|
|
||||||
s.println("---------");
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (exception instanceof DTMException) {
|
|
||||||
String locInfo =
|
|
||||||
((DTMException) exception)
|
|
||||||
.getLocationAsString();
|
|
||||||
|
|
||||||
if (null != locInfo) {
|
|
||||||
s.println(locInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exception.printStackTrace(s);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
s.println("Could not print stack trace...");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Method meth =
|
|
||||||
((Object) exception).getClass().getMethod("getException",
|
|
||||||
(Class[]) null);
|
|
||||||
|
|
||||||
if (null != meth) {
|
|
||||||
Throwable prev = exception;
|
|
||||||
|
|
||||||
exception = (Throwable) meth.invoke(exception, (Object[]) null);
|
|
||||||
|
|
||||||
if (prev == exception) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
exception = null;
|
|
||||||
}
|
|
||||||
} catch (InvocationTargetException ite) {
|
|
||||||
exception = null;
|
|
||||||
} catch (IllegalAccessException iae) {
|
|
||||||
exception = null;
|
|
||||||
} catch (NoSuchMethodException nsme) {
|
|
||||||
exception = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,8 +348,7 @@ public class DTMManagerDefault extends DTMManager
|
||||||
if (haveXercesParser) {
|
if (haveXercesParser) {
|
||||||
// IncrementalSAXSource_Xerces to avoid threading.
|
// IncrementalSAXSource_Xerces to avoid threading.
|
||||||
try {
|
try {
|
||||||
coParser =(IncrementalSAXSource)
|
coParser = new com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Xerces();
|
||||||
Class.forName("com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Xerces").newInstance();
|
|
||||||
} catch( Exception ex ) {
|
} catch( Exception ex ) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
coParser=null;
|
coParser=null;
|
||||||
|
|
|
@ -87,6 +87,9 @@ public class IncrementalSAXSource_Xerces
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// This should be cleaned up and the use of reflection
|
||||||
|
// removed - see JDK-8129880
|
||||||
|
|
||||||
// Xerces-2 incremental parsing support (as of Beta 3)
|
// Xerces-2 incremental parsing support (as of Beta 3)
|
||||||
// ContentHandlers still get set on fIncrementalParser (to get
|
// ContentHandlers still get set on fIncrementalParser (to get
|
||||||
// conversion from XNI events to SAX events), but
|
// conversion from XNI events to SAX events), but
|
||||||
|
|
|
@ -233,7 +233,13 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document
|
||||||
}
|
}
|
||||||
parser.parse(new InputSource(is), spHandler);
|
parser.parse(new InputSource(is), spHandler);
|
||||||
} else {
|
} else {
|
||||||
Parser parser = (Parser) ReflectUtil.forName(parserClass).newInstance();
|
Class<?> c = ReflectUtil.forName(parserClass);
|
||||||
|
if (!Parser.class.isAssignableFrom(c)) {
|
||||||
|
throw new ClassCastException(parserClass
|
||||||
|
+ " cannot be cast to "
|
||||||
|
+ Parser.class.getName());
|
||||||
|
}
|
||||||
|
Parser parser = (Parser) c.newInstance();
|
||||||
parser.setDocumentHandler(this);
|
parser.setDocumentHandler(this);
|
||||||
if (bResolver != null) {
|
if (bResolver != null) {
|
||||||
parser.setEntityResolver(bResolver);
|
parser.setEntityResolver(bResolver);
|
||||||
|
|
|
@ -1220,37 +1220,13 @@ public abstract class BaseMarkupSerializer
|
||||||
if ( internal != null && internal.length() > 0 )
|
if ( internal != null && internal.length() > 0 )
|
||||||
_printer.printText( internal );
|
_printer.printText( internal );
|
||||||
endDTD();
|
endDTD();
|
||||||
}
|
} catch (Exception e) {
|
||||||
// DOM Level 1 -- does implementation have methods?
|
// ignore
|
||||||
catch (NoSuchMethodError nsme) {
|
|
||||||
Class docTypeClass = docType.getClass();
|
|
||||||
|
|
||||||
String docTypePublicId = null;
|
|
||||||
String docTypeSystemId = null;
|
|
||||||
try {
|
|
||||||
java.lang.reflect.Method getPublicId = docTypeClass.getMethod("getPublicId", (Class[]) null);
|
|
||||||
if (getPublicId.getReturnType().equals(String.class)) {
|
|
||||||
docTypePublicId = (String)getPublicId.invoke(docType, (Object[]) null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
java.lang.reflect.Method getSystemId = docTypeClass.getMethod("getSystemId", (Class[]) null);
|
|
||||||
if (getSystemId.getReturnType().equals(String.class)) {
|
|
||||||
docTypeSystemId = (String)getSystemId.invoke(docType, (Object[]) null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
_printer.enterDTD();
|
_printer.enterDTD();
|
||||||
_docTypePublicId = docTypePublicId;
|
_docTypePublicId = null;
|
||||||
_docTypeSystemId = docTypeSystemId;
|
_docTypeSystemId = null;
|
||||||
endDTD();
|
endDTD();
|
||||||
}
|
}
|
||||||
|
|
||||||
serializeDTD(docType.getName());
|
serializeDTD(docType.getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,6 @@ import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.NamedNodeMap;
|
import org.w3c.dom.NamedNodeMap;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.ProcessingInstruction;
|
import org.w3c.dom.ProcessingInstruction;
|
||||||
import org.w3c.dom.Text;
|
|
||||||
import org.w3c.dom.ls.LSException;
|
import org.w3c.dom.ls.LSException;
|
||||||
import org.w3c.dom.ls.LSOutput;
|
import org.w3c.dom.ls.LSOutput;
|
||||||
import org.w3c.dom.ls.LSSerializer;
|
import org.w3c.dom.ls.LSSerializer;
|
||||||
|
@ -1030,15 +1029,12 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||||
private String _getXmlVersion(Node node) {
|
private String _getXmlVersion(Node node) {
|
||||||
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
||||||
? (Document) node : node.getOwnerDocument();
|
? (Document) node : node.getOwnerDocument();
|
||||||
if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
|
if (doc != null) {
|
||||||
try {
|
try {
|
||||||
return (String) DocumentMethods.fgDocumentGetXmlVersionMethod.invoke(doc, (Object[]) null);
|
return doc.getXmlVersion();
|
||||||
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
||||||
catch (VirtualMachineError vme) {
|
catch (VirtualMachineError | ThreadDeath vme) {
|
||||||
throw vme;
|
throw vme;
|
||||||
} // ThreadDeath should always be re-thrown
|
|
||||||
catch (ThreadDeath td) {
|
|
||||||
throw td;
|
|
||||||
} // Ignore all other exceptions and errors
|
} // Ignore all other exceptions and errors
|
||||||
catch (Throwable t) {
|
catch (Throwable t) {
|
||||||
}
|
}
|
||||||
|
@ -1049,15 +1045,12 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||||
private String _getInputEncoding(Node node) {
|
private String _getInputEncoding(Node node) {
|
||||||
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
||||||
? (Document) node : node.getOwnerDocument();
|
? (Document) node : node.getOwnerDocument();
|
||||||
if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
|
if (doc != null) {
|
||||||
try {
|
try {
|
||||||
return (String) DocumentMethods.fgDocumentGetInputEncodingMethod.invoke(doc, (Object[]) null);
|
return doc.getInputEncoding();
|
||||||
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
||||||
catch (VirtualMachineError vme) {
|
catch (VirtualMachineError | ThreadDeath vme) {
|
||||||
throw vme;
|
throw vme;
|
||||||
} // ThreadDeath should always be re-thrown
|
|
||||||
catch (ThreadDeath td) {
|
|
||||||
throw td;
|
|
||||||
} // Ignore all other exceptions and errors
|
} // Ignore all other exceptions and errors
|
||||||
catch (Throwable t) {
|
catch (Throwable t) {
|
||||||
}
|
}
|
||||||
|
@ -1068,15 +1061,12 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||||
private String _getXmlEncoding(Node node) {
|
private String _getXmlEncoding(Node node) {
|
||||||
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
||||||
? (Document) node : node.getOwnerDocument();
|
? (Document) node : node.getOwnerDocument();
|
||||||
if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
|
if (doc != null) {
|
||||||
try {
|
try {
|
||||||
return (String) DocumentMethods.fgDocumentGetXmlEncodingMethod.invoke(doc, (Object[]) null);
|
return doc.getXmlEncoding();
|
||||||
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
||||||
catch (VirtualMachineError vme) {
|
catch (VirtualMachineError | ThreadDeath vme) {
|
||||||
throw vme;
|
throw vme;
|
||||||
} // ThreadDeath should always be re-thrown
|
|
||||||
catch (ThreadDeath td) {
|
|
||||||
throw td;
|
|
||||||
} // Ignore all other exceptions and errors
|
} // Ignore all other exceptions and errors
|
||||||
catch (Throwable t) {
|
catch (Throwable t) {
|
||||||
}
|
}
|
||||||
|
@ -1084,42 +1074,4 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Holder of DOM Level 3 methods from org.w3c.dom.Document.
|
|
||||||
*/
|
|
||||||
static class DocumentMethods {
|
|
||||||
|
|
||||||
// Method: org.w3c.dom.Document.getXmlVersion()
|
|
||||||
private static java.lang.reflect.Method fgDocumentGetXmlVersionMethod = null;
|
|
||||||
|
|
||||||
// Method: org.w3c.dom.Document.getInputEncoding()
|
|
||||||
private static java.lang.reflect.Method fgDocumentGetInputEncodingMethod = null;
|
|
||||||
|
|
||||||
// Method: org.w3c.dom.Document.getXmlEncoding()
|
|
||||||
private static java.lang.reflect.Method fgDocumentGetXmlEncodingMethod = null;
|
|
||||||
|
|
||||||
// Flag indicating whether or not Document methods are available.
|
|
||||||
private static boolean fgDocumentMethodsAvailable = false;
|
|
||||||
|
|
||||||
private DocumentMethods() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Attempt to get methods for org.w3c.dom.Document on class initialization.
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
fgDocumentGetXmlVersionMethod = Document.class.getMethod("getXmlVersion", new Class[]{});
|
|
||||||
fgDocumentGetInputEncodingMethod = Document.class.getMethod("getInputEncoding", new Class[]{});
|
|
||||||
fgDocumentGetXmlEncodingMethod = Document.class.getMethod("getXmlEncoding", new Class[]{});
|
|
||||||
fgDocumentMethodsAvailable = true;
|
|
||||||
} // ClassNotFoundException, NoSuchMethodException or SecurityException
|
|
||||||
// Whatever the case, we cannot retrieve the methods.
|
|
||||||
catch (Exception exc) {
|
|
||||||
fgDocumentGetXmlVersionMethod = null;
|
|
||||||
fgDocumentGetInputEncodingMethod = null;
|
|
||||||
fgDocumentGetXmlEncodingMethod = null;
|
|
||||||
fgDocumentMethodsAvailable = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} //DOMSerializerImpl
|
} //DOMSerializerImpl
|
||||||
|
|
|
@ -26,6 +26,8 @@ import java.io.OutputStreamWriter;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import com.sun.org.apache.xerces.internal.util.EncodingMap;
|
import com.sun.org.apache.xerces.internal.util.EncodingMap;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.CharsetEncoder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents an encoding.
|
* This class represents an encoding.
|
||||||
|
@ -37,9 +39,6 @@ import com.sun.org.apache.xerces.internal.util.EncodingMap;
|
||||||
*/
|
*/
|
||||||
public class EncodingInfo {
|
public class EncodingInfo {
|
||||||
|
|
||||||
// An array to hold the argument for a method of Charset, CharsetEncoder or CharToByteConverter.
|
|
||||||
private Object [] fArgsForMethod = null;
|
|
||||||
|
|
||||||
// name of encoding as registered with IANA;
|
// name of encoding as registered with IANA;
|
||||||
// preferably a MIME name, but aliases are fine too.
|
// preferably a MIME name, but aliases are fine too.
|
||||||
String ianaName;
|
String ianaName;
|
||||||
|
@ -47,15 +46,7 @@ public class EncodingInfo {
|
||||||
int lastPrintable;
|
int lastPrintable;
|
||||||
|
|
||||||
// The CharsetEncoder with which we test unusual characters.
|
// The CharsetEncoder with which we test unusual characters.
|
||||||
Object fCharsetEncoder = null;
|
CharsetEncoder fCharsetEncoder = null;
|
||||||
|
|
||||||
// The CharToByteConverter with which we test unusual characters.
|
|
||||||
Object fCharToByteConverter = null;
|
|
||||||
|
|
||||||
// Is the converter null because it can't be instantiated
|
|
||||||
// for some reason (perhaps we're running with insufficient authority as
|
|
||||||
// an applet?
|
|
||||||
boolean fHaveTriedCToB = false;
|
|
||||||
|
|
||||||
// Is the charset encoder usable or available.
|
// Is the charset encoder usable or available.
|
||||||
boolean fHaveTriedCharsetEncoder = false;
|
boolean fHaveTriedCharsetEncoder = false;
|
||||||
|
@ -118,16 +109,12 @@ public class EncodingInfo {
|
||||||
private boolean isPrintable0(char ch) {
|
private boolean isPrintable0(char ch) {
|
||||||
|
|
||||||
// Attempt to get a CharsetEncoder for this encoding.
|
// Attempt to get a CharsetEncoder for this encoding.
|
||||||
if (fCharsetEncoder == null && CharsetMethods.fgNIOCharsetAvailable && !fHaveTriedCharsetEncoder) {
|
if (fCharsetEncoder == null && !fHaveTriedCharsetEncoder) {
|
||||||
if (fArgsForMethod == null) {
|
|
||||||
fArgsForMethod = new Object [1];
|
|
||||||
}
|
|
||||||
// try and create the CharsetEncoder
|
// try and create the CharsetEncoder
|
||||||
try {
|
try {
|
||||||
fArgsForMethod[0] = javaName;
|
Charset charset = java.nio.charset.Charset.forName(javaName);
|
||||||
Object charset = CharsetMethods.fgCharsetForNameMethod.invoke(null, fArgsForMethod);
|
if (charset.canEncode()) {
|
||||||
if (((Boolean) CharsetMethods.fgCharsetCanEncodeMethod.invoke(charset, (Object[]) null)).booleanValue()) {
|
fCharsetEncoder = charset.newEncoder();
|
||||||
fCharsetEncoder = CharsetMethods.fgCharsetNewEncoderMethod.invoke(charset, (Object[]) null);
|
|
||||||
}
|
}
|
||||||
// This charset cannot be used for encoding, don't try it again...
|
// This charset cannot be used for encoding, don't try it again...
|
||||||
else {
|
else {
|
||||||
|
@ -142,8 +129,7 @@ public class EncodingInfo {
|
||||||
// Attempt to use the CharsetEncoder to determine whether the character is printable.
|
// Attempt to use the CharsetEncoder to determine whether the character is printable.
|
||||||
if (fCharsetEncoder != null) {
|
if (fCharsetEncoder != null) {
|
||||||
try {
|
try {
|
||||||
fArgsForMethod[0] = new Character(ch);
|
return fCharsetEncoder.canEncode(ch);
|
||||||
return ((Boolean) CharsetMethods.fgCharsetEncoderCanEncodeMethod.invoke(fCharsetEncoder, fArgsForMethod)).booleanValue();
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
// obviously can't use this charset encoder; possibly a JDK bug
|
// obviously can't use this charset encoder; possibly a JDK bug
|
||||||
|
@ -152,39 +138,7 @@ public class EncodingInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// As a last resort try to use a sun.io.CharToByteConverter to
|
return false;
|
||||||
// determine whether this character is printable. We will always
|
|
||||||
// reach here on JDK 1.3 or below.
|
|
||||||
if (fCharToByteConverter == null) {
|
|
||||||
if (fHaveTriedCToB || !CharToByteConverterMethods.fgConvertersAvailable) {
|
|
||||||
// forget it; nothing we can do...
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (fArgsForMethod == null) {
|
|
||||||
fArgsForMethod = new Object [1];
|
|
||||||
}
|
|
||||||
// try and create the CharToByteConverter
|
|
||||||
try {
|
|
||||||
fArgsForMethod[0] = javaName;
|
|
||||||
fCharToByteConverter = CharToByteConverterMethods.fgGetConverterMethod.invoke(null, fArgsForMethod);
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
// don't try it again...
|
|
||||||
fHaveTriedCToB = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
fArgsForMethod[0] = new Character(ch);
|
|
||||||
return ((Boolean) CharToByteConverterMethods.fgCanConvertMethod.invoke(fCharToByteConverter, fArgsForMethod)).booleanValue();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
// obviously can't use this converter; probably some kind of
|
|
||||||
// security restriction
|
|
||||||
fCharToByteConverter = null;
|
|
||||||
fHaveTriedCToB = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// is this an encoding name recognized by this JDK?
|
// is this an encoding name recognized by this JDK?
|
||||||
|
@ -194,82 +148,4 @@ public class EncodingInfo {
|
||||||
String s = new String(bTest, name);
|
String s = new String(bTest, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Holder of methods from java.nio.charset.Charset and java.nio.charset.CharsetEncoder.
|
|
||||||
*/
|
|
||||||
static class CharsetMethods {
|
|
||||||
|
|
||||||
// Method: java.nio.charset.Charset.forName(java.lang.String)
|
|
||||||
private static java.lang.reflect.Method fgCharsetForNameMethod = null;
|
|
||||||
|
|
||||||
// Method: java.nio.charset.Charset.canEncode()
|
|
||||||
private static java.lang.reflect.Method fgCharsetCanEncodeMethod = null;
|
|
||||||
|
|
||||||
// Method: java.nio.charset.Charset.newEncoder()
|
|
||||||
private static java.lang.reflect.Method fgCharsetNewEncoderMethod = null;
|
|
||||||
|
|
||||||
// Method: java.nio.charset.CharsetEncoder.canEncode(char)
|
|
||||||
private static java.lang.reflect.Method fgCharsetEncoderCanEncodeMethod = null;
|
|
||||||
|
|
||||||
// Flag indicating whether or not java.nio.charset.* is available.
|
|
||||||
private static boolean fgNIOCharsetAvailable = false;
|
|
||||||
|
|
||||||
private CharsetMethods() {}
|
|
||||||
|
|
||||||
// Attempt to get methods for Charset and CharsetEncoder on class initialization.
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
Class charsetClass = Class.forName("java.nio.charset.Charset");
|
|
||||||
Class charsetEncoderClass = Class.forName("java.nio.charset.CharsetEncoder");
|
|
||||||
fgCharsetForNameMethod = charsetClass.getMethod("forName", new Class [] {String.class});
|
|
||||||
fgCharsetCanEncodeMethod = charsetClass.getMethod("canEncode", new Class [] {});
|
|
||||||
fgCharsetNewEncoderMethod = charsetClass.getMethod("newEncoder", new Class [] {});
|
|
||||||
fgCharsetEncoderCanEncodeMethod = charsetEncoderClass.getMethod("canEncode", new Class [] {Character.TYPE});
|
|
||||||
fgNIOCharsetAvailable = true;
|
|
||||||
}
|
|
||||||
// ClassNotFoundException, NoSuchMethodException or SecurityException
|
|
||||||
// Whatever the case, we cannot use java.nio.charset.*.
|
|
||||||
catch (Exception exc) {
|
|
||||||
fgCharsetForNameMethod = null;
|
|
||||||
fgCharsetCanEncodeMethod = null;
|
|
||||||
fgCharsetEncoderCanEncodeMethod = null;
|
|
||||||
fgCharsetNewEncoderMethod = null;
|
|
||||||
fgNIOCharsetAvailable = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Holder of methods from sun.io.CharToByteConverter.
|
|
||||||
*/
|
|
||||||
static class CharToByteConverterMethods {
|
|
||||||
|
|
||||||
// Method: sun.io.CharToByteConverter.getConverter(java.lang.String)
|
|
||||||
private static java.lang.reflect.Method fgGetConverterMethod = null;
|
|
||||||
|
|
||||||
// Method: sun.io.CharToByteConverter.canConvert(char)
|
|
||||||
private static java.lang.reflect.Method fgCanConvertMethod = null;
|
|
||||||
|
|
||||||
// Flag indicating whether or not sun.io.CharToByteConverter is available.
|
|
||||||
private static boolean fgConvertersAvailable = false;
|
|
||||||
|
|
||||||
private CharToByteConverterMethods() {}
|
|
||||||
|
|
||||||
// Attempt to get methods for char to byte converter on class initialization.
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
Class clazz = Class.forName("sun.io.CharToByteConverter");
|
|
||||||
fgGetConverterMethod = clazz.getMethod("getConverter", new Class [] {String.class});
|
|
||||||
fgCanConvertMethod = clazz.getMethod("canConvert", new Class [] {Character.TYPE});
|
|
||||||
fgConvertersAvailable = true;
|
|
||||||
}
|
|
||||||
// ClassNotFoundException, NoSuchMethodException or SecurityException
|
|
||||||
// Whatever the case, we cannot use sun.io.CharToByteConverter.
|
|
||||||
catch (Exception exc) {
|
|
||||||
fgGetConverterMethod = null;
|
|
||||||
fgCanConvertMethod = null;
|
|
||||||
fgConvertersAvailable = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,6 +378,12 @@ public class FunctionTable
|
||||||
int funcIndex;
|
int funcIndex;
|
||||||
Object funcIndexObj = getFunctionID(name);
|
Object funcIndexObj = getFunctionID(name);
|
||||||
|
|
||||||
|
if (func != null && !Function.class.isAssignableFrom(func)) {
|
||||||
|
throw new ClassCastException(func.getName()
|
||||||
|
+ " cannot be cast to "
|
||||||
|
+ Function.class.getName());
|
||||||
|
}
|
||||||
|
|
||||||
if (null != funcIndexObj)
|
if (null != funcIndexObj)
|
||||||
{
|
{
|
||||||
funcIndex = ((Integer) funcIndexObj).intValue();
|
funcIndex = ((Integer) funcIndexObj).intValue();
|
||||||
|
|
|
@ -64,7 +64,6 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||||
private Node currentNode = null;
|
private Node currentNode = null;
|
||||||
private Node node = null;
|
private Node node = null;
|
||||||
private NamespaceSupport namespaceContext = null;
|
private NamespaceSupport namespaceContext = null;
|
||||||
private Method mXmlVersion = null;
|
|
||||||
private boolean [] needContextPop = null;
|
private boolean [] needContextPop = null;
|
||||||
private StringBuffer stringBuffer = null;
|
private StringBuffer stringBuffer = null;
|
||||||
private int resizeValue = 20;
|
private int resizeValue = 20;
|
||||||
|
@ -83,25 +82,11 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||||
ownerDoc = node.getOwnerDocument();
|
ownerDoc = node.getOwnerDocument();
|
||||||
currentNode = node;
|
currentNode = node;
|
||||||
}
|
}
|
||||||
getDLThreeMethods();
|
|
||||||
stringBuffer = new StringBuffer();
|
stringBuffer = new StringBuffer();
|
||||||
needContextPop = new boolean[resizeValue];
|
needContextPop = new boolean[resizeValue];
|
||||||
namespaceContext = new NamespaceSupport();
|
namespaceContext = new NamespaceSupport();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getDLThreeMethods(){
|
|
||||||
try{
|
|
||||||
mXmlVersion = ownerDoc.getClass().getMethod("setXmlVersion",new Class[] {String.class});
|
|
||||||
}catch(NoSuchMethodException mex){
|
|
||||||
//log these errors at fine level.
|
|
||||||
mXmlVersion = null;
|
|
||||||
}catch(SecurityException se){
|
|
||||||
//log these errors at fine level.
|
|
||||||
mXmlVersion = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method has no effect when called.
|
* This method has no effect when called.
|
||||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||||
|
@ -557,15 +542,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void writeStartDocument() throws XMLStreamException {
|
public void writeStartDocument() throws XMLStreamException {
|
||||||
try{
|
ownerDoc.setXmlVersion("1.0");
|
||||||
if(mXmlVersion != null){
|
|
||||||
mXmlVersion.invoke(ownerDoc, new Object[] {"1.0"});
|
|
||||||
}
|
|
||||||
}catch(IllegalAccessException iae){
|
|
||||||
throw new XMLStreamException(iae);
|
|
||||||
}catch(InvocationTargetException ite){
|
|
||||||
throw new XMLStreamException(ite);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -575,15 +552,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void writeStartDocument(String version) throws XMLStreamException {
|
public void writeStartDocument(String version) throws XMLStreamException {
|
||||||
try{
|
ownerDoc.setXmlVersion(version);
|
||||||
if(mXmlVersion != null){
|
|
||||||
mXmlVersion.invoke(ownerDoc, new Object[] {version});
|
|
||||||
}
|
|
||||||
}catch(IllegalAccessException iae){
|
|
||||||
throw new XMLStreamException(iae);
|
|
||||||
}catch(InvocationTargetException ite){
|
|
||||||
throw new XMLStreamException(ite);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -594,15 +563,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
|
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
|
||||||
try{
|
ownerDoc.setXmlVersion(version);
|
||||||
if(mXmlVersion != null){
|
|
||||||
mXmlVersion.invoke(ownerDoc, new Object[] {version});
|
|
||||||
}
|
|
||||||
}catch(IllegalAccessException iae){
|
|
||||||
throw new XMLStreamException(iae);
|
|
||||||
}catch(InvocationTargetException ite){
|
|
||||||
throw new XMLStreamException(ite);
|
|
||||||
}
|
|
||||||
//TODO: What to do with encoding.-Venu
|
//TODO: What to do with encoding.-Venu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,12 @@ public class TransformerException extends Exception {
|
||||||
*/
|
*/
|
||||||
public synchronized Throwable initCause(Throwable cause) {
|
public synchronized Throwable initCause(Throwable cause) {
|
||||||
|
|
||||||
|
// TransformerException doesn't set its cause (probably
|
||||||
|
// because it predates initCause()) - and we may not want
|
||||||
|
// to change this since Exceptions are serializable...
|
||||||
|
// But this also leads to the broken code in printStackTrace
|
||||||
|
// below...
|
||||||
|
|
||||||
if (this.containedException != null) {
|
if (this.containedException != null) {
|
||||||
throw new IllegalStateException("Can't overwrite cause");
|
throw new IllegalStateException("Can't overwrite cause");
|
||||||
}
|
}
|
||||||
|
@ -312,61 +318,57 @@ public class TransformerException extends Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String locInfo = getLocationAsString();
|
|
||||||
|
|
||||||
if (null != locInfo) {
|
|
||||||
s.println(locInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.printStackTrace(s);
|
|
||||||
} catch (Throwable e) {}
|
|
||||||
|
|
||||||
Throwable exception = getException();
|
|
||||||
|
|
||||||
for (int i = 0; (i < 10) && (null != exception); i++) {
|
|
||||||
s.println("---------");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (exception instanceof TransformerException) {
|
String locInfo = getLocationAsString();
|
||||||
String locInfo =
|
|
||||||
((TransformerException) exception)
|
|
||||||
.getLocationAsString();
|
|
||||||
|
|
||||||
if (null != locInfo) {
|
if (null != locInfo) {
|
||||||
s.println(locInfo);
|
s.println(locInfo);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exception.printStackTrace(s);
|
super.printStackTrace(s);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {}
|
||||||
s.println("Could not print stack trace...");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
Throwable exception = getException();
|
||||||
Method meth =
|
|
||||||
((Object) exception).getClass().getMethod("getException",
|
|
||||||
(Class[]) null);
|
|
||||||
|
|
||||||
if (null != meth) {
|
for (int i = 0; (i < 10) && (null != exception); i++) {
|
||||||
Throwable prev = exception;
|
s.println("---------");
|
||||||
|
|
||||||
exception = (Throwable) meth.invoke(exception, (Object[]) null);
|
try {
|
||||||
|
exception.printStackTrace(s);
|
||||||
|
// if exception is a TransformerException it will print
|
||||||
|
// its contained exception, so we don't need to redo it here,
|
||||||
|
// and we can exit the loop now.
|
||||||
|
if (exception instanceof TransformerException) break;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
s.println("Could not print stack trace...");
|
||||||
|
}
|
||||||
|
|
||||||
if (prev == exception) {
|
try {
|
||||||
break;
|
// Is this still needed?
|
||||||
|
Method meth = exception.getClass().getMethod("getException");
|
||||||
|
|
||||||
|
if (null != meth) {
|
||||||
|
Throwable prev = exception;
|
||||||
|
|
||||||
|
exception = (Throwable) meth.invoke(exception, (Object[]) null);
|
||||||
|
|
||||||
|
if (prev == exception) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
exception = null;
|
||||||
}
|
}
|
||||||
} else {
|
} catch (InvocationTargetException ite) {
|
||||||
|
exception = null;
|
||||||
|
} catch (IllegalAccessException iae) {
|
||||||
|
exception = null;
|
||||||
|
} catch (NoSuchMethodException nsme) {
|
||||||
exception = null;
|
exception = null;
|
||||||
}
|
}
|
||||||
} catch (InvocationTargetException ite) {
|
|
||||||
exception = null;
|
|
||||||
} catch (IllegalAccessException iae) {
|
|
||||||
exception = null;
|
|
||||||
} catch (NoSuchMethodException nsme) {
|
|
||||||
exception = null;
|
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
// ensure output is written
|
||||||
|
s.flush();
|
||||||
}
|
}
|
||||||
// insure output is written
|
|
||||||
s.flush();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ package javax.xml.validation;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.net.URL;
|
|
||||||
import java.security.AccessControlContext;
|
import java.security.AccessControlContext;
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
|
|
|
@ -41,13 +41,10 @@ class SecuritySupport {
|
||||||
|
|
||||||
ClassLoader getContextClassLoader() {
|
ClassLoader getContextClassLoader() {
|
||||||
return
|
return
|
||||||
AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public ClassLoader run() {
|
public ClassLoader run() {
|
||||||
ClassLoader cl = null;
|
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||||
//try {
|
|
||||||
cl = Thread.currentThread().getContextClassLoader();
|
|
||||||
//} catch (SecurityException ex) { }
|
|
||||||
if (cl == null)
|
if (cl == null)
|
||||||
cl = ClassLoader.getSystemClassLoader();
|
cl = ClassLoader.getSystemClassLoader();
|
||||||
return cl;
|
return cl;
|
||||||
|
@ -56,7 +53,7 @@ class SecuritySupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getSystemProperty(final String propName) {
|
String getSystemProperty(final String propName) {
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public String run() {
|
public String run() {
|
||||||
return System.getProperty(propName);
|
return System.getProperty(propName);
|
||||||
|
@ -69,7 +66,7 @@ class SecuritySupport {
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<FileInputStream>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public FileInputStream run() throws FileNotFoundException {
|
public FileInputStream run() throws FileNotFoundException {
|
||||||
return new FileInputStream(file);
|
return new FileInputStream(file);
|
||||||
|
@ -82,7 +79,7 @@ class SecuritySupport {
|
||||||
|
|
||||||
// Used for debugging purposes
|
// Used for debugging purposes
|
||||||
String getClassSource(Class<?> cls) {
|
String getClassSource(Class<?> cls) {
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public String run() {
|
public String run() {
|
||||||
CodeSource cs = cls.getProtectionDomain().getCodeSource();
|
CodeSource cs = cls.getProtectionDomain().getCodeSource();
|
||||||
|
@ -97,7 +94,7 @@ class SecuritySupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean doesFileExist(final File f) {
|
boolean doesFileExist(final File f) {
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean run() {
|
public Boolean run() {
|
||||||
return f.exists();
|
return f.exists();
|
||||||
|
|
|
@ -40,7 +40,7 @@ class SecuritySupport {
|
||||||
|
|
||||||
|
|
||||||
ClassLoader getContextClassLoader() {
|
ClassLoader getContextClassLoader() {
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public ClassLoader run() {
|
public ClassLoader run() {
|
||||||
ClassLoader cl = null;
|
ClassLoader cl = null;
|
||||||
|
@ -53,7 +53,7 @@ class SecuritySupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getSystemProperty(final String propName) {
|
String getSystemProperty(final String propName) {
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public String run() {
|
public String run() {
|
||||||
return System.getProperty(propName);
|
return System.getProperty(propName);
|
||||||
|
@ -66,7 +66,7 @@ class SecuritySupport {
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<FileInputStream>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public FileInputStream run() throws FileNotFoundException {
|
public FileInputStream run() throws FileNotFoundException {
|
||||||
return new FileInputStream(file);
|
return new FileInputStream(file);
|
||||||
|
@ -79,7 +79,7 @@ class SecuritySupport {
|
||||||
|
|
||||||
// Used for debugging purposes
|
// Used for debugging purposes
|
||||||
String getClassSource(Class<?> cls) {
|
String getClassSource(Class<?> cls) {
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public String run() {
|
public String run() {
|
||||||
CodeSource cs = cls.getProtectionDomain().getCodeSource();
|
CodeSource cs = cls.getProtectionDomain().getCodeSource();
|
||||||
|
@ -94,7 +94,7 @@ class SecuritySupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean doesFileExist(final File f) {
|
boolean doesFileExist(final File f) {
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean run() {
|
public Boolean run() {
|
||||||
return f.exists();
|
return f.exists();
|
||||||
|
|
|
@ -28,7 +28,6 @@ package javax.xml.xpath;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.net.URL;
|
|
||||||
import java.security.AccessControlContext;
|
import java.security.AccessControlContext;
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
|
|
|
@ -333,59 +333,36 @@ public final class DOMImplementationRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple JRE (Java Runtime Environment) 1.1 test
|
* This method returns the ContextClassLoader.
|
||||||
*
|
|
||||||
* @return <code>true</code> if JRE 1.1
|
|
||||||
*/
|
|
||||||
private static boolean isJRE11() {
|
|
||||||
try {
|
|
||||||
Class c = Class.forName("java.security.AccessController");
|
|
||||||
// java.security.AccessController existed since 1.2 so, if no
|
|
||||||
// exception was thrown, the DOM application is running in a JRE
|
|
||||||
// 1.2 or higher
|
|
||||||
return false;
|
|
||||||
} catch (Exception ex) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method returns the ContextClassLoader or <code>null</code> if
|
|
||||||
* running in a JRE 1.1
|
|
||||||
*
|
*
|
||||||
* @return The Context Classloader
|
* @return The Context Classloader
|
||||||
*/
|
*/
|
||||||
private static ClassLoader getContextClassLoader() {
|
private static ClassLoader getContextClassLoader() {
|
||||||
return isJRE11()
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
? null
|
@Override
|
||||||
: (ClassLoader)
|
public ClassLoader run() {
|
||||||
AccessController.doPrivileged(new PrivilegedAction() {
|
ClassLoader classLoader = null;
|
||||||
public Object run() {
|
try {
|
||||||
ClassLoader classLoader = null;
|
classLoader =
|
||||||
try {
|
Thread.currentThread().getContextClassLoader();
|
||||||
classLoader =
|
} catch (SecurityException ex) {
|
||||||
Thread.currentThread().getContextClassLoader();
|
|
||||||
} catch (SecurityException ex) {
|
|
||||||
}
|
|
||||||
return classLoader;
|
|
||||||
}
|
}
|
||||||
});
|
return classLoader;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the system property indicated by the specified name
|
* This method returns the system property indicated by the specified name
|
||||||
* after checking access control privileges. For a JRE 1.1, this check is
|
* after checking access control privileges.
|
||||||
* not done.
|
|
||||||
*
|
*
|
||||||
* @param name the name of the system property
|
* @param name the name of the system property
|
||||||
* @return the system property
|
* @return the system property
|
||||||
*/
|
*/
|
||||||
private static String getSystemProperty(final String name) {
|
private static String getSystemProperty(final String name) {
|
||||||
return isJRE11()
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
? (String) System.getProperty(name)
|
@Override
|
||||||
: (String) AccessController.doPrivileged(new PrivilegedAction() {
|
public String run() {
|
||||||
public Object run() {
|
|
||||||
return System.getProperty(name);
|
return System.getProperty(name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -394,7 +371,7 @@ public final class DOMImplementationRegistry {
|
||||||
/**
|
/**
|
||||||
* This method returns an Inputstream for the reading resource
|
* This method returns an Inputstream for the reading resource
|
||||||
* META_INF/services/org.w3c.dom.DOMImplementationSourceList after checking
|
* META_INF/services/org.w3c.dom.DOMImplementationSourceList after checking
|
||||||
* access control privileges. For a JRE 1.1, this check is not done.
|
* access control privileges.
|
||||||
*
|
*
|
||||||
* @param classLoader classLoader
|
* @param classLoader classLoader
|
||||||
* @param name the resource
|
* @param name the resource
|
||||||
|
@ -402,28 +379,18 @@ public final class DOMImplementationRegistry {
|
||||||
*/
|
*/
|
||||||
private static InputStream getResourceAsStream(final ClassLoader classLoader,
|
private static InputStream getResourceAsStream(final ClassLoader classLoader,
|
||||||
final String name) {
|
final String name) {
|
||||||
if (isJRE11()) {
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
InputStream ris;
|
@Override
|
||||||
if (classLoader == null) {
|
public InputStream run() {
|
||||||
ris = ClassLoader.getSystemResourceAsStream(name);
|
InputStream ris;
|
||||||
} else {
|
if (classLoader == null) {
|
||||||
ris = classLoader.getResourceAsStream(name);
|
ris =
|
||||||
}
|
ClassLoader.getSystemResourceAsStream(name);
|
||||||
return ris;
|
} else {
|
||||||
} else {
|
ris = classLoader.getResourceAsStream(name);
|
||||||
return (InputStream)
|
}
|
||||||
AccessController.doPrivileged(new PrivilegedAction() {
|
return ris;
|
||||||
public Object run() {
|
}
|
||||||
InputStream ris;
|
});
|
||||||
if (classLoader == null) {
|
|
||||||
ris =
|
|
||||||
ClassLoader.getSystemResourceAsStream(name);
|
|
||||||
} else {
|
|
||||||
ris = classLoader.getResourceAsStream(name);
|
|
||||||
}
|
|
||||||
return ris;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue