src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java
Print this page
*** 40,49 ****
--- 40,50 ----
import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
import com.sun.org.apache.xerces.internal.util.PropertyState;
import com.sun.org.apache.xerces.internal.util.SecurityManager;
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.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
*** 105,114 ****
--- 106,119 ----
/** Property identifier: security manager. */
private static final String SECURITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
+ /** Property identifier: security property manager. */
+ private static final String XML_SECURITY_PROPERTY_MANAGER =
+ Constants.XML_SECURITY_PROPERTY_MANAGER;
+
/** Property identifier: symbol table. */
private static final String SYMBOL_TABLE =
Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
/** Property identifier: validation manager. */
*** 121,136 ****
/** Property identifier: locale. */
private static final String LOCALE =
Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY;
- /** property identifier: access external dtd. */
- private static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD;
-
- /** Property identifier: access to external schema */
- private static final String ACCESS_EXTERNAL_SCHEMA = XMLConstants.ACCESS_EXTERNAL_SCHEMA;
-
//
// Data
//
/**
* <p>State of secure mode.</p>
--- 126,135 ----
*** 182,191 ****
--- 181,193 ----
private final HashMap fInitProperties = new HashMap();
/** Stores the initial security manager. */
private final SecurityManager fInitSecurityManager;
+ /** Stores the initial security property manager. */
+ private final XMLSecurityPropertyManager fSecurityPropertyMgr;
+
//
// User Objects
//
/** Application's ErrorHandler. **/
*** 248,259 ****
fInitSecurityManager = null;
}
fComponents.put(SECURITY_MANAGER, fInitSecurityManager);
//pass on properties set on SchemaFactory
! setProperty(ACCESS_EXTERNAL_DTD, grammarContainer.getProperty(ACCESS_EXTERNAL_DTD));
! setProperty(ACCESS_EXTERNAL_SCHEMA, grammarContainer.getProperty(ACCESS_EXTERNAL_SCHEMA));
}
/**
* Returns the state of a feature.
*
--- 250,262 ----
fInitSecurityManager = null;
}
fComponents.put(SECURITY_MANAGER, fInitSecurityManager);
//pass on properties set on SchemaFactory
! fSecurityPropertyMgr = (XMLSecurityPropertyManager)
! grammarContainer.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER);
! setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
}
/**
* Returns the state of a feature.
*
*** 307,316 ****
--- 310,328 ----
if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
if (_isSecureMode && !value) {
throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
}
setProperty(SECURITY_MANAGER, value ? new SecurityManager() : null);
+
+ if (value && Constants.IS_JDK8_OR_ABOVE) {
+ fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
+ XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
+ fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
+ XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
+ setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
+ }
+
return;
}
fConfigUpdated = true;
fEntityManager.setFeature(featureId, value);
fErrorReporter.setFeature(featureId, value);