8187593: Cleanup: removing SecuritySupport files

Reviewed-by: lancea
This commit is contained in:
Joe Wang 2017-10-04 10:54:18 -07:00
parent da077b2e26
commit 9abc252e51
88 changed files with 537 additions and 1910 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +26,7 @@
package com.sun.org.apache.xalan.internal;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import jdk.xml.internal.SecuritySupport;
/**
* Commonly used constants.

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,10 +21,9 @@
package com.sun.org.apache.xalan.internal.res;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.util.ListResourceBundle;
import com.sun.org.apache.xpath.internal.res.XPATHMessages;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* Sets things up for issuing error messages. This class is misnamed, and should
@ -37,7 +36,7 @@ public class XSLMessages extends XPATHMessages {
/**
* The language specific resource object for Xalan messages.
*/
private static ListResourceBundle XSLTBundle = null;
private static ResourceBundle XSLTBundle = null;
/**
* The class name of the Xalan error message string table.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
package com.sun.org.apache.xalan.internal.utils;
import com.sun.org.apache.xalan.internal.XalanConstants;
import jdk.xml.internal.SecuritySupport;
/**
* This is the base class for features and properties

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,6 +22,7 @@
package com.sun.org.apache.xalan.internal.utils;
import java.util.function.Supplier;
import jdk.xml.internal.SecuritySupport;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.

View File

@ -1,326 +0,0 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sun.org.apache.xalan.internal.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Properties;
/**
* This class is duplicated for each subpackage so keep it in sync. It is
* package private and therefore is not exposed as part of any API.
*
* @xerces.internal
*/
public final class SecuritySupport {
private static final SecuritySupport securitySupport = new SecuritySupport();
/**
* Return an instance of this class.
*/
public static SecuritySupport getInstance() {
return securitySupport;
}
public static ClassLoader getContextClassLoader() {
return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (SecurityException ex) {
}
return cl;
}
});
}
static ClassLoader getSystemClassLoader() {
return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
try {
cl = ClassLoader.getSystemClassLoader();
} catch (SecurityException ex) {
}
return cl;
}
});
}
static ClassLoader getParentClassLoader(final ClassLoader cl) {
return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader parent = null;
try {
parent = cl.getParent();
} catch (SecurityException ex) {
}
// eliminate loops in case of the boot
// ClassLoader returning itself as a parent
return (parent == cl) ? null : parent;
}
});
}
public static String getSystemProperty(final String propName) {
return (String) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(propName);
}
});
}
public static String getSystemProperty(final String propName, final String def) {
return (String) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(propName, def);
}
});
}
static FileInputStream getFileInputStream(final File file)
throws FileNotFoundException {
try {
return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
public static InputStream getResourceAsStream(final String name) {
return (InputStream) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return SecuritySupport.class.getResourceAsStream("/"+name);
}
});
}
/**
* Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
* @param bundle the base name of the resource bundle, a fully qualified class name
* @return a resource bundle for the given base name and the default locale
*/
public static ListResourceBundle getResourceBundle(String bundle) {
return getResourceBundle(bundle, Locale.getDefault());
}
/**
* Gets a resource bundle using the specified base name and locale, and the caller's class loader.
* @param bundle the base name of the resource bundle, a fully qualified class name
* @param locale the locale for which a resource bundle is desired
* @return a resource bundle for the given base name and locale
*/
public static ListResourceBundle getResourceBundle(final String bundle, final Locale locale) {
return AccessController.doPrivileged(new PrivilegedAction<ListResourceBundle>() {
public ListResourceBundle run() {
try {
return (ListResourceBundle)ResourceBundle.getBundle(bundle, locale);
} catch (MissingResourceException e) {
try {
return (ListResourceBundle)ResourceBundle.getBundle(bundle, new Locale("en", "US"));
} catch (MissingResourceException e2) {
throw new MissingResourceException(
"Could not load any resource bundle by " + bundle, bundle, "");
}
}
}
});
}
public static boolean getFileExists(final File f) {
return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return f.exists() ? Boolean.TRUE : Boolean.FALSE;
}
})).booleanValue();
}
static long getLastModified(final File f) {
return ((Long) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return f.lastModified();
}
})).longValue();
}
/**
* Strip off path from an URI
*
* @param uri an URI with full path
* @return the file name only
*/
public static String sanitizePath(String uri) {
if (uri == null) {
return "";
}
int i = uri.lastIndexOf("/");
if (i > 0) {
return uri.substring(i+1, uri.length());
}
return "";
}
/**
* Check the protocol used in the systemId against allowed protocols
*
* @param systemId the Id of the URI
* @param allowedProtocols a list of allowed protocols separated by comma
* @param accessAny keyword to indicate allowing any protocol
* @return the name of the protocol if rejected, null otherwise
*/
public static String checkAccess(String systemId, String allowedProtocols, String accessAny) throws IOException {
if (systemId == null || (allowedProtocols != null &&
allowedProtocols.equalsIgnoreCase(accessAny))) {
return null;
}
String protocol;
if (systemId.indexOf(":")==-1) {
protocol = "file";
} else {
URL url = new URL(systemId);
protocol = url.getProtocol();
if (protocol.equalsIgnoreCase("jar")) {
String path = url.getPath();
protocol = path.substring(0, path.indexOf(":"));
} else if (protocol.equalsIgnoreCase("jrt")) {
// if the systemId is "jrt" then allow access if "file" allowed
protocol = "file";
}
}
if (isProtocolAllowed(protocol, allowedProtocols)) {
//access allowed
return null;
} else {
return protocol;
}
}
/**
* Check if the protocol is in the allowed list of protocols. The check
* is case-insensitive while ignoring whitespaces.
*
* @param protocol a protocol
* @param allowedProtocols a list of allowed protocols
* @return true if the protocol is in the list
*/
private static boolean isProtocolAllowed(String protocol, String allowedProtocols) {
if (allowedProtocols == null) {
return false;
}
String temp[] = allowedProtocols.split(",");
for (String t : temp) {
t = t.trim();
if (t.equalsIgnoreCase(protocol)) {
return true;
}
}
return false;
}
/**
* Read JAXP system property in this order: system property,
* $java.home/conf/jaxp.properties if the system property is not specified
*
* @param propertyId the Id of the property
* @return the value of the property
*/
public static String getJAXPSystemProperty(String sysPropertyId) {
String accessExternal = getSystemProperty(sysPropertyId);
if (accessExternal == null) {
accessExternal = readJAXPProperty(sysPropertyId);
}
return accessExternal;
}
/**
* Read from $java.home/conf/jaxp.properties for the specified property
* The program
*
* @param propertyId the Id of the property
* @return the value of the property
*/
static String readJAXPProperty(String propertyId) {
String value = null;
InputStream is = null;
try {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
if (getFileExists(f)) {
is = getFileInputStream(f);
cacheProps.load(is);
}
firstTime = false;
}
}
}
value = cacheProps.getProperty(propertyId);
}
catch (Exception ex) {}
finally {
if (is != null) {
try {
is.close();
} catch (IOException ex) {}
}
}
return value;
}
/**
* Cache for properties in java.home/conf/jaxp.properties
*/
static final Properties cacheProps = new Properties();
/**
* Flag indicating if the program has tried reading java.home/conf/jaxp.properties
*/
static volatile boolean firstTime = true;
private SecuritySupport () {}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,7 @@ package com.sun.org.apache.xalan.internal.utils;
import com.sun.org.apache.xalan.internal.XalanConstants;
import java.util.concurrent.CopyOnWriteArrayList;
import jdk.xml.internal.SecuritySupport;
import org.xml.sax.SAXException;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -24,7 +25,6 @@
package com.sun.org.apache.xalan.internal.xsltc.compiler;
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
@ -33,6 +33,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
import com.sun.org.apache.xml.internal.utils.SystemIDResolver;
import java.util.Iterator;
import javax.xml.XMLConstants;
import jdk.xml.internal.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -24,7 +25,6 @@
package com.sun.org.apache.xalan.internal.xsltc.compiler;
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
@ -33,6 +33,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
import com.sun.org.apache.xml.internal.utils.SystemIDResolver;
import java.util.Iterator;
import javax.xml.XMLConstants;
import jdk.xml.internal.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -24,7 +25,6 @@ import com.sun.java_cup.internal.runtime.Symbol;
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType;
@ -49,6 +49,7 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import jdk.xml.internal.JdkXmlFeatures;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -22,12 +23,10 @@ package com.sun.org.apache.xalan.internal.xsltc.compiler;
import com.sun.org.apache.bcel.internal.classfile.JavaClass;
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
import com.sun.org.apache.xml.internal.dtm.DTM;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
@ -51,6 +50,7 @@ import javax.xml.XMLConstants;
import javax.xml.catalog.CatalogFeatures;
import jdk.xml.internal.JdkXmlFeatures;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
@ -730,7 +730,7 @@ public final class XSLTC {
*/
public boolean setDestDirectory(String dstDirName) {
final File dir = new File(dstDirName);
if (SecuritySupport.getFileExists(dir) || dir.mkdirs()) {
if (SecuritySupport.doesFileExist(dir) || dir.mkdirs()) {
_destDir = dir;
return true;
}
@ -902,7 +902,7 @@ public final class XSLTC {
String parentDir = outFile.getParent();
if (parentDir != null) {
File parentFile = new File(parentDir);
if (!SecuritySupport.getFileExists(parentFile))
if (!SecuritySupport.doesFileExist(parentFile))
parentFile.mkdirs();
}
}

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -20,13 +21,12 @@
package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet;
import com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet;
import com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode;
import jdk.xml.internal.SecuritySupport;
/**
* @author Jacek Ambroziak

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,12 +21,11 @@
package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
import java.util.StringTokenizer;
import com.sun.org.apache.bcel.internal.generic.Type;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
import com.sun.org.apache.xml.internal.utils.XML11Char;
import java.util.StringTokenizer;
import jdk.xml.internal.SecuritySupport;
/**
* @author Jacek Ambroziak

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -22,10 +22,6 @@
package com.sun.org.apache.xalan.internal.xsltc.dom;
import com.sun.org.apache.xalan.internal.XalanConstants;
import java.io.FileNotFoundException;
import javax.xml.transform.stream.StreamSource;
import com.sun.org.apache.xalan.internal.xsltc.DOM;
import com.sun.org.apache.xalan.internal.xsltc.DOMCache;
import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM;
@ -33,16 +29,14 @@ import com.sun.org.apache.xalan.internal.xsltc.TransletException;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
import com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xml.internal.dtm.DTM;
import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
import com.sun.org.apache.xml.internal.dtm.DTMManager;
import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase;
import com.sun.org.apache.xml.internal.dtm.ref.EmptyIterator;
import com.sun.org.apache.xml.internal.utils.SystemIDResolver;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import java.io.FileNotFoundException;
import javax.xml.transform.stream.StreamSource;
import jdk.xml.internal.SecuritySupport;
/**
* @author Morten Jorgensen

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -20,17 +21,16 @@
package com.sun.org.apache.xalan.internal.xsltc.dom;
import java.text.CollationKey;
import java.text.Collator;
import java.util.Locale;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.xsltc.CollatorFactory;
import com.sun.org.apache.xalan.internal.xsltc.DOM;
import com.sun.org.apache.xalan.internal.xsltc.TransletException;
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
import com.sun.org.apache.xml.internal.utils.StringComparable;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.text.CollationKey;
import java.text.Collator;
import java.util.Locale;
import jdk.xml.internal.SecuritySupport;
/**
* Base class for sort records containing application specific sort keys

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -23,7 +24,23 @@
package com.sun.org.apache.xalan.internal.xsltc.runtime;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.DOM;
import com.sun.org.apache.xalan.internal.xsltc.Translet;
import com.sun.org.apache.xalan.internal.xsltc.dom.AbsoluteIterator;
import com.sun.org.apache.xalan.internal.xsltc.dom.ArrayNodeListIterator;
import com.sun.org.apache.xalan.internal.xsltc.dom.DOMAdapter;
import com.sun.org.apache.xalan.internal.xsltc.dom.MultiDOM;
import com.sun.org.apache.xalan.internal.xsltc.dom.SingletonIterator;
import com.sun.org.apache.xalan.internal.xsltc.dom.StepIterator;
import com.sun.org.apache.xml.internal.dtm.Axis;
import com.sun.org.apache.xml.internal.dtm.DTM;
import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
import com.sun.org.apache.xml.internal.dtm.DTMManager;
import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase;
import com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy;
import com.sun.org.apache.xml.internal.serializer.NamespaceMappings;
import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
import com.sun.org.apache.xml.internal.utils.XML11Char;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.FieldPosition;
@ -33,31 +50,13 @@ import java.util.Locale;
import java.util.ResourceBundle;
import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.transform.dom.DOMSource;
import com.sun.org.apache.xalan.internal.xsltc.DOM;
import com.sun.org.apache.xalan.internal.xsltc.Translet;
import com.sun.org.apache.xalan.internal.xsltc.dom.AbsoluteIterator;
import com.sun.org.apache.xml.internal.dtm.Axis;
import com.sun.org.apache.xalan.internal.xsltc.dom.DOMAdapter;
import com.sun.org.apache.xalan.internal.xsltc.dom.MultiDOM;
import com.sun.org.apache.xalan.internal.xsltc.dom.SingletonIterator;
import com.sun.org.apache.xalan.internal.xsltc.dom.StepIterator;
import com.sun.org.apache.xalan.internal.xsltc.dom.ArrayNodeListIterator;
import com.sun.org.apache.xml.internal.dtm.DTM;
import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
import com.sun.org.apache.xml.internal.dtm.DTMManager;
import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase;
import com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy;
import org.w3c.dom.DOMException;
import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import com.sun.org.apache.xml.internal.serializer.NamespaceMappings;
import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
import com.sun.org.apache.xml.internal.utils.XML11Char;
/**
* Standard XSLT functions. All standard functions expect the current node

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,10 +21,10 @@
package com.sun.org.apache.xalan.internal.xsltc.runtime.output;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
import jdk.xml.internal.SecuritySupport;
/**
* @author Santiago Pericas-Geertsen

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -25,7 +26,6 @@ package com.sun.org.apache.xalan.internal.xsltc.trax;
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.DOM;
import com.sun.org.apache.xalan.internal.xsltc.Translet;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
@ -41,8 +41,8 @@ import java.lang.RuntimePermission;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReference;
import java.lang.module.ModuleReader;
import java.lang.module.ModuleReference;
import java.lang.reflect.InvocationTargetException;
import java.security.AccessController;
import java.security.CodeSigner;
@ -61,6 +61,7 @@ import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.URIResolver;
import jdk.xml.internal.SecuritySupport;
/**

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -24,10 +25,9 @@ import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader;
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
@ -52,8 +52,8 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import javax.xml.XMLConstants;
import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogFeatures;
import javax.xml.catalog.CatalogFeatures.Feature;
import javax.xml.catalog.CatalogFeatures;
import javax.xml.catalog.CatalogManager;
import javax.xml.catalog.CatalogResolver;
import javax.xml.parsers.SAXParser;
@ -78,6 +78,7 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import jdk.xml.internal.JdkXmlFeatures;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLFilter;
import org.xml.sax.XMLReader;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -24,7 +25,6 @@ import com.sun.org.apache.xerces.internal.util.URI;
import com.sun.org.apache.xerces.internal.util.XML11Char;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import java.io.IOException;
import java.io.ObjectInputStream;
@ -34,6 +34,7 @@ import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -54,7 +55,6 @@ import java.util.Locale;
import javax.xml.XMLConstants;
import javax.xml.catalog.CatalogFeatures;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMErrorHandler;
import org.w3c.dom.DOMException;

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,10 +21,10 @@
package com.sun.org.apache.xerces.internal.dom;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* Used to format DOM error messages, using the system locale.

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -20,9 +21,9 @@
package com.sun.org.apache.xerces.internal.impl;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Enumeration;
import java.util.NoSuchElementException;
import jdk.xml.internal.SecuritySupport;
/**
* Commonly used constants.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,7 +35,6 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLResolver;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
/**
* This class manages different properties related to Stax specification and its implementation.

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
@ -27,6 +28,10 @@ import com.sun.org.apache.xerces.internal.util.XMLAttributesIteratorImpl;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
@ -38,11 +43,6 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.xml.internal.stream.XMLBufferListener;
import com.sun.xml.internal.stream.XMLEntityStorage;
import com.sun.xml.internal.stream.dtd.DTDGrammarUtil;
@ -53,6 +53,7 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.events.XMLEvent;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
/**
*

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
@ -27,7 +28,6 @@ import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl;
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
@ -43,6 +43,7 @@ import java.io.EOFException;
import java.io.IOException;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.events.XMLEvent;
import jdk.xml.internal.SecuritySupport;
/**

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -27,7 +28,6 @@ import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
import com.sun.org.apache.xerces.internal.util.*;
import com.sun.org.apache.xerces.internal.util.URI;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
@ -52,13 +52,14 @@ import java.util.Stack;
import java.util.StringTokenizer;
import javax.xml.XMLConstants;
import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogFeatures;
import javax.xml.catalog.CatalogFeatures.Feature;
import javax.xml.catalog.CatalogFeatures;
import javax.xml.catalog.CatalogManager;
import javax.xml.catalog.CatalogResolver;
import javax.xml.stream.XMLInputFactory;
import javax.xml.transform.Source;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
import org.xml.sax.InputSource;

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,10 +21,10 @@
package com.sun.org.apache.xerces.internal.impl.dv;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import java.util.MissingResourceException;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* Base class for datatype exceptions. For DTD types, the exception can be

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -22,10 +22,10 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -20,11 +21,11 @@
package com.sun.org.apache.xerces.internal.impl.xpath.regex;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ArrayList;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.ArrayList;
import jdk.xml.internal.SecuritySupport;
/**
* A Regular Expression Parser.

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -41,7 +42,6 @@ import com.sun.org.apache.xerces.internal.util.Status;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.QName;
@ -77,6 +77,7 @@ import java.util.StringTokenizer;
import java.util.WeakHashMap;
import javax.xml.XMLConstants;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMError;
import org.w3c.dom.DOMErrorHandler;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -87,7 +88,6 @@ import java.util.Stack;
import java.util.Vector;
import javax.xml.XMLConstants;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
/**
* The XML Schema validator. The validator implements a document

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -22,10 +22,10 @@
package com.sun.org.apache.xerces.internal.impl.xs;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -20,9 +21,6 @@
package com.sun.org.apache.xerces.internal.impl.xs.opti;
import java.io.IOException;
import java.util.Locale;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl;
import com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl;
@ -50,6 +48,8 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner;
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
import java.io.IOException;
import java.util.Locale;
import javax.xml.XMLConstants;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -61,7 +62,6 @@ import com.sun.org.apache.xerces.internal.util.SymbolHash;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.QName;
@ -107,6 +107,7 @@ import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

View File

@ -26,7 +26,6 @@
package com.sun.org.apache.xerces.internal.jaxp.datatype;
import com.sun.org.apache.xerces.internal.util.DatatypeMessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
@ -42,6 +41,7 @@ import javax.xml.datatype.DatatypeConstants;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import jdk.xml.internal.SecuritySupport;
/**
* <p>Representation for W3C XML Schema 1.0 date/time datatypes.

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,10 +21,10 @@
package com.sun.org.apache.xerces.internal.jaxp.validation;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* <p>Used to format JAXP Validation API error messages using a specified locale.</p>

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -68,7 +69,6 @@ import java.util.Locale;
import javax.xml.XMLConstants;
import javax.xml.catalog.CatalogFeatures;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
/**
* This class is the configuration used to parse XML 1.0 and XML 1.1 documents.

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,10 +21,10 @@
package com.sun.org.apache.xerces.internal.util;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* <p>Used to format JAXP 1.3 Datatype API error messages using a specified locale.</p>

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,10 +21,10 @@
package com.sun.org.apache.xerces.internal.util;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* Used to format SAX error messages using a specified locale.

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,6 +22,7 @@
package com.sun.org.apache.xerces.internal.utils;
import java.util.function.Supplier;
import jdk.xml.internal.SecuritySupport;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.

View File

@ -1,295 +0,0 @@
/*
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.org.apache.xerces.internal.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.Properties;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
/**
* This class is duplicated for each subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of any API.
*
* @xerces.internal
*/
public final class SecuritySupport {
private static final SecuritySupport securitySupport = new SecuritySupport();
/**
* Return an instance of this class.
* @return an instance of this class
*/
public static SecuritySupport getInstance() {
return securitySupport;
}
static ClassLoader getContextClassLoader() {
return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (SecurityException ex) { }
return cl;
});
}
static ClassLoader getSystemClassLoader() {
return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
ClassLoader cl = null;
try {
cl = ClassLoader.getSystemClassLoader();
} catch (SecurityException ex) {}
return cl;
});
}
static ClassLoader getParentClassLoader(final ClassLoader cl) {
return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
ClassLoader parent = null;
try {
parent = cl.getParent();
} catch (SecurityException ex) {}
// eliminate loops in case of the boot
// ClassLoader returning itself as a parent
return (parent == cl) ? null : parent;
});
}
public static String getSystemProperty(final String propName) {
return AccessController.doPrivileged((PrivilegedAction<String>) () ->
System.getProperty(propName));
}
static FileInputStream getFileInputStream(final File file)
throws FileNotFoundException
{
try {
return AccessController.doPrivileged(
(PrivilegedExceptionAction<FileInputStream>)() ->
new FileInputStream(file));
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
/**
* Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
* @param bundle the base name of the resource bundle, a fully qualified class name
* @return a resource bundle for the given base name and the default locale
*/
public static ResourceBundle getResourceBundle(String bundle) {
return getResourceBundle(bundle, Locale.getDefault());
}
/**
* Gets a resource bundle using the specified base name and locale, and the caller's class loader.
* @param bundle the base name of the resource bundle, a fully qualified class name
* @param locale the locale for which a resource bundle is desired
* @return a resource bundle for the given base name and locale
*/
public static ResourceBundle getResourceBundle(final String bundle, final Locale locale) {
return AccessController.doPrivileged((PrivilegedAction<ResourceBundle>) () -> {
try {
return PropertyResourceBundle.getBundle(bundle, locale);
} catch (MissingResourceException e) {
try {
return PropertyResourceBundle.getBundle(bundle, new Locale("en", "US"));
} catch (MissingResourceException e2) {
throw new MissingResourceException(
"Could not load any resource bundle by " + bundle, bundle, "");
}
}
});
}
static boolean getFileExists(final File f) {
return (AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
f.exists()));
}
static long getLastModified(final File f) {
return (AccessController.doPrivileged((PrivilegedAction<Long>) () ->
f.lastModified()));
}
/**
* Strip off path from an URI
*
* @param uri an URI with full path
* @return the file name only
*/
public static String sanitizePath(String uri) {
if (uri == null) {
return "";
}
int i = uri.lastIndexOf("/");
if (i > 0) {
return uri.substring(i+1, uri.length());
}
return uri;
}
/**
* Check the protocol used in the systemId against allowed protocols
*
* @param systemId the Id of the URI
* @param allowedProtocols a list of allowed protocols separated by comma
* @param accessAny keyword to indicate allowing any protocol
* @return the name of the protocol if rejected, null otherwise
* @throws java.io.IOException
*/
public static String checkAccess(String systemId, String allowedProtocols, String accessAny) throws IOException {
if (systemId == null || (allowedProtocols != null &&
allowedProtocols.equalsIgnoreCase(accessAny))) {
return null;
}
String protocol;
if (!systemId.contains(":")) {
protocol = "file";
} else {
URL url = new URL(systemId);
protocol = url.getProtocol();
if (protocol.equalsIgnoreCase("jar")) {
String path = url.getPath();
protocol = path.substring(0, path.indexOf(":"));
} else if (protocol.equalsIgnoreCase("jrt")) {
// if the systemId is "jrt" then allow access if "file" allowed
protocol = "file";
}
}
if (isProtocolAllowed(protocol, allowedProtocols)) {
//access allowed
return null;
} else {
return protocol;
}
}
/**
* Check if the protocol is in the allowed list of protocols. The check
* is case-insensitive while ignoring whitespaces.
*
* @param protocol a protocol
* @param allowedProtocols a list of allowed protocols
* @return true if the protocol is in the list
*/
private static boolean isProtocolAllowed(String protocol, String allowedProtocols) {
if (allowedProtocols == null) {
return false;
}
String temp[] = allowedProtocols.split(",");
for (String t : temp) {
t = t.trim();
if (t.equalsIgnoreCase(protocol)) {
return true;
}
}
return false;
}
/**
* Read JAXP system property in this order: system property,
* $java.home/conf/jaxp.properties if the system property is not specified
*
* @param sysPropertyId the Id of the property
* @return the value of the property
*/
public static String getJAXPSystemProperty(String sysPropertyId) {
String value = getSystemProperty(sysPropertyId);
if (value == null) {
value = readJAXPProperty(sysPropertyId);
}
return value;
}
/**
* Read from $java.home/conf/jaxp.properties for the specified property
* The program
*
* @param propertyId the Id of the property
* @return the value of the property
*/
static String readJAXPProperty(String propertyId) {
String value = null;
InputStream is = null;
try {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
if (getFileExists(f)) {
is = getFileInputStream(f);
cacheProps.load(is);
}
firstTime = false;
}
}
}
value = cacheProps.getProperty(propertyId);
}
catch (IOException ex) {}
finally {
if (is != null) {
try {
is.close();
} catch (IOException ex) {}
}
}
return value;
}
/**
* Cache for properties in java.home/conf/jaxp.properties
*/
static final Properties cacheProps = new Properties();
/**
* Flag indicating if the program has tried reading java.home/conf/jaxp.properties
*/
static volatile boolean firstTime = true;
private SecuritySupport () {}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@ package com.sun.org.apache.xerces.internal.utils;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.util.SecurityManager;
import java.util.concurrent.CopyOnWriteArrayList;
import jdk.xml.internal.SecuritySupport;
import org.xml.sax.SAXException;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,7 @@ package com.sun.org.apache.xerces.internal.utils;
import com.sun.org.apache.xerces.internal.impl.Constants;
import javax.xml.XMLConstants;
import jdk.xml.internal.SecuritySupport;
/**
* This class manages security related properties

View File

@ -1,134 +0,0 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sun.org.apache.xerces.internal.xinclude;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
/**
* This class is duplicated for each subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of any API.
*
* @xerces.internal
*/
final class SecuritySupport {
private static final SecuritySupport securitySupport = new SecuritySupport();
/**
* Return an instance of this class.
*/
static SecuritySupport getInstance() {
return securitySupport;
}
ClassLoader getContextClassLoader() {
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (SecurityException ex) { }
return cl;
}
});
}
ClassLoader getSystemClassLoader() {
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
try {
cl = ClassLoader.getSystemClassLoader();
} catch (SecurityException ex) {}
return cl;
}
});
}
ClassLoader getParentClassLoader(final ClassLoader cl) {
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader parent = null;
try {
parent = cl.getParent();
} catch (SecurityException ex) {}
// eliminate loops in case of the boot
// ClassLoader returning itself as a parent
return (parent == cl) ? null : parent;
}
});
}
String getSystemProperty(final String propName) {
return (String)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(propName);
}
});
}
FileInputStream getFileInputStream(final File file)
throws FileNotFoundException
{
try {
return (FileInputStream)
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
boolean getFileExists(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return f.exists();
}
})).booleanValue();
}
long getLastModified(final File f) {
return ((Long)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return f.lastModified();
}
})).longValue();
}
private SecuritySupport () {}
}

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -22,10 +22,10 @@
package com.sun.org.apache.xerces.internal.xinclude;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
// TODO: fix error messages in XIncludeMessages.properties
/**

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,12 +21,12 @@
package com.sun.org.apache.xerces.internal.xpointer;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* XPointerMessageFormatter provides error messages for the XPointer Framework

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,9 +21,9 @@
package com.sun.org.apache.xml.internal.res;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* A utility class for issuing XML error messages.
@ -36,7 +36,7 @@ public class XMLMessages
protected Locale fLocale = Locale.getDefault();
/** The language specific resource object for XML messages. */
private static ListResourceBundle XMLBundle = null;
private static ResourceBundle XMLBundle = null;
/** The class name of the XML error message string table. */
private static final String XML_ERROR_RESOURCES =
@ -103,7 +103,7 @@ public class XMLMessages
*
* @return The formatted message string.
*/
public static final String createMsg(ListResourceBundle fResourceBundle,
public static final String createMsg(ResourceBundle fResourceBundle,
String msgKey, Object args[]) //throws Exception
{

View File

@ -1,134 +0,0 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sun.org.apache.xml.internal.serialize;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
/**
* This class is duplicated for each subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of any API.
*
* @xerces.internal
*/
final class SecuritySupport {
private static final SecuritySupport securitySupport = new SecuritySupport();
/**
* Return an instance of this class.
*/
static SecuritySupport getInstance() {
return securitySupport;
}
ClassLoader getContextClassLoader() {
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (SecurityException ex) { }
return cl;
}
});
}
ClassLoader getSystemClassLoader() {
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
try {
cl = ClassLoader.getSystemClassLoader();
} catch (SecurityException ex) {}
return cl;
}
});
}
ClassLoader getParentClassLoader(final ClassLoader cl) {
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader parent = null;
try {
parent = cl.getParent();
} catch (SecurityException ex) {}
// eliminate loops in case of the boot
// ClassLoader returning itself as a parent
return (parent == cl) ? null : parent;
}
});
}
String getSystemProperty(final String propName) {
return (String)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(propName);
}
});
}
FileInputStream getFileInputStream(final File file)
throws FileNotFoundException
{
try {
return (FileInputStream)
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
boolean getFileExists(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return f.exists();
}
})).booleanValue();
}
long getLastModified(final File f) {
return ((Long)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return f.lastModified();
}
})).longValue();
}
private SecuritySupport () {}
}

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -22,7 +23,6 @@
package com.sun.org.apache.xml.internal.serialize;
import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
@ -30,6 +30,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import jdk.xml.internal.SecuritySupport;
/**
*

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,7 +21,6 @@
package com.sun.org.apache.xml.internal.serializer;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
import com.sun.org.apache.xml.internal.serializer.utils.SystemIDResolver;
import com.sun.org.apache.xml.internal.serializer.utils.Utils;
@ -37,6 +36,7 @@ import java.util.Locale;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import javax.xml.transform.TransformerException;
import jdk.xml.internal.SecuritySupport;
/**
* This class provides services that tell if a character should have

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,27 +21,26 @@
package com.sun.org.apache.xml.internal.serializer;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.io.BufferedWriter;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Properties;
import java.util.StringTokenizer;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Collections;
import java.util.Map;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map.Entry;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
import jdk.xml.internal.SecuritySupport;
/**
* Provides information about encodings. Depends on the Java runtime

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -20,7 +21,9 @@
package com.sun.org.apache.xml.internal.serializer;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
import com.sun.org.apache.xml.internal.serializer.utils.Utils;
import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
@ -28,12 +31,8 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Enumeration;
import java.util.Properties;
import javax.xml.transform.OutputKeys;
import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
import com.sun.org.apache.xml.internal.serializer.utils.Utils;
import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
import jdk.xml.internal.SecuritySupport;
/**
* This class is a factory to generate a set of default properties

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -20,6 +21,9 @@
package com.sun.org.apache.xml.internal.serializer;
import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
import com.sun.org.apache.xml.internal.serializer.utils.Utils;
import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@ -34,22 +38,16 @@ import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import javax.xml.transform.ErrorListener;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.Node;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
import com.sun.org.apache.xml.internal.serializer.utils.Utils;
import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
/**
* This abstract class is a base class for other stream
* serializers (xml, html, text ...) that write output to a stream.

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,11 +21,9 @@
package com.sun.org.apache.xml.internal.serializer.utils;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import jdk.xml.internal.SecuritySupport;
/**
* A utility class for issuing error messages.
@ -99,7 +97,7 @@ public final class Messages
private final Locale m_locale = Locale.getDefault();
/** The language specific resource object for messages. */
private ListResourceBundle m_resourceBundle;
private ResourceBundle m_resourceBundle;
/** The class name of the error message string table with no language suffix. */
private String m_resourceBundleName;
@ -173,10 +171,8 @@ public final class Messages
* @return The formatted message string.
* @xsl.usage internal
*/
private final String createMsg(
ListResourceBundle fResourceBundle,
String msgKey,
Object args[]) //throws Exception
private final String createMsg(ResourceBundle fResourceBundle, String msgKey,
Object args[]) //throws Exception
{
String fmsg = null;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -22,7 +23,6 @@ package com.sun.org.apache.xml.internal.utils;
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import java.util.HashMap;
import javax.xml.XMLConstants;
@ -32,6 +32,7 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import jdk.xml.internal.JdkXmlFeatures;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;

View File

@ -1,6 +1,6 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,15 +21,14 @@
package com.sun.org.apache.xpath.internal.functions;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.util.Properties;
import com.sun.org.apache.xpath.internal.XPathContext;
import com.sun.org.apache.xpath.internal.objects.XObject;
import com.sun.org.apache.xpath.internal.objects.XString;
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.util.Properties;
import jdk.xml.internal.SecuritySupport;
/**
* Execute the SystemProperty() function.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,11 +32,11 @@ import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.util.URI;
import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
import java.util.HashMap;
import java.util.Map;
import jdk.xml.internal.SecuritySupport;
/**
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,8 +31,7 @@ import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import jdk.xml.internal.SecuritySupport;
/**
* Implements common xml writer functions.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,12 @@
package com.sun.xml.internal.stream.writers;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.PropertyManager;
import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.xml.internal.stream.util.ReadOnlyIterator;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@ -35,26 +41,17 @@ import java.nio.charset.CharsetEncoder;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import java.util.Vector;
import java.util.Set;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
import java.util.Vector;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.transform.stream.StreamResult;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.PropertyManager;
import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.xml.internal.stream.util.ReadOnlyIterator;
import jdk.xml.internal.SecuritySupport;
/**
* This class implements a StAX XMLStreamWriter. It extends

View File

@ -33,6 +33,7 @@ import java.util.Properties;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
import jdk.xml.internal.SecuritySupport;
/**
* <p>Implements pluggable Datatypes.</p>
@ -61,18 +62,12 @@ class FactoryFinder {
*/
private static volatile boolean firstTime = true;
/**
* Security support class use to check access control before
* getting certain system resources.
*/
private final static SecuritySupport ss = new SecuritySupport();
// Define system property "jaxp.debug" to get output
static {
// Use try/catch block to support applets, which throws
// SecurityException out of this code.
try {
String val = ss.getSystemProperty("jaxp.debug");
String val = SecuritySupport.getSystemProperty("jaxp.debug");
// Allow simply setting the prop to turn on debug
debug = val != null && !"false".equals(val);
}
@ -106,7 +101,7 @@ class FactoryFinder {
if (useBSClsLoader) {
return Class.forName(className, false, FactoryFinder.class.getClassLoader());
} else {
cl = ss.getContextClassLoader();
cl = SecuritySupport.getContextClassLoader();
if (cl == null) {
throw new ClassNotFoundException();
}
@ -227,7 +222,7 @@ class FactoryFinder {
// Use the system property first
try {
String systemProp = ss.getSystemProperty(factoryId);
String systemProp = SecuritySupport.getSystemProperty(factoryId);
if (systemProp != null) {
dPrint(()->"found system property, value=" + systemProp);
return newInstance(type, systemProp, null, true);
@ -242,13 +237,13 @@ class FactoryFinder {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
String configFile = SecuritySupport.getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
if (SecuritySupport.doesFileExist(f)) {
dPrint(()->"Read properties file "+f);
cacheProps.load(ss.getFileInputStream(f));
cacheProps.load(SecuritySupport.getFileInputStream(f));
}
}
}

View File

@ -1,87 +0,0 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.datatype;
import java.security.*;
import java.io.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of the JAXP
* API.
*
* Security related methods that only work on J2SE 1.2 and newer.
*/
class SecuritySupport {
ClassLoader getContextClassLoader() {
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (SecurityException ex) { }
return cl;
}
});
}
String getSystemProperty(final String propName) {
return (String)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(propName);
}
});
}
FileInputStream getFileInputStream(final File file)
throws FileNotFoundException
{
try {
return (FileInputStream)
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
boolean doesFileExist(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return f.exists();
}
})).booleanValue();
}
}

