--- a/jaxp/src/javax/xml/parsers/FactoryFinder.java Wed Jul 05 18:46:58 2017 +0200
+++ b/jaxp/src/javax/xml/parsers/FactoryFinder.java Mon Feb 18 11:33:35 2013 -0800
@@ -42,7 +42,7 @@
* @author Huizhe.Wang@oracle.com
*/
class FactoryFinder {
-
+ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
/**
* Internal debug flag.
*/
@@ -166,6 +166,14 @@
static Object newInstance(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader)
throws ConfigurationError
{
+ // make sure we have access to restricted packages
+ if (System.getSecurityManager() != null) {
+ if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
+ cl = null;
+ useBSClsLoader = true;
+ }
+ }
+
try {
Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader);
Object instance = providerClass.newInstance();