--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -24,7 +24,6 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
-import java.io.InputStream;
import java.lang.ClassLoader;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -116,33 +115,6 @@
}
/**
- * Return resource using the same classloader for the ObjectFactory by
- * default or bootclassloader when Security Manager is in place
- */
- public static InputStream getResourceAsStream(final String name) {
- if (System.getSecurityManager() != null) {
- return getResourceAsStream(null, name);
- } else {
- return getResourceAsStream(findClassLoader(), name);
- }
- }
-
- public static InputStream getResourceAsStream(final ClassLoader cl,
- final String name) {
- return (InputStream) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = Object.class.getResourceAsStream("/" + name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
- });
- }
-
- /**
* Gets a resource bundle using the specified base name, the default locale,
* and the caller's class loader.
*
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -128,29 +128,10 @@
}
}
- /**
- * Return resource using the same classloader for the ObjectFactory by
- * default or bootclassloader when Security Manager is in place
- */
public static InputStream getResourceAsStream(final String name) {
- if (System.getSecurityManager()!=null) {
- return getResourceAsStream(null, name);
- } else {
- return getResourceAsStream(ObjectFactory.findClassLoader(), name);
- }
- }
-
- public static InputStream getResourceAsStream(final ClassLoader cl,
- final String name) {
return (InputStream) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = Object.class.getResourceAsStream("/"+name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
+ return SecuritySupport.class.getResourceAsStream("/"+name);
}
});
}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDOMImplementationImpl.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDOMImplementationImpl.java Sun Jun 28 16:39:27 2015 -0700
@@ -343,10 +343,7 @@
*/
public LSSerializer createLSSerializer() {
try {
- Class serializerClass = ObjectFactory.findProviderClass(
- "com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl",
- ObjectFactory.findClassLoader(), true);
- return (LSSerializer) serializerClass.newInstance();
+ return new com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl();
}
catch (Exception e) {}
// Fall back to Xerces' deprecated serializer if
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -118,34 +118,6 @@
throw (FileNotFoundException)e.getException();
}
}
- /**
- * Return resource using the same classloader for the ObjectFactory by default
- * or bootclassloader when Security Manager is in place
- */
- public static InputStream getResourceAsStream(final String name) {
- if (System.getSecurityManager()!=null) {
- return getResourceAsStream(null, name);
- } else {
- return getResourceAsStream(ObjectFactory.findClassLoader(), name);
- }
- }
-
- public static InputStream getResourceAsStream(final ClassLoader cl,
- final String name)
- {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = Object.class.getResourceAsStream("/"+name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
- });
- }
/**
* Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -23,7 +23,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.InputStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -113,23 +112,6 @@
}
}
- InputStream getResourceAsStream(final ClassLoader cl,
- final String name)
- {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = ClassLoader.getSystemResourceAsStream(name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
- });
- }
-
boolean getFileExists(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -23,7 +23,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.InputStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -113,23 +112,6 @@
}
}
- InputStream getResourceAsStream(final ClassLoader cl,
- final String name)
- {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = ClassLoader.getSystemResourceAsStream(name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
- });
- }
-
boolean getFileExists(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/LSSerializerImpl.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/LSSerializerImpl.java Sun Jun 28 16:39:27 2015 -0700
@@ -36,6 +36,7 @@
import com.sun.org.apache.xml.internal.serializer.DOM3Serializer;
import com.sun.org.apache.xml.internal.serializer.Encodings;
import com.sun.org.apache.xml.internal.serializer.Serializer;
+import com.sun.org.apache.xml.internal.serializer.ToXMLStream;
import com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory;
import com.sun.org.apache.xml.internal.serializer.SerializerFactory;
import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
@@ -218,7 +219,8 @@
// Get a serializer that seriailizes according to the properties,
// which in this case is to xml
- fXMLSerializer = SerializerFactory.getSerializer(configProps);
+ fXMLSerializer = new ToXMLStream();
+ fXMLSerializer.setOutputFormat(configProps);
// Initialize Serializer
fXMLSerializer.setOutputFormat(fDOMConfigProperties);
@@ -262,9 +264,6 @@
// entities
fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_TRUE);
- // preserve entities
- fDOMConfigProperties.setProperty(
- OutputPropertiesFactory.S_KEY_ENTITIES, DOMConstants.S_XSL_VALUE_ENTITIES);
// error-handler
// Should we set our default ErrorHandler
@@ -290,9 +289,6 @@
+ DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_DEFAULT_TRUE);
fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_FALSE);
- // preserve entities
- fDOMConfigProperties.setProperty(
- OutputPropertiesFactory.S_KEY_ENTITIES, "");
fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ DOMConstants.DOM_CDATA_SECTIONS,
DOMConstants.DOM3_DEFAULT_FALSE);
@@ -531,8 +527,6 @@
if (state) {
fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_TRUE);
- fDOMConfigProperties.setProperty(
- OutputPropertiesFactory.S_KEY_ENTITIES, DOMConstants.S_XSL_VALUE_ENTITIES);
} else {
fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE);
@@ -679,31 +673,29 @@
fFeatures |= WELLFORMED;
fFeatures |= ELEM_CONTENT_WHITESPACE;
fFeatures |= COMMENTS;
- }
- // infoset
- fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
- + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_EXPLICIT_TRUE);
- fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
- + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_TRUE);
- fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
- + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_TRUE);
- fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
- + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_EXPLICIT_TRUE);
- fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
- + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_EXPLICIT_TRUE);
+ // infoset
+ fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_EXPLICIT_TRUE);
+ fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_TRUE);
+ fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_TRUE);
+ fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_EXPLICIT_TRUE);
+ fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_EXPLICIT_TRUE);
- fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
- + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE);
- fDOMConfigProperties.setProperty(
- OutputPropertiesFactory.S_KEY_ENTITIES, "");
+ fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE);
- fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
- + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_FALSE);
- fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
- + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_EXPLICIT_FALSE);
- fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
- + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_EXPLICIT_FALSE);
+ fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_FALSE);
+ fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_EXPLICIT_FALSE);
+ fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+ + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_EXPLICIT_FALSE);
+ }
} else if (name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS)) {
String msg = Utils.messages.createMessage(
MsgKey.ER_FEATURE_NOT_SUPPORTED,
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java Sun Jun 28 16:39:27 2015 -0700
@@ -27,11 +27,9 @@
import java.util.Properties;
import com.sun.org.apache.xpath.internal.XPathContext;
-import com.sun.org.apache.xpath.internal.objects.XNumber;
import com.sun.org.apache.xpath.internal.objects.XObject;
import com.sun.org.apache.xpath.internal.objects.XString;
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
-import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
/**
@@ -69,7 +67,7 @@
// property argument is to be looked for.
Properties xsltInfo = new Properties();
- loadPropertyFile(XSLT_PROPERTIES, xsltInfo);
+ loadPropertyFile(xsltInfo);
if (indexOfNSSep > 0)
{
@@ -159,25 +157,21 @@
}
/**
- * Retrieve a propery bundle from a specified file
+ * Retrieve a property bundle from XSLT_PROPERTIES
*
- * @param file The string name of the property file. The name
- * should already be fully qualified as path/filename
* @param target The target property bag the file will be placed into.
*/
- public void loadPropertyFile(String file, Properties target)
+ private void loadPropertyFile(Properties target)
{
try
{
- // Use SecuritySupport class to provide priveleged access to property file
- InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
- file);
+ // Use SecuritySupport class to provide privileged access to property file
+ InputStream is = SecuritySupport.getResourceAsStream(XSLT_PROPERTIES);
// get a buffered version
- BufferedInputStream bis = new BufferedInputStream(is);
-
- target.load(bis); // and load up the property bag from this
- bis.close(); // close out after reading
+ try (BufferedInputStream bis = new BufferedInputStream(is)) {
+ target.load(bis); // and load up the property bag from this
+ }
}
catch (Exception ex)
{
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -26,9 +26,7 @@
package javax.xml.datatype;
import java.security.*;
-import java.net.*;
import java.io.*;
-import java.util.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
@@ -77,23 +75,6 @@
}
}
- InputStream getResourceAsStream(final ClassLoader cl,
- final String name)
- {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = Object.class.getResourceAsStream(name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
- });
- }
-
boolean doesFileExist(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -26,9 +26,7 @@
package javax.xml.parsers;
import java.security.*;
-import java.net.*;
import java.io.*;
-import java.util.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
@@ -81,23 +79,6 @@
}
}
- InputStream getResourceAsStream(final ClassLoader cl,
- final String name)
- {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = Object.class.getResourceAsStream(name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
- });
- }
-
boolean doesFileExist(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -26,9 +26,7 @@
package javax.xml.stream;
import java.security.*;
-import java.net.*;
import java.io.*;
-import java.util.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
@@ -81,23 +79,6 @@
}
}
- InputStream getResourceAsStream(final ClassLoader cl,
- final String name)
- {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = Object.class.getResourceAsStream(name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
- });
- }
-
boolean doesFileExist(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -26,9 +26,7 @@
package javax.xml.transform;
import java.security.*;
-import java.net.*;
import java.io.*;
-import java.util.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
@@ -79,23 +77,6 @@
}
}
- InputStream getResourceAsStream(final ClassLoader cl,
- final String name)
- {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = Object.class.getResourceAsStream(name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
- });
- }
-
boolean doesFileExist(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java Sun Jun 28 16:39:27 2015 -0700
@@ -418,30 +418,8 @@
private static final Class<SchemaFactory> SERVICE_CLASS = SchemaFactory.class;
+ // Used for debugging purposes
private static String which( Class<?> clazz ) {
- return which( clazz.getName(), clazz.getClassLoader() );
- }
-
- /**
- * <p>Search the specified classloader for the given classname.</p>
- *
- * @param classname the fully qualified name of the class to search for
- * @param loader the classloader to search
- *
- * @return the source location of the resource, or null if it wasn't found
- */
- private static String which(String classname, ClassLoader loader) {
-
- String classnameAsResource = classname.replace('.', '/') + ".class";
-
- if( loader==null ) loader = ClassLoader.getSystemClassLoader();
-
- //URL it = loader.getResource(classnameAsResource);
- URL it = ss.getResourceAsURL(loader, classnameAsResource);
- if (it != null) {
- return it.toString();
- } else {
- return null;
- }
+ return ss.getClassSource(clazz);
}
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -25,12 +25,9 @@
package javax.xml.validation;
-import java.io.IOException;
import java.net.URL;
import java.security.*;
-import java.net.*;
import java.io.*;
-import java.util.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
@@ -43,9 +40,10 @@
ClassLoader getContextClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ return
+ AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ @Override
+ public ClassLoader run() {
ClassLoader cl = null;
//try {
cl = Thread.currentThread().getContextClassLoader();
@@ -58,9 +56,9 @@
}
String getSystemProperty(final String propName) {
- return (String)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ return AccessController.doPrivileged(new PrivilegedAction<String>() {
+ @Override
+ public String run() {
return System.getProperty(propName);
}
});
@@ -70,9 +68,10 @@
throws FileNotFoundException
{
try {
- return (FileInputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws FileNotFoundException {
+ return AccessController.doPrivileged(
+ new PrivilegedExceptionAction<FileInputStream>() {
+ @Override
+ public FileInputStream run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
@@ -81,83 +80,29 @@
}
}
- InputStream getURLInputStream(final URL url)
- throws IOException
- {
- try {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException {
- return url.openStream();
- }
- });
- } catch (PrivilegedActionException e) {
- throw (IOException)e.getException();
- }
- }
-
- URL getResourceAsURL(final ClassLoader cl,
- final String name)
- {
- return (URL)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- URL url;
- if (cl == null) {
- url = Object.class.getResource(name);
- } else {
- url = cl.getResource(name);
- }
- return url;
+ // Used for debugging purposes
+ String getClassSource(Class<?> cls) {
+ return AccessController.doPrivileged(new PrivilegedAction<String>() {
+ @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)";
}
- });
- }
-
- Enumeration getResources(final ClassLoader cl,
- final String name) throws IOException
- {
- try{
- return (Enumeration)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException{
- Enumeration enumeration;
- if (cl == null) {
- enumeration = ClassLoader.getSystemResources(name);
- } else {
- enumeration = cl.getResources(name);
- }
- return enumeration;
- }
- });
- }catch(PrivilegedActionException e){
- throw (IOException)e.getException();
- }
- }
-
- InputStream getResourceAsStream(final ClassLoader cl,
- final String name)
- {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = Object.class.getResourceAsStream(name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
- });
+ }
+ });
}
boolean doesFileExist(final File f) {
- return ((Boolean)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return new Boolean(f.exists());
- }
- })).booleanValue();
+ return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ @Override
+ public Boolean run() {
+ return f.exists();
+ }
+ });
}
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -27,9 +27,7 @@
import java.net.URL;
import java.security.*;
-import java.net.*;
import java.io.*;
-import java.util.*;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
@@ -42,9 +40,9 @@
ClassLoader getContextClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ @Override
+ public ClassLoader run() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
@@ -55,21 +53,22 @@
}
String getSystemProperty(final String propName) {
- return (String)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty(propName);
- }
- });
+ return AccessController.doPrivileged(new PrivilegedAction<String>() {
+ @Override
+ public String 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 AccessController.doPrivileged(
+ new PrivilegedExceptionAction<FileInputStream>() {
+ @Override
+ public FileInputStream run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
@@ -78,83 +77,29 @@
}
}
- InputStream getURLInputStream(final URL url)
- throws IOException
- {
- try {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException {
- return url.openStream();
- }
- });
- } catch (PrivilegedActionException e) {
- throw (IOException)e.getException();
- }
- }
-
- URL getResourceAsURL(final ClassLoader cl,
- final String name)
- {
- return (URL)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- URL url;
- if (cl == null) {
- url = Object.class.getResource(name);
- } else {
- url = cl.getResource(name);
- }
- return url;
+ // Used for debugging purposes
+ String getClassSource(Class<?> cls) {
+ return AccessController.doPrivileged(new PrivilegedAction<String>() {
+ @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)";
}
- });
- }
-
- Enumeration getResources(final ClassLoader cl,
- final String name) throws IOException
- {
- try{
- return (Enumeration)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException{
- Enumeration enumeration;
- if (cl == null) {
- enumeration = ClassLoader.getSystemResources(name);
- } else {
- enumeration = cl.getResources(name);
- }
- return enumeration;
- }
- });
- }catch(PrivilegedActionException e){
- throw (IOException)e.getException();
- }
- }
-
- InputStream getResourceAsStream(final ClassLoader cl,
- final String name)
- {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = Object.class.getResourceAsStream(name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
- });
+ }
+ });
}
boolean doesFileExist(final File f) {
- return ((Boolean)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return new Boolean(f.exists());
- }
- })).booleanValue();
+ return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ @Override
+ public Boolean run() {
+ return f.exists();
+ }
+ });
}
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java Sun Jun 28 16:39:27 2015 -0700
@@ -414,30 +414,9 @@
private static final Class<XPathFactory> SERVICE_CLASS = XPathFactory.class;
- private static String which( Class clazz ) {
- return which( clazz.getName(), clazz.getClassLoader() );
+ // Used for debugging purposes
+ private static String which( Class<?> clazz ) {
+ return ss.getClassSource(clazz);
}
- /**
- * <p>Search the specified classloader for the given classname.</p>
- *
- * @param classname the fully qualified name of the class to search for
- * @param loader the classloader to search
- *
- * @return the source location of the resource, or null if it wasn't found
- */
- private static String which(String classname, ClassLoader loader) {
-
- String classnameAsResource = classname.replace('.', '/') + ".class";
-
- if( loader==null ) loader = ClassLoader.getSystemClassLoader();
-
- //URL it = loader.getResource(classnameAsResource);
- URL it = ss.getResourceAsURL(loader, classnameAsResource);
- if (it != null) {
- return it.toString();
- } else {
- return null;
- }
- }
}
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/SecuritySupport.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/SecuritySupport.java Sun Jun 28 16:39:27 2015 -0700
@@ -87,7 +87,7 @@
public Object run() {
InputStream ris;
if (cl == null) {
- ris = Object.class.getResourceAsStream(name);
+ ris = SecuritySupport.class.getResourceAsStream(name);
} else {
ris = cl.getResourceAsStream(name);
}
--- a/jaxp/test/TEST.groups Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/test/TEST.groups Sun Jun 28 16:39:27 2015 -0700
@@ -29,5 +29,8 @@
tier2 = \
:jaxp_all
+# No tier 3 tests.
+tier3 =
+
jaxp_all = \
javax/xml/jaxp
--- a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java Thu Jun 25 10:21:37 2015 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java Sun Jun 28 16:39:27 2015 -0700
@@ -101,7 +101,6 @@
/*
* @bug 8080906
- * It will fail in a Jigsaw build until JDK-8080266 is fixed.
*/
@Test
public void testDefaultLSSerializer() throws Exception {
@@ -134,6 +133,9 @@
DOMImplementation impl = doc.getImplementation();
DOMImplementationLS implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0");
LSSerializer writer = implLS.createLSSerializer();
+
+ System.out.println("Serializer is: " + implLS.getClass().getName() + " " + implLS);
+
DOMErrorHandlerImpl eh = new DOMErrorHandlerImpl();
writer.getDomConfig().setParameter("error-handler", eh);
@@ -200,6 +202,8 @@
DOMImplementationLS domImplementationLS = (DOMImplementationLS) domImplementation;
LSSerializer lsSerializer = domImplementationLS.createLSSerializer();
+ System.out.println("Serializer is: " + lsSerializer.getClass().getName() + " " + lsSerializer);
+
// get configuration
DOMConfiguration domConfiguration = lsSerializer.getDomConfig();
@@ -294,6 +298,8 @@
DOMImplementationLS domImplementationLS = (DOMImplementationLS) domImplementation;
LSSerializer lsSerializer = domImplementationLS.createLSSerializer();
+ System.out.println("Serializer is: " + lsSerializer.getClass().getName() + " " + lsSerializer);
+
// get default serialization
String defaultSerialization = lsSerializer.writeToString(document);