View File

@ -33,6 +33,7 @@ import java.util.Properties;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
import jdk.xml.internal.SecuritySupport;
/**
* <p>Implements pluggable Parsers.</p>
@ -61,18 +62,12 @@ class FactoryFinder {
*/
static volatile boolean firstTime = true;
/**
* Security support class use to check access control before
* getting certain system resources.
*/
private static final SecuritySupport ss = new SecuritySupport();
// Define system property "jaxp.debug" to get output
static {
// Use try/catch block to support applets, which throws
// SecurityException out of this code.
try {
String val = ss.getSystemProperty("jaxp.debug");
String val = SecuritySupport.getSystemProperty("jaxp.debug");
// Allow simply setting the prop to turn on debug
debug = val != null && !"false".equals(val);
}
@ -106,7 +101,7 @@ class FactoryFinder {
if (useBSClsLoader) {
return Class.forName(className, false, FactoryFinder.class.getClassLoader());
} else {
cl = ss.getContextClassLoader();
cl = SecuritySupport.getContextClassLoader();
if (cl == null) {
throw new ClassNotFoundException();
}
@ -226,7 +221,7 @@ class FactoryFinder {
// Use the system property first
try {
String systemProp = ss.getSystemProperty(factoryId);
String systemProp = SecuritySupport.getSystemProperty(factoryId);
if (systemProp != null) {
dPrint(()->"found system property, value=" + systemProp);
return newInstance(type, systemProp, null, true);
@ -241,13 +236,13 @@ class FactoryFinder {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
String configFile = SecuritySupport.getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
if (SecuritySupport.doesFileExist(f)) {
dPrint(()->"Read properties file "+f);
cacheProps.load(ss.getFileInputStream(f));
cacheProps.load(SecuritySupport.getFileInputStream(f));
}
}
}

View File

@ -1,91 +0,0 @@
/*
* Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.parsers;
import java.security.*;
import java.io.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of the JAXP
* API.
*
* Security related methods that only work on J2SE 1.2 and newer.
*/
class SecuritySupport {
ClassLoader getContextClassLoader() throws SecurityException{
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
//try {
cl = Thread.currentThread().getContextClassLoader();
//} catch (SecurityException ex) { }
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
return cl;
}
});
}
String getSystemProperty(final String propName) {
return (String)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(propName);
}
});
}
FileInputStream getFileInputStream(final File file)
throws FileNotFoundException
{
try {
return (FileInputStream)
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
boolean doesFileExist(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return f.exists();
}
})).booleanValue();
}
}

View File

@ -33,6 +33,7 @@ import java.util.Properties;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
import jdk.xml.internal.SecuritySupport;
/**
* <p>Implements pluggable streams.</p>
@ -62,18 +63,12 @@ class FactoryFinder {
*/
private static volatile boolean firstTime = true;
/**
* Security support class use to check access control before
* getting certain system resources.
*/
final private static SecuritySupport ss = new SecuritySupport();
// Define system property "jaxp.debug" to get output
static {
// Use try/catch block to support applets, which throws
// SecurityException out of this code.
try {
String val = ss.getSystemProperty("jaxp.debug");
String val = SecuritySupport.getSystemProperty("jaxp.debug");
// Allow simply setting the prop to turn on debug
debug = val != null && !"false".equals(val);
}
@ -107,7 +102,7 @@ class FactoryFinder {
if (useBSClsLoader) {
return Class.forName(className, false, FactoryFinder.class.getClassLoader());
} else {
cl = ss.getContextClassLoader();
cl = SecuritySupport.getContextClassLoader();
if (cl == null) {
throw new ClassNotFoundException();
}
@ -256,7 +251,7 @@ class FactoryFinder {
final String systemProp;
if (type.getName().equals(factoryId)) {
systemProp = ss.getSystemProperty(factoryId);
systemProp = SecuritySupport.getSystemProperty(factoryId);
} else {
systemProp = System.getProperty(factoryId);
}
@ -277,21 +272,21 @@ class FactoryFinder {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
configFile = ss.getSystemProperty("java.home") + File.separator +
configFile = SecuritySupport.getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "stax.properties";
final File fStax = new File(configFile);
firstTime = false;
if (ss.doesFileExist(fStax)) {
if (SecuritySupport.doesFileExist(fStax)) {
dPrint(()->"Read properties file "+fStax);
cacheProps.load(ss.getFileInputStream(fStax));
cacheProps.load(SecuritySupport.getFileInputStream(fStax));
}
else {
configFile = ss.getSystemProperty("java.home") + File.separator +
configFile = SecuritySupport.getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "jaxp.properties";
final File fJaxp = new File(configFile);
if (ss.doesFileExist(fJaxp)) {
if (SecuritySupport.doesFileExist(fJaxp)) {
dPrint(()->"Read properties file "+fJaxp);
cacheProps.load(ss.getFileInputStream(fJaxp));
cacheProps.load(SecuritySupport.getFileInputStream(fJaxp));
}
}
}

View File

@ -1,72 +0,0 @@
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.stream;
import java.security.*;
import java.io.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of the JAXP
* API.
*
* Security related methods that only work on J2SE 1.2 and newer.
*/
class SecuritySupport {
ClassLoader getContextClassLoader() throws SecurityException{
return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
return cl;
});
}
String getSystemProperty(final String propName) {
return AccessController.doPrivileged((PrivilegedAction<String>) () ->
System.getProperty(propName));
}
FileInputStream getFileInputStream(final File file)
throws FileNotFoundException
{
try {
return AccessController.doPrivileged((PrivilegedExceptionAction<FileInputStream>) ()
-> new FileInputStream(file));
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
boolean doesFileExist(final File f) {
return AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> f.exists());
}
}

View File

@ -35,6 +35,7 @@ import java.util.Properties;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
import jdk.xml.internal.SecuritySupport;
/**
* <p>Implements pluggable Datatypes.</p>
@ -64,18 +65,12 @@ class FactoryFinder {
*/
static volatile boolean firstTime = true;
/**
* Security support class use to check access control before
* getting certain system resources.
*/
private final static SecuritySupport ss = new SecuritySupport();
// Define system property "jaxp.debug" to get output
static {
// Use try/catch block to support applets, which throws
// SecurityException out of this code.
try {
String val = ss.getSystemProperty("jaxp.debug");
String val = SecuritySupport.getSystemProperty("jaxp.debug");
// Allow simply setting the prop to turn on debug
debug = val != null && !"false".equals(val);
}
@ -109,7 +104,7 @@ class FactoryFinder {
if (useBSClsLoader) {
return Class.forName(className, false, FactoryFinder.class.getClassLoader());
} else {
cl = ss.getContextClassLoader();
cl = SecuritySupport.getContextClassLoader();
if (cl == null) {
throw new ClassNotFoundException();
}
@ -258,7 +253,7 @@ class FactoryFinder {
dPrint(()->"find factoryId =" + factoryId);
// Use the system property first
try {
String systemProp = ss.getSystemProperty(factoryId);
String systemProp = SecuritySupport.getSystemProperty(factoryId);
if (systemProp != null) {
dPrint(()->"found system property, value=" + systemProp);
return newInstance(type, systemProp, null, true, true);
@ -273,13 +268,13 @@ class FactoryFinder {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
String configFile = SecuritySupport.getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
if (SecuritySupport.doesFileExist(f)) {
dPrint(()->"Read properties file "+f);
cacheProps.load(ss.getFileInputStream(f));
cacheProps.load(SecuritySupport.getFileInputStream(f));
}
}
}

View File

@ -1,89 +0,0 @@
/*
* Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.transform;
import java.security.*;
import java.io.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of the JAXP
* API.
*
* Security related methods that only work on J2SE 1.2 and newer.
*/
class SecuritySupport {
ClassLoader getContextClassLoader() throws SecurityException{
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
//try {
cl = Thread.currentThread().getContextClassLoader();
//} catch (SecurityException ex) { }
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
return cl;
}
});
}
String getSystemProperty(final String propName) {
return (String)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(propName);
}
});
}
FileInputStream getFileInputStream(final File file)
throws FileNotFoundException
{
try {
return (FileInputStream)
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
boolean doesFileExist(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return f.exists();
}
})).booleanValue();
}
}

View File

@ -30,6 +30,7 @@ import java.io.File;
import java.net.URL;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.ls.LSResourceResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@ -111,8 +112,6 @@ import org.xml.sax.SAXParseException;
*/
public abstract class SchemaFactory {
private static SecuritySupport ss = new SecuritySupport();
/**
* Constructor for derived classes.
*
@ -235,7 +234,7 @@ public abstract class SchemaFactory {
*/
public static SchemaFactory newInstance(String schemaLanguage) {
ClassLoader cl;
cl = ss.getContextClassLoader();
cl = SecuritySupport.getContextClassLoader();
if (cl == null) {
//cl = ClassLoader.getSystemClassLoader();
@ -299,7 +298,7 @@ public abstract class SchemaFactory {
ClassLoader cl = classLoader;
if (cl == null) {
cl = ss.getContextClassLoader();
cl = SecuritySupport.getContextClassLoader();
}
SchemaFactory f = new SchemaFactoryFinder(cl).createInstance(factoryClassName);

View File

@ -36,6 +36,7 @@ import java.util.Properties;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
import jdk.xml.internal.SecuritySupport;
/**
* Implementation of {@link SchemaFactory#newInstance(String)}.
@ -47,10 +48,7 @@ class SchemaFactoryFinder {
/** debug support code. */
private static boolean debug = false;
/**
*<p> Take care of restrictions imposed by java security model </p>
*/
private static final SecuritySupport ss = new SecuritySupport();
private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
/**
* <p>Cache properties for performance.</p>
@ -65,7 +63,7 @@ class SchemaFactoryFinder {
static {
// Use try/catch block to support applets
try {
debug = ss.getSystemProperty("jaxp.debug") != null;
debug = SecuritySupport.getSystemProperty("jaxp.debug") != null;
} catch (Exception unused) {
debug = false;
}
@ -107,7 +105,7 @@ class SchemaFactoryFinder {
private void debugDisplayClassLoader() {
try {
if( classLoader == ss.getContextClassLoader() ) {
if( classLoader == SecuritySupport.getContextClassLoader() ) {
debugPrintln(()->"using thread context class loader ("+classLoader+") for search");
return;
}
@ -166,7 +164,7 @@ class SchemaFactoryFinder {
// system property look up
try {
debugPrintln(()->"Looking up system property '"+propertyName+"'" );
String r = ss.getSystemProperty(propertyName);
String r = SecuritySupport.getSystemProperty(propertyName);
if(r!=null) {
debugPrintln(()->"The value is '"+r+"'");
sf = createInstance(r, true);
@ -180,7 +178,7 @@ class SchemaFactoryFinder {
}
}
String javah = ss.getSystemProperty( "java.home" );
String javah = SecuritySupport.getSystemProperty( "java.home" );
String configFile = javah + File.separator +
"conf" + File.separator + "jaxp.properties";
@ -192,9 +190,9 @@ class SchemaFactoryFinder {
if(firstTime){
File f=new File( configFile );
firstTime = false;
if(ss.doesFileExist(f)){
if(SecuritySupport.doesFileExist(f)){
debugPrintln(()->"Read properties file " + f);
cacheProps.load(ss.getFileInputStream(f));
cacheProps.load(SecuritySupport.getFileInputStream(f));
}
}
}
@ -411,6 +409,6 @@ class SchemaFactoryFinder {
// Used for debugging purposes
private static String which( Class<?> clazz ) {
return ss.getClassSource(clazz);
return SecuritySupport.getClassSource(clazz);
}
}

View File

@ -1,105 +0,0 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.validation;
import java.net.URL;
import java.security.*;
import java.io.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of the JAXP
* API.
*
* Security related methods that only work on J2SE 1.2 and newer.
*/
class SecuritySupport {
ClassLoader getContextClassLoader() {
return
AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public ClassLoader run() {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
return cl;
}
});
}
String getSystemProperty(final String propName) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public String run() {
return System.getProperty(propName);
}
});
}
FileInputStream getFileInputStream(final File file)
throws FileNotFoundException
{
try {
return AccessController.doPrivileged(
new PrivilegedExceptionAction<>() {
@Override
public FileInputStream run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
// Used for debugging purposes
String getClassSource(Class<?> cls) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public String run() {
CodeSource cs = cls.getProtectionDomain().getCodeSource();
if (cs != null) {
URL loc = cs.getLocation();
return loc != null ? loc.toString() : "(no location)";
} else {
return "(no code source)";
}
}
});
}
boolean doesFileExist(final File f) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public Boolean run() {
return f.exists();
}
});
}
}

View File

@ -1,105 +0,0 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.xpath;
import java.net.URL;
import java.security.*;
import java.io.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of the JAXP
* API.
*
* Security related methods that only work on J2SE 1.2 and newer.
*/
class SecuritySupport {
ClassLoader getContextClassLoader() {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public ClassLoader run() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (SecurityException ex) { }
return cl;
}
});
}
String getSystemProperty(final String propName) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public String run() {
return System.getProperty(propName);
}
});
}
FileInputStream getFileInputStream(final File file)
throws FileNotFoundException
{
try {
return AccessController.doPrivileged(
new PrivilegedExceptionAction<>() {
@Override
public FileInputStream run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
// Used for debugging purposes
String getClassSource(Class<?> cls) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public String run() {
CodeSource cs = cls.getProtectionDomain().getCodeSource();
if (cs != null) {
URL loc = cs.getLocation();
return loc != null ? loc.toString() : "(no location)";
} else {
return "(no code source)";
}
}
});
}
boolean doesFileExist(final File f) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public Boolean run() {
return f.exists();
}
});
}
}

View File

@ -26,6 +26,7 @@
package javax.xml.xpath;
import com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl;
import jdk.xml.internal.SecuritySupport;
/**
* <p>An {@code XPathFactory} instance can be used to create
@ -62,11 +63,6 @@ public abstract class XPathFactory {
*/
public static final String DEFAULT_OBJECT_MODEL_URI = "http://java.sun.com/jaxp/xpath/dom";
/**
*<p> Take care of restrictions imposed by java security model </p>
*/
private static SecuritySupport ss = new SecuritySupport() ;
/**
* <p>Protected constructor as {@link #newInstance()} or {@link #newInstance(String uri)}
* or {@link #newInstance(String uri, String factoryClassName, ClassLoader classLoader)}
@ -217,7 +213,7 @@ public abstract class XPathFactory {
"XPathFactory#newInstance(String uri) cannot be called with uri == \"\"");
}
ClassLoader classLoader = ss.getContextClassLoader();
ClassLoader classLoader = SecuritySupport.getContextClassLoader();
if (classLoader == null) {
//use the current class loader
@ -296,7 +292,7 @@ public abstract class XPathFactory {
}
if (cl == null) {
cl = ss.getContextClassLoader();
cl = SecuritySupport.getContextClassLoader();
}
XPathFactory f = new XPathFactoryFinder(cl).createInstance(factoryClassName);

View File

@ -36,6 +36,7 @@ import java.util.Properties;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
import jdk.xml.internal.SecuritySupport;
/**
* Implementation of {@link XPathFactory#newInstance(String)}.
@ -46,13 +47,12 @@ import java.util.function.Supplier;
class XPathFactoryFinder {
private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xpath.internal";
private static final SecuritySupport ss = new SecuritySupport() ;
/** debug support code. */
private static boolean debug = false;
static {
// Use try/catch block to support applets
try {
debug = ss.getSystemProperty("jaxp.debug") != null;
debug = SecuritySupport.getSystemProperty("jaxp.debug") != null;
} catch (Exception unused) {
debug = false;
}
@ -103,7 +103,7 @@ class XPathFactoryFinder {
private void debugDisplayClassLoader() {
try {
if( classLoader == ss.getContextClassLoader() ) {
if( classLoader == SecuritySupport.getContextClassLoader() ) {
debugPrintln(() -> "using thread context class loader ("+classLoader+") for search");
return;
}
@ -159,7 +159,7 @@ class XPathFactoryFinder {
// system property look up
try {
debugPrintln(()->"Looking up system property '"+propertyName+"'" );
String r = ss.getSystemProperty(propertyName);
String r = SecuritySupport.getSystemProperty(propertyName);
if(r!=null) {
debugPrintln(()->"The value is '"+r+"'");
xpathFactory = createInstance(r, true);
@ -175,7 +175,7 @@ class XPathFactoryFinder {
}
}
String javah = ss.getSystemProperty( "java.home" );
String javah = SecuritySupport.getSystemProperty( "java.home" );
String configFile = javah + File.separator +
"conf" + File.separator + "jaxp.properties";
@ -186,9 +186,9 @@ class XPathFactoryFinder {
if(firstTime){
File f=new File( configFile );
firstTime = false;
if(ss.doesFileExist(f)){
if(SecuritySupport.doesFileExist(f)){
debugPrintln(()->"Read properties file " + f);
cacheProps.load(ss.getFileInputStream(f));
cacheProps.load(SecuritySupport.getFileInputStream(f));
}
}
}
@ -407,7 +407,7 @@ class XPathFactoryFinder {
// Used for debugging purposes
private static String which( Class<?> clazz ) {
return ss.getClassSource(clazz);
return SecuritySupport.getClassSource(clazz);
}
}

View File

@ -29,7 +29,9 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.security.AccessController;
import java.security.CodeSource;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
@ -82,7 +84,7 @@ public class SecuritySupport {
public static String getSystemProperty(final String propName) {
return
AccessController.doPrivileged(
(PrivilegedAction<String>) () -> (String)System.getProperty(propName));
(PrivilegedAction<String>) () -> System.getProperty(propName));
}
/**
@ -220,6 +222,12 @@ public class SecuritySupport {
-> f.exists()));
}
/**
* Creates and returns a new FileInputStream from a file.
* @param file the specified file
* @return the FileInputStream
* @throws FileNotFoundException if the file is not found
*/
public static FileInputStream getFileInputStream(final File file)
throws FileNotFoundException {
try {
@ -230,6 +238,16 @@ public class SecuritySupport {
}
}
/**
* Returns the resource as a stream.
* @param name the resource name
* @return the resource stream
*/
public static InputStream getResourceAsStream(final String name) {
return AccessController.doPrivileged((PrivilegedAction<InputStream>) () ->
SecuritySupport.class.getResourceAsStream("/"+name));
}
/**
* Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
* @param bundle the base name of the resource bundle, a fully qualified class name
@ -259,4 +277,179 @@ public class SecuritySupport {
}
});
}
/**
* Checks whether the file exists.
* @param f the specified file
* @return true if the file exists, false otherwise
*/
public static boolean doesFileExist(final File f) {
return (AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> f.exists()));
}
/**
* Checks the LastModified attribute of a file.
* @param f the specified file
* @return the LastModified attribute
*/
static long getLastModified(final File f) {
return (AccessController.doPrivileged((PrivilegedAction<Long>) () -> f.lastModified()));
}
/**
* Strip off path from an URI
*
* @param uri an URI with full path
* @return the file name only
*/
public static String sanitizePath(String uri) {
if (uri == null) {
return "";
}
int i = uri.lastIndexOf("/");
if (i > 0) {
return uri.substring(i+1, uri.length());
}
return "";
}
/**
* Check the protocol used in the systemId against allowed protocols
*
* @param systemId the Id of the URI
* @param allowedProtocols a list of allowed protocols separated by comma
* @param accessAny keyword to indicate allowing any protocol
* @return the name of the protocol if rejected, null otherwise
*/
public static String checkAccess(String systemId, String allowedProtocols,
String accessAny) throws IOException {
if (systemId == null || (allowedProtocols != null &&
allowedProtocols.equalsIgnoreCase(accessAny))) {
return null;
}
String protocol;
if (!systemId.contains(":")) {
protocol = "file";
} else {
URL url = new URL(systemId);
protocol = url.getProtocol();
if (protocol.equalsIgnoreCase("jar")) {
String path = url.getPath();
protocol = path.substring(0, path.indexOf(":"));
} else if (protocol.equalsIgnoreCase("jrt")) {
// if the systemId is "jrt" then allow access if "file" allowed
protocol = "file";
}
}
if (isProtocolAllowed(protocol, allowedProtocols)) {
//access allowed
return null;
} else {
return protocol;
}
}
/**
* Check if the protocol is in the allowed list of protocols. The check
* is case-insensitive while ignoring whitespaces.
*
* @param protocol a protocol
* @param allowedProtocols a list of allowed protocols
* @return true if the protocol is in the list
*/
private static boolean isProtocolAllowed(String protocol, String allowedProtocols) {
if (allowedProtocols == null) {
return false;
}
String temp[] = allowedProtocols.split(",");
for (String t : temp) {
t = t.trim();
if (t.equalsIgnoreCase(protocol)) {
return true;
}
}
return false;
}
public static ClassLoader getContextClassLoader() {
return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
return cl;
});
}
public static ClassLoader getSystemClassLoader() {
return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
ClassLoader cl = null;
try {
cl = ClassLoader.getSystemClassLoader();
} catch (SecurityException ex) {
}
return cl;
});
}
public static ClassLoader getParentClassLoader(final ClassLoader cl) {
return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
ClassLoader parent = null;
try {
parent = cl.getParent();
} catch (SecurityException ex) {
}
// eliminate loops in case of the boot
// ClassLoader returning itself as a parent
return (parent == cl) ? null : parent;
});
}
// Used for debugging purposes
public static String getClassSource(Class<?> cls) {
return AccessController.doPrivileged((PrivilegedAction<String>) () -> {
CodeSource cs = cls.getProtectionDomain().getCodeSource();
if (cs != null) {
URL loc = cs.getLocation();
return loc != null ? loc.toString() : "(no location)";
} else {
return "(no code source)";
}
});
}
// ---------------- For SAX ----------------------
/**
* Returns the current thread's context class loader, or the system class loader
* if the context class loader is null.
* @return the current thread's context class loader, or the system class loader
* @throws SecurityException
*/
public static ClassLoader getClassLoader() throws SecurityException{
return AccessController.doPrivileged((PrivilegedAction<ClassLoader>)() -> {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
return cl;
});
}
public static InputStream getResourceAsStream(final ClassLoader cl, final String name)
{
return AccessController.doPrivileged((PrivilegedAction<InputStream>) () -> {
InputStream ris;
if (cl == null) {
ris = SecuritySupport.class.getResourceAsStream(name);
} else {
ris = cl.getResourceAsStream(name);
}
return ris;
});
}
}

View File

@ -34,23 +34,22 @@ package org.xml.sax.helpers;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
import org.xml.sax.Parser; // deprecated
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import jdk.xml.internal.SecuritySupport;
import org.xml.sax.AttributeList; // deprecated
import org.xml.sax.EntityResolver;
import org.xml.sax.DTDHandler;
import org.xml.sax.DocumentHandler; // deprecated
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.DTDHandler;
import org.xml.sax.DocumentHandler; // deprecated
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.Parser; // deprecated
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
/**
@ -82,7 +81,6 @@ import org.xml.sax.SAXNotSupportedException;
@SuppressWarnings("deprecation")
public class ParserAdapter implements XMLReader, DocumentHandler
{
private static SecuritySupport ss = new SecuritySupport();
////////////////////////////////////////////////////////////////////
// Constructors.
@ -104,7 +102,7 @@ public class ParserAdapter implements XMLReader, DocumentHandler
{
super();
String driver = ss.getSystemProperty("org.xml.sax.parser");
String driver = SecuritySupport.getSystemProperty("org.xml.sax.parser");
try {
setup(ParserFactory.makeParser());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,6 +30,7 @@
package org.xml.sax.helpers;
import jdk.xml.internal.SecuritySupport;
/**
* Java-specific class for dynamically loading SAX parsers.
@ -66,7 +67,6 @@ package org.xml.sax.helpers;
@SuppressWarnings( "deprecation" )
@Deprecated(since="1.5")
public class ParserFactory {
private static SecuritySupport ss = new SecuritySupport();
/**
* Private null constructor.
@ -104,7 +104,7 @@ public class ParserFactory {
NullPointerException,
ClassCastException
{
String className = ss.getSystemProperty("org.xml.sax.parser");
String className = SecuritySupport.getSystemProperty("org.xml.sax.parser");
if (className == null) {
throw new NullPointerException("No value for sax.parser property");
} else {
@ -140,7 +140,8 @@ public class ParserFactory {
InstantiationException,
ClassCastException
{
return NewInstance.newInstance (org.xml.sax.Parser.class, ss.getClassLoader(), className);
return NewInstance.newInstance (org.xml.sax.Parser.class,
SecuritySupport.getClassLoader(), className);
}
}

View File

@ -1,92 +0,0 @@
/*
* Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.xml.sax.helpers;
import java.io.*;
import java.security.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of the JAXP
* API.
*
* Security related methods that only work on J2SE 1.2 and newer.
*/
class SecuritySupport {
/**
* Returns the current thread's context class loader, or the system class loader
* if the context class loader is null.
* @return the current thread's context class loader, or the system class loader
* @throws SecurityException
*/
ClassLoader getClassLoader() throws SecurityException{
return AccessController.doPrivileged((PrivilegedAction<ClassLoader>)() -> {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
return cl;
});
}
String getSystemProperty(final String propName) {
return AccessController.doPrivileged((PrivilegedAction<String>)()
-> System.getProperty(propName));
}
FileInputStream getFileInputStream(final File file)
throws FileNotFoundException
{
try {
return AccessController.doPrivileged((PrivilegedExceptionAction<FileInputStream>)() ->
new FileInputStream(file));
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
InputStream getResourceAsStream(final ClassLoader cl, final String name)
{
return AccessController.doPrivileged((PrivilegedAction<InputStream>) () -> {
InputStream ris;
if (cl == null) {
ris = SecuritySupport.class.getResourceAsStream(name);
} else {
ris = cl.getResourceAsStream(name);
}
return ris;
});
}
boolean doesFileExist(final File f) {
return (AccessController.doPrivileged((PrivilegedAction<Boolean>)() ->
f.exists()));
}
}

View File

@ -31,6 +31,7 @@
// $Id: XMLReaderFactory.java,v 1.2.2.1 2005/07/31 22:48:08 jeffsuttor Exp $
package org.xml.sax.helpers;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@ -41,6 +42,7 @@ import java.util.Iterator;
import java.util.Objects;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import jdk.xml.internal.SecuritySupport;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
@ -94,7 +96,6 @@ final public class XMLReaderFactory
}
private static final String property = "org.xml.sax.driver";
private static final SecuritySupport ss = new SecuritySupport();
/**
* Obtains a new instance of a {@link org.xml.sax.XMLReader}.
@ -138,11 +139,11 @@ final public class XMLReaderFactory
throws SAXException
{
String className = null;
ClassLoader cl = ss.getClassLoader();
ClassLoader cl = SecuritySupport.getClassLoader();
// 1. try the JVM-instance-wide system property
try {
className = ss.getSystemProperty(property);
className = SecuritySupport.getSystemProperty(property);
}
catch (RuntimeException e) { /* continue searching */ }
@ -187,7 +188,7 @@ final public class XMLReaderFactory
public static XMLReader createXMLReader (String className)
throws SAXException
{
return loadClass (ss.getClassLoader(), className);
return loadClass (SecuritySupport.getClassLoader(), className);
}
private static XMLReader loadClass (ClassLoader loader, String className)
@ -224,11 +225,11 @@ final public class XMLReaderFactory
BufferedReader reader;
try {
in = ss.getResourceAsStream(cl, service);
in = SecuritySupport.getResourceAsStream(cl, service);
// If no provider found then try the current ClassLoader
if (in == null) {
in = ss.getResourceAsStream(null, service);
in = SecuritySupport.getResourceAsStream(null, service);
}
if (in != null) {