\u5143\u7D20\uFF0C\u4F46\u627E\u5230 ''{0}''\u3002
src-attribute.1 = src-attribute.1: \u5C6C\u6027 ''default'' \u8207 ''fixed'' \u4E0D\u53EF\u540C\u6642\u51FA\u73FE\u5728\u5C6C\u6027\u5BA3\u544A ''{0}'' \u4E2D\u3002\u8ACB\u53EA\u4F7F\u7528\u5176\u4E2D\u4E00\u500B\u3002
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java
index 4b7ba136685..3fbe23475d7 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java
@@ -53,6 +53,7 @@ import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
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.XMLSymbols;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription;
@@ -71,6 +72,7 @@ import com.sun.org.apache.xerces.internal.xs.XSLoader;
import com.sun.org.apache.xerces.internal.xs.XSModel;
import java.util.HashMap;
import java.util.Map;
+import javax.xml.XMLConstants;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMError;
import org.w3c.dom.DOMErrorHandler;
@@ -216,6 +218,12 @@ XSLoader, DOMConfiguration {
protected static final String ENTITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
+ /** Property identifier: access to external dtd */
+ public static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD;
+
+ /** Property identifier: access to external schema */
+ public static final String ACCESS_EXTERNAL_SCHEMA = XMLConstants.ACCESS_EXTERNAL_SCHEMA;
+
// recognized properties
private static final String [] RECOGNIZED_PROPERTIES = {
ENTITY_MANAGER,
@@ -229,7 +237,9 @@ XSLoader, DOMConfiguration {
JAXP_SCHEMA_SOURCE,
SECURITY_MANAGER,
LOCALE,
- SCHEMA_DV_FACTORY
+ SCHEMA_DV_FACTORY,
+ ACCESS_EXTERNAL_DTD,
+ ACCESS_EXTERNAL_SCHEMA
};
// Data
@@ -260,6 +270,8 @@ XSLoader, DOMConfiguration {
private final CMNodeFactory fNodeFactory = new CMNodeFactory(); //component mgr will be set later
private CMBuilder fCMBuilder;
private XSDDescription fXSDDescription = new XSDDescription();
+ private String faccessExternalDTD = Constants.EXTERNAL_ACCESS_DEFAULT;
+ private String faccessExternalSchema = Constants.EXTERNAL_ACCESS_DEFAULT;
private Map fJAXPCache;
private Locale fLocale = Locale.getDefault();
@@ -454,6 +466,12 @@ XSLoader, DOMConfiguration {
fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
}
}
+ else if (propertyId.equals(ACCESS_EXTERNAL_DTD)) {
+ faccessExternalDTD = (String) state;
+ }
+ else if (propertyId.equals(ACCESS_EXTERNAL_SCHEMA)) {
+ faccessExternalSchema = (String) state;
+ }
} // setProperty(String, Object)
/**
@@ -585,6 +603,15 @@ XSLoader, DOMConfiguration {
if(!fJAXPProcessed) {
processJAXPSchemaSource(locationPairs);
}
+
+ if (desc.isExternal()) {
+ String accessError = SecuritySupport.checkAccess(desc.getExpandedSystemId(), faccessExternalSchema, Constants.ACCESS_EXTERNAL_ALL);
+ if (accessError != null) {
+ throw new XNIException(fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
+ "schema_reference.access",
+ new Object[] { SecuritySupport.sanitizePath(desc.getExpandedSystemId()), accessError }, XMLErrorReporter.SEVERITY_ERROR));
+ }
+ }
SchemaGrammar grammar = fSchemaHandler.parseSchema(source, desc, locationPairs);
return grammar;
@@ -1038,6 +1065,9 @@ XSLoader, DOMConfiguration {
// get generate-synthetic-annotations feature
fSchemaHandler.setGenerateSyntheticAnnotations(componentManager.getFeature(GENERATE_SYNTHETIC_ANNOTATIONS, false));
fSchemaHandler.reset(componentManager);
+
+ faccessExternalDTD = (String) componentManager.getProperty(ACCESS_EXTERNAL_DTD);
+ faccessExternalSchema = (String) componentManager.getProperty(ACCESS_EXTERNAL_SCHEMA);
}
private void initGrammarBucket(){
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java
index c14673ec26a..170601cb46a 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java
@@ -29,7 +29,7 @@ import java.util.Map;
import java.util.Stack;
import java.util.Vector;
import java.util.ArrayList;
-
+import javax.xml.XMLConstants;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.RevalidationHandler;
import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
@@ -233,6 +233,12 @@ public class XMLSchemaValidator
protected static final String SCHEMA_DV_FACTORY =
Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_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;
+
protected static final String USE_SERVICE_MECHANISM = Constants.ORACLE_FEATURE_SERVICE_MECHANISM;
// recognized features and properties
@@ -291,11 +297,13 @@ public class XMLSchemaValidator
JAXP_SCHEMA_SOURCE,
JAXP_SCHEMA_LANGUAGE,
SCHEMA_DV_FACTORY,
+ ACCESS_EXTERNAL_DTD,
+ ACCESS_EXTERNAL_SCHEMA
};
/** Property defaults. */
private static final Object[] PROPERTY_DEFAULTS =
- { null, null, null, null, null, null, null, null, null, null, null};
+ { null, null, null, null, null, null, null, null, null, null, null, null, null};
// this is the number of valuestores of each kind
// we expect an element to have. It's almost
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java
index 8e09b9f80d8..c35baa8667a 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java
@@ -34,6 +34,7 @@ import com.sun.org.apache.xerces.internal.xni.grammars.XMLSchemaDescription;
* @author Neil Graham, IBM
* @author Neeraj Bajaj, SUN Microsystems.
*
+ * @version $Id: XSDDescription.java,v 1.6 2010-11-01 04:39:55 joehw Exp $
*/
public class XSDDescription extends XMLResourceIdentifierImpl
implements XMLSchemaDescription {
@@ -180,6 +181,17 @@ public class XSDDescription extends XMLResourceIdentifierImpl
fContextType == CONTEXT_XSITYPE;
}
+ /**
+ * @return true is the schema is external
+ */
+ public boolean isExternal() {
+ return fContextType == CONTEXT_INCLUDE ||
+ fContextType == CONTEXT_REDEFINE ||
+ fContextType == CONTEXT_IMPORT ||
+ fContextType == CONTEXT_ELEMENT ||
+ fContextType == CONTEXT_ATTRIBUTE ||
+ fContextType == CONTEXT_XSITYPE;
+ }
/**
* Compares this grammar with the given grammar. Currently, we compare
* the target namespaces.
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java
index 7c9974e4a17..eba1ac0de20 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java
@@ -77,6 +77,7 @@ 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.XMLSymbols;
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
@@ -105,6 +106,7 @@ import com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition;
import com.sun.org.apache.xerces.internal.xs.XSTerm;
import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
import com.sun.org.apache.xerces.internal.xs.datatypes.ObjectList;
+import javax.xml.XMLConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -221,6 +223,12 @@ public class XSDHandler {
protected static final String LOCALE =
Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY;
+ /** property identifier: access external dtd. */
+ public static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD;
+
+ /** Property identifier: access to external schema */
+ public static final String ACCESS_EXTERNAL_SCHEMA = XMLConstants.ACCESS_EXTERNAL_SCHEMA;
+
protected static final boolean DEBUG_NODE_POOL = false;
// Data
@@ -251,6 +259,8 @@ public class XSDHandler {
*/
protected SecurityManager fSecureProcessing = null;
+ private String fAccessExternalSchema;
+
// These tables correspond to the symbol spaces defined in the
// spec.
// They are keyed with a QName (that is, String("URI,localpart) and
@@ -2150,6 +2160,15 @@ public class XSDHandler {
fLastSchemaWasDuplicate = true;
return schemaElement;
}
+ if (referType == XSDDescription.CONTEXT_IMPORT || referType == XSDDescription.CONTEXT_INCLUDE
+ || referType == XSDDescription.CONTEXT_REDEFINE) {
+ String accessError = SecuritySupport.checkAccess(schemaId, fAccessExternalSchema, Constants.ACCESS_EXTERNAL_ALL);
+ if (accessError != null) {
+ reportSchemaFatalError("schema_reference.access",
+ new Object[] { SecuritySupport.sanitizePath(schemaId), accessError },
+ referElement);
+ }
+ }
}
fSchemaParser.parse(schemaSource);
@@ -3561,6 +3580,11 @@ public class XSDHandler {
} catch (XMLConfigurationException e) {
}
+ //For Schema validation, the secure feature is set to true by default
+ fSchemaParser.setProperty(ACCESS_EXTERNAL_DTD,
+ componentManager.getProperty(ACCESS_EXTERNAL_DTD, Constants.EXTERNAL_ACCESS_DEFAULT));
+ fAccessExternalSchema = (String) componentManager.getProperty(
+ ACCESS_EXTERNAL_SCHEMA, Constants.EXTERNAL_ACCESS_DEFAULT);
} // reset(XMLComponentManager)
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java
index af14049cf50..aea63c2eb16 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java
@@ -37,7 +37,7 @@ import org.xml.sax.SAXNotSupportedException;
/**
* @author Rajiv Mordani
* @author Edwin Goei
- * @version $Id: DocumentBuilderFactoryImpl.java,v 1.6 2009/07/28 23:48:32 joehw Exp $
+ * @version $Id: DocumentBuilderFactoryImpl.java,v 1.8 2010-11-01 04:40:06 joehw Exp $
*/
public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory {
/** These are DocumentBuilderFactory attributes not DOM attributes */
@@ -191,6 +191,9 @@ public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory {
public void setFeature(String name, boolean value)
throws ParserConfigurationException {
+ if (features == null) {
+ features = new Hashtable();
+ }
// If this is the secure processing feature, save it then return.
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
if (System.getSecurityManager() != null && (!value)) {
@@ -199,11 +202,10 @@ public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory {
"jaxp-secureprocessing-feature", null));
}
fSecureProcess = value;
+ features.put(name, value ? Boolean.TRUE : Boolean.FALSE);
return;
}
- if (features == null) {
- features = new Hashtable();
- }
+
features.put(name, value ? Boolean.TRUE : Boolean.FALSE);
// Test the feature by possibly throwing SAX exceptions
try {
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java
index 84bab42cbc5..39112a61f64 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java
@@ -27,6 +27,7 @@ import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.validation.Schema;
+import javax.xml.XMLConstants;
import com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl;
import com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter;
@@ -42,6 +43,7 @@ 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.XMLDocumentSource;
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
+import javax.xml.XMLConstants;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.xml.sax.EntityResolver;
@@ -95,6 +97,12 @@ public class DocumentBuilderImpl extends DocumentBuilder
private static final String SECURITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
+ /** property identifier: access external dtd. */
+ public static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD;
+
+ /** Property identifier: access to external schema */
+ public static final String ACCESS_EXTERNAL_SCHEMA = XMLConstants.ACCESS_EXTERNAL_SCHEMA;
+
private final DOMParser domParser;
private final Schema grammar;
@@ -155,6 +163,23 @@ public class DocumentBuilderImpl extends DocumentBuilder
// If the secure processing feature is on set a security manager.
if (secureProcessing) {
domParser.setProperty(SECURITY_MANAGER, new SecurityManager());
+
+ /**
+ * By default, secure processing is set, no external access is allowed.
+ * However, we need to check if it is actively set on the factory since we
+ * allow the use of the System Property or jaxp.properties to override
+ * the default value
+ */
+ if (features != null) {
+ Object temp = features.get(XMLConstants.FEATURE_SECURE_PROCESSING);
+ if (temp != null) {
+ boolean value = ((Boolean) temp).booleanValue();
+ if (value) {
+ domParser.setProperty(ACCESS_EXTERNAL_DTD, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
+ domParser.setProperty(ACCESS_EXTERNAL_SCHEMA, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
+ }
+ }
+ }
}
this.grammar = dbf.getSchema();
@@ -211,6 +236,10 @@ public class DocumentBuilderImpl extends DocumentBuilder
String feature = (String) entry.getKey();
boolean value = ((Boolean) entry.getValue()).booleanValue();
domParser.setFeature(feature, value);
+ if (feature.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+ domParser.setProperty(ACCESS_EXTERNAL_DTD, "");
+ domParser.setProperty(ACCESS_EXTERNAL_SCHEMA, "");
+ }
}
}
}
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java
index eecdc100344..ae9d99509d9 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java
@@ -43,7 +43,7 @@ import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
* @author Rajiv Mordani
* @author Edwin Goei
*
- * @version $Id: SAXParserFactoryImpl.java,v 1.7 2009/07/28 23:48:32 joehw Exp $
+ * @version $Id: SAXParserFactoryImpl.java,v 1.9 2010-11-01 04:40:06 joehw Exp $
*/
public class SAXParserFactoryImpl extends SAXParserFactory {
@@ -124,6 +124,7 @@ public class SAXParserFactoryImpl extends SAXParserFactory {
"jaxp-secureprocessing-feature", null));
}
fSecureProcess = value;
+ putInFeatures(name, value);
return;
}
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java
index 58d7d165d88..bbb609e9e28 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java
@@ -92,6 +92,12 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
private static final String SECURITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
+ /** property identifier: access external dtd. */
+ public static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD;
+
+ /** Property identifier: access to external schema */
+ public static final String ACCESS_EXTERNAL_SCHEMA = XMLConstants.ACCESS_EXTERNAL_SCHEMA;
+
private final JAXPSAXParser xmlReader;
private String schemaLanguage = null; // null means DTD
private final Schema grammar;
@@ -146,6 +152,22 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
// If the secure processing feature is on set a security manager.
if (secureProcessing) {
xmlReader.setProperty0(SECURITY_MANAGER, new SecurityManager());
+ /**
+ * By default, secure processing is set, no external access is allowed.
+ * However, we need to check if it is actively set on the factory since we
+ * allow the use of the System Property or jaxp.properties to override
+ * the default value
+ */
+ if (features != null) {
+ Object temp = features.get(XMLConstants.FEATURE_SECURE_PROCESSING);
+ if (temp != null) {
+ boolean value = ((Boolean) temp).booleanValue();
+ if (value) {
+ xmlReader.setProperty0(ACCESS_EXTERNAL_DTD, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
+ xmlReader.setProperty0(ACCESS_EXTERNAL_SCHEMA, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
+ }
+ }
+ }
}
// Set application's features, followed by validation features.
@@ -220,6 +242,10 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
String feature = (String) entry.getKey();
boolean value = ((Boolean) entry.getValue()).booleanValue();
xmlReader.setFeature0(feature, value);
+ if (feature.equals(XMLConstants.FEATURE_SECURE_PROCESSING) && value) {
+ xmlReader.setProperty0(ACCESS_EXTERNAL_DTD, "");
+ xmlReader.setProperty0(ACCESS_EXTERNAL_SCHEMA, "");
+ }
}
}
}
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java
index 696dd9e1bf6..25e13a7a5ce 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java
@@ -41,8 +41,15 @@ abstract class AbstractXMLSchema extends Schema implements
*/
private final HashMap fFeatures;
+ /**
+ * Map containing the initial values of properties for
+ * validators created using this grammar pool container.
+ */
+ private final HashMap fProperties;
+
public AbstractXMLSchema() {
fFeatures = new HashMap();
+ fProperties = new HashMap();
}
/*
@@ -77,11 +84,26 @@ abstract class AbstractXMLSchema extends Schema implements
}
/*
- * Other methods
+ * Set a feature on the schema
*/
-
- final void setFeature(String featureId, boolean state) {
+ public final void setFeature(String featureId, boolean state) {
fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE);
}
+ /**
+ * Returns the initial value of a property for validators created
+ * using this grammar pool container or null if the validators
+ * should use the default value.
+ */
+ public final Object getProperty(String propertyId) {
+ return fProperties.get(propertyId);
+ }
+
+ /*
+ * Set a property on the schema
+ */
+ public final void setProperty(String propertyId, Object state) {
+ fProperties.put(propertyId, state);
+ }
+
} // AbstractXMLSchema
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java
index 3919c0ca80f..1b4f6875611 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java
@@ -32,6 +32,7 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.XMLConstants;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
@@ -176,6 +177,8 @@ final class StreamValidatorHelper implements ValidatorHelper {
}
config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE));
config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER));
+ config.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
+ fComponentManager.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD));
config.setDocumentHandler(fSchemaValidator);
config.setDTDHandler(null);
config.setDTDContentModelHandler(null);
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java
index 2d9f2807910..e53118b2d4f 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java
@@ -675,6 +675,8 @@ final class ValidatorHandlerImpl extends ValidatorHandler implements
spf.setNamespaceAware(true);
try {
reader = spf.newSAXParser().getXMLReader();
+ reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
+ fComponentManager.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD));
// If this is a Xerces SAX parser, set the security manager if there is one
if (reader instanceof com.sun.org.apache.xerces.internal.parsers.SAXParser) {
SecurityManager securityManager = (SecurityManager) fComponentManager.getProperty(SECURITY_MANAGER);
@@ -685,6 +687,8 @@ final class ValidatorHandlerImpl extends ValidatorHandler implements
// Ignore the exception if the security manager cannot be set.
catch (SAXException exc) {}
}
+ reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
+ fComponentManager.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD));
}
} catch( Exception e ) {
// this is impossible, but better safe than sorry
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java
index fece15d7697..4cac487362f 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java
@@ -45,6 +45,7 @@ import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.StAXInputSource;
import com.sun.org.apache.xerces.internal.util.Status;
import com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl;
+import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription;
@@ -82,6 +83,12 @@ public final class XMLSchemaFactory extends SchemaFactory {
private static final String SECURITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
+ /** property identifier: access external dtd. */
+ public static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD;
+
+ /** Property identifier: access to external schema */
+ public static final String ACCESS_EXTERNAL_SCHEMA = XMLConstants.ACCESS_EXTERNAL_SCHEMA;
+
//
// Data
//
@@ -132,6 +139,14 @@ public final class XMLSchemaFactory extends SchemaFactory {
// Enable secure processing feature by default
fSecurityManager = new SecurityManager();
fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
+
+ //by default, the secure feature is set to true, otherwise the default would have been 'file'
+ String accessExternal = SecuritySupport.getDefaultAccessProperty(
+ Constants.SP_ACCESS_EXTERNAL_DTD, Constants.EXTERNAL_ACCESS_DEFAULT);
+ fXMLSchemaLoader.setProperty(ACCESS_EXTERNAL_DTD, accessExternal);
+ accessExternal = SecuritySupport.getDefaultAccessProperty(
+ Constants.SP_ACCESS_EXTERNAL_SCHEMA, Constants.EXTERNAL_ACCESS_DEFAULT);
+ fXMLSchemaLoader.setProperty(ACCESS_EXTERNAL_SCHEMA, accessExternal);
}
/**
@@ -274,6 +289,7 @@ public final class XMLSchemaFactory extends SchemaFactory {
// Use a Schema that uses the system id as the equality source.
AbstractXMLSchema schema = new WeakReferenceXMLSchema();
propagateFeatures(schema);
+ propagateProperties(schema);
return schema;
}
@@ -350,6 +366,8 @@ public final class XMLSchemaFactory extends SchemaFactory {
}
fSecurityManager = value ? new SecurityManager() : null;
fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
+ fXMLSchemaLoader.setProperty(ACCESS_EXTERNAL_DTD, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
+ fXMLSchemaLoader.setProperty(ACCESS_EXTERNAL_SCHEMA, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
return;
} else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
//in secure mode, let _useServicesMechanism be determined by the constructor
@@ -418,6 +436,15 @@ public final class XMLSchemaFactory extends SchemaFactory {
}
}
+ private void propagateProperties(AbstractXMLSchema schema) {
+ String[] properties = fXMLSchemaLoader.getRecognizedProperties();
+ for (int i = 0; i < properties.length; ++i) {
+ Object state = fXMLSchemaLoader.getProperty(properties[i]);
+ schema.setProperty(properties[i], state);
+ }
+ }
+
+
/**
* Extension of XMLGrammarPoolImpl which exposes the number of
* grammars stored in the grammar pool.
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java
index bc4bdefb413..241d02cbf85 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java
@@ -123,6 +123,12 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin
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
//
@@ -243,6 +249,9 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin
}
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));
}
/**
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XSGrammarPoolContainer.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XSGrammarPoolContainer.java
index 0246f37380c..79ef5593b06 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XSGrammarPoolContainer.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XSGrammarPoolContainer.java
@@ -55,4 +55,21 @@ public interface XSGrammarPoolContainer {
*/
public Boolean getFeature(String featureId);
+ /*
+ * Set a feature on the schema
+ */
+ public void setFeature(String featureId, boolean state);
+
+ /**
+ * Returns the initial value of a property for validators created
+ * using this grammar pool container or null if the validators
+ * should use the default value.
+ */
+ public Object getProperty(String propertyId);
+
+ /*
+ * Set a property on the schema
+ */
+ public void setProperty(String propertyId, Object state);
+
}
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java
index 72acd0a20f8..32ac6a86d78 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java
@@ -20,10 +20,13 @@
package com.sun.org.apache.xerces.internal.parsers;
+import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
+import java.util.Properties;
+import javax.xml.XMLConstants;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl;
@@ -52,6 +55,7 @@ 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.Status;
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.XMLDTDContentModelHandler;
import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
@@ -274,6 +278,12 @@ public class XML11Configuration extends ParserConfigurationSettings
protected static final String SCHEMA_DV_FACTORY =
Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY;
+ /** Property identifier: access to external dtd */
+ protected static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD;
+
+ /** Property identifier: access to external schema */
+ protected static final String ACCESS_EXTERNAL_SCHEMA = XMLConstants.ACCESS_EXTERNAL_SCHEMA;
+
// debugging
/** Set to true and recompile to print exception stack trace. */
@@ -475,7 +485,8 @@ public class XML11Configuration extends ParserConfigurationSettings
XMLSCHEMA_VALIDATION, XMLSCHEMA_FULL_CHECKING,
EXTERNAL_GENERAL_ENTITIES,
EXTERNAL_PARAMETER_ENTITIES,
- PARSER_SETTINGS
+ PARSER_SETTINGS,
+ XMLConstants.FEATURE_SECURE_PROCESSING
};
addRecognizedFeatures(recognizedFeatures);
// set state for default features
@@ -488,30 +499,31 @@ public class XML11Configuration extends ParserConfigurationSettings
fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.TRUE);
fFeatures.put(NORMALIZE_DATA, Boolean.TRUE);
fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE);
- fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
- fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE);
- fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE);
- fFeatures.put(NAMESPACE_GROWTH, Boolean.FALSE);
- fFeatures.put(TOLERATE_DUPLICATES, Boolean.FALSE);
- fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE);
+ fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
+ fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE);
+ fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE);
+ fFeatures.put(NAMESPACE_GROWTH, Boolean.FALSE);
+ fFeatures.put(TOLERATE_DUPLICATES, Boolean.FALSE);
+ fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE);
fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
+ fFeatures.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
// add default recognized properties
final String[] recognizedProperties =
{
- SYMBOL_TABLE,
- ERROR_HANDLER,
- ENTITY_RESOLVER,
+ SYMBOL_TABLE,
+ ERROR_HANDLER,
+ ENTITY_RESOLVER,
ERROR_REPORTER,
ENTITY_MANAGER,
DOCUMENT_SCANNER,
DTD_SCANNER,
DTD_PROCESSOR,
DTD_VALIDATOR,
- DATATYPE_VALIDATOR_FACTORY,
- VALIDATION_MANAGER,
- SCHEMA_VALIDATOR,
- XML_STRING,
+ DATATYPE_VALIDATOR_FACTORY,
+ VALIDATION_MANAGER,
+ SCHEMA_VALIDATOR,
+ XML_STRING,
XMLGRAMMAR_POOL,
JAXP_SCHEMA_SOURCE,
JAXP_SCHEMA_LANGUAGE,
@@ -523,18 +535,20 @@ public class XML11Configuration extends ParserConfigurationSettings
SCHEMA_NONS_LOCATION,
LOCALE,
SCHEMA_DV_FACTORY,
+ ACCESS_EXTERNAL_DTD,
+ ACCESS_EXTERNAL_SCHEMA
};
addRecognizedProperties(recognizedProperties);
- if (symbolTable == null) {
- symbolTable = new SymbolTable();
- }
- fSymbolTable = symbolTable;
- fProperties.put(SYMBOL_TABLE, fSymbolTable);
+ if (symbolTable == null) {
+ symbolTable = new SymbolTable();
+ }
+ fSymbolTable = symbolTable;
+ fProperties.put(SYMBOL_TABLE, fSymbolTable);
fGrammarPool = grammarPool;
if (fGrammarPool != null) {
- fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);
+ fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);
}
fEntityManager = new XMLEntityManager();
@@ -570,6 +584,15 @@ public class XML11Configuration extends ParserConfigurationSettings
fVersionDetector = new XMLVersionDetector();
+ //FEATURE_SECURE_PROCESSING is true, see the feature above
+ String accessExternal = SecuritySupport.getDefaultAccessProperty(
+ Constants.SP_ACCESS_EXTERNAL_DTD, Constants.EXTERNAL_ACCESS_DEFAULT);
+ fProperties.put(ACCESS_EXTERNAL_DTD, accessExternal);
+
+ accessExternal = SecuritySupport.getDefaultAccessProperty(
+ Constants.SP_ACCESS_EXTERNAL_SCHEMA, Constants.EXTERNAL_ACCESS_DEFAULT);
+ fProperties.put(ACCESS_EXTERNAL_SCHEMA, accessExternal);
+
// add message formatters
if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
XMLMessageFormatter xmft = new XMLMessageFormatter();
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java b/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
index b1d9d870412..7b6d1d553d8 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
@@ -23,14 +23,16 @@ 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;
@@ -195,5 +197,141 @@ public final class SecuritySupport {
})).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.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(":"));
+ }
+ }
+
+ 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) {
+ String temp[] = allowedProtocols.split(",");
+ for (String t : temp) {
+ t = t.trim();
+ if (t.equalsIgnoreCase(protocol)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Read from $java.home/lib/jaxp.properties for the specified property
+ *
+ * @param propertyId the Id of the property
+ * @return the value of the property
+ */
+ public static String getDefaultAccessProperty(String sysPropertyId, String defaultVal) {
+ String accessExternal = SecuritySupport.getSystemProperty(sysPropertyId);
+ if (accessExternal == null) {
+ accessExternal = readJAXPProperty(sysPropertyId);
+ if (accessExternal == null) {
+ accessExternal = defaultVal;
+ }
+ }
+ return accessExternal;
+ }
+
+ /**
+ * Read from $java.home/lib/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 +
+ "lib" + 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/lib/jaxp.properties
+ */
+ static final Properties cacheProps = new Properties();
+
+ /**
+ * Flag indicating if the program has tried reading java.home/lib/jaxp.properties
+ */
+ static volatile boolean firstTime = true;
+
private SecuritySupport () {}
}
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java b/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java
index 347ae24e446..4f5a0a5aba0 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java
@@ -26,6 +26,7 @@ import java.util.Enumeration;
import java.util.Locale;
import java.util.Stack;
import java.util.StringTokenizer;
+import javax.xml.XMLConstants;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
@@ -229,6 +230,14 @@ public class XIncludeHandler
protected static final String PARSER_SETTINGS =
Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;
+ /** property identifier: access external dtd. */
+ protected static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD;
+
+ /** access external dtd: file protocol
+ * For DOM/SAX, the secure feature is set to true by default
+ */
+ final static String EXTERNAL_ACCESS_DEFAULT = Constants.EXTERNAL_ACCESS_DEFAULT;
+
/** Recognized features. */
private static final String[] RECOGNIZED_FEATURES =
{ ALLOW_UE_AND_NOTATION_EVENTS, XINCLUDE_FIXUP_BASE_URIS, XINCLUDE_FIXUP_LANGUAGE };
@@ -283,6 +292,12 @@ public class XIncludeHandler
protected XMLErrorReporter fErrorReporter;
protected XMLEntityResolver fEntityResolver;
protected SecurityManager fSecurityManager;
+ /**
+ * comma-delimited list of protocols that are allowed for the purpose
+ * of accessing external dtd or entity references
+ */
+ protected String fAccessExternalDTD = EXTERNAL_ACCESS_DEFAULT;
+
// these are needed for text include processing
protected XIncludeTextReader fXInclude10TextReader;
@@ -523,6 +538,8 @@ public class XIncludeHandler
fSecurityManager = null;
}
+ fAccessExternalDTD = (String)componentManager.getProperty(ACCESS_EXTERNAL_DTD);
+
// Get buffer size.
try {
Integer value =
@@ -664,6 +681,14 @@ public class XIncludeHandler
}
return;
}
+ if (propertyId.equals(ACCESS_EXTERNAL_DTD)) {
+ fAccessExternalDTD = (String)value;
+ if (fChildConfig != null) {
+ fChildConfig.setProperty(propertyId, value);
+ }
+ return;
+ }
+
if (propertyId.equals(BUFFER_SIZE)) {
Integer bufferSize = (Integer) value;
if (fChildConfig != null) {
@@ -1578,6 +1603,7 @@ public class XIncludeHandler
if (fErrorReporter != null) fChildConfig.setProperty(ERROR_REPORTER, fErrorReporter);
if (fEntityResolver != null) fChildConfig.setProperty(ENTITY_RESOLVER, fEntityResolver);
fChildConfig.setProperty(SECURITY_MANAGER, fSecurityManager);
+ fChildConfig.setProperty(ACCESS_EXTERNAL_DTD, fAccessExternalDTD);
fChildConfig.setProperty(BUFFER_SIZE, new Integer(fBufferSize));
// features must be copied to child configuration
@@ -1691,7 +1717,7 @@ public class XIncludeHandler
if (fErrorReporter != null) {
fErrorReporter.setDocumentLocator(fDocLocation);
}
- reportFatalError("XMLParseError", new Object[] { href });
+ reportFatalError("XMLParseError", new Object[] { href, e.getMessage() });
}
catch (IOException e) {
// necessary to make sure proper location is reported in errors
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java b/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java
index 20ed918f909..8f79f869cb2 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java
@@ -22,17 +22,17 @@
*/
package com.sun.org.apache.xml.internal.utils;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+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 java.util.HashMap;
-
+import javax.xml.XMLConstants;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
-
+import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
-import org.xml.sax.SAXException;
/**
* Creates XMLReader objects and caches them for re-use.
@@ -63,6 +63,11 @@ public class XMLReaderManager {
private HashMap m_inUse;
private boolean m_useServicesMechanism = true;
+ /**
+ * protocols allowed for external DTD references in source file and/or stylesheet.
+ */
+ private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
+
/**
* Hidden constructor
*/
@@ -131,6 +136,7 @@ public class XMLReaderManager {
try {
reader.setFeature(NAMESPACES_FEATURE, true);
reader.setFeature(NAMESPACE_PREFIXES_FEATURE, false);
+ reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
} catch (SAXException se) {
// Try to carry on if we've got a parser that
// doesn't know about namespace prefixes.
@@ -181,4 +187,22 @@ public class XMLReaderManager {
m_useServicesMechanism = flag;
}
+ /**
+ * Get property value
+ */
+ public String getProperty(String name) {
+ if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
+ return _accessExternalDTD;
+ }
+ return null;
+ }
+
+ /**
+ * Set property.
+ */
+ public void setProperty(String name, String value) {
+ if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
+ _accessExternalDTD = (String)value;
+ }
+ }
}
diff --git a/jaxp/src/com/sun/xml/internal/stream/StaxXMLInputSource.java b/jaxp/src/com/sun/xml/internal/stream/StaxXMLInputSource.java
index 351693f1472..106f9f9d227 100644
--- a/jaxp/src/com/sun/xml/internal/stream/StaxXMLInputSource.java
+++ b/jaxp/src/com/sun/xml/internal/stream/StaxXMLInputSource.java
@@ -43,6 +43,9 @@ public class StaxXMLInputSource {
XMLEventReader fEventReader ;
XMLInputSource fInputSource ;
+ //indicate if the source is resolved by a resolver
+ boolean fHasResolver = false;
+
/** Creates a new instance of StaxXMLInputSource */
public StaxXMLInputSource(XMLStreamReader streamReader) {
fStreamReader = streamReader ;
@@ -57,6 +60,12 @@ public class StaxXMLInputSource {
fInputSource = inputSource ;
}
+
+ public StaxXMLInputSource(XMLInputSource inputSource, boolean hasResolver){
+ fInputSource = inputSource ;
+ fHasResolver = hasResolver;
+ }
+
public XMLStreamReader getXMLStreamReader(){
return fStreamReader ;
}
@@ -72,4 +81,8 @@ public class StaxXMLInputSource {
public boolean hasXMLStreamOrXMLEventReader(){
return (fStreamReader == null) && (fEventReader == null) ? false : true ;
}
+
+ public boolean hasResolver() {
+ return fHasResolver;
+ }
}
diff --git a/jaxp/src/javax/xml/XMLConstants.java b/jaxp/src/javax/xml/XMLConstants.java
index 2e570f1de7b..b923a6cbf02 100644
--- a/jaxp/src/javax/xml/XMLConstants.java
+++ b/jaxp/src/javax/xml/XMLConstants.java
@@ -73,7 +73,7 @@ public final class XMLConstants {
* The official XML Namespace name URI.
*
* Defined by the XML specification to be
- * "http://www.w3.org/XML/1998/namespace
".
+ * "{@code http://www.w3.org/XML/1998/namespace}".
*
* @see
@@ -85,7 +85,7 @@ public final class XMLConstants {
/**
* The official XML Namespace prefix.
*
- * Defined by the XML specification to be "xml
".
+ * Defined by the XML specification to be "{@code xml}".
*
* @see
@@ -99,7 +99,7 @@ public final class XMLConstants {
* XMLConstants.XMLNS_ATTRIBUTE}, Namespace name URI.
*
* Defined by the XML specification to be
- * "http://www.w3.org/2000/xmlns/
".
+ * "{@code http://www.w3.org/2000/xmlns/}".
*
* @see
@@ -117,7 +117,7 @@ public final class XMLConstants {
*
* It is NOT valid to use as a
* prefix. Defined by the XML specification to be
- * "xmlns
".
+ * "{@code xmlns}".
*
* @see
@@ -128,7 +128,7 @@ public final class XMLConstants {
/**
* W3C XML Schema Namespace URI.
*
- * Defined to be "http://www.w3.org/2001/XMLSchema
".
+ *
Defined to be "{@code http://www.w3.org/2001/XMLSchema}".
*
* @see
@@ -141,7 +141,7 @@ public final class XMLConstants {
/**
* W3C XML Schema Instance Namespace URI.
*
- * Defined to be "http://www.w3.org/2001/XMLSchema-instance
".
+ * Defined to be "{@code http://www.w3.org/2001/XMLSchema-instance}".
*
* @see
@@ -154,7 +154,7 @@ public final class XMLConstants {
/**
* W3C XPath Datatype Namespace URI.
*
- * Defined to be "http://www.w3.org/2003/11/xpath-datatypes
".
+ * Defined to be "{@code http://www.w3.org/2003/11/xpath-datatypes}".
*
* @see XQuery 1.0 and XPath 2.0 Data Model
*/
@@ -163,14 +163,14 @@ public final class XMLConstants {
/**
*
XML Document Type Declaration Namespace URI as an arbitrary value.
*
- * Since not formally defined by any existing standard, arbitrarily define to be "http://www.w3.org/TR/REC-xml
".
+ *
Since not formally defined by any existing standard, arbitrarily define to be "{@code http://www.w3.org/TR/REC-xml}".
*/
public static final String XML_DTD_NS_URI = "http://www.w3.org/TR/REC-xml";
/**
*
RELAX NG Namespace URI.
*
- * Defined to be "http://relaxng.org/ns/structure/1.0
".
+ * Defined to be "{@code http://relaxng.org/ns/structure/1.0}".
*
* @see RELAX NG Specification
*/
@@ -181,14 +181,212 @@ public final class XMLConstants {
*
*
* -
- *
true
instructs the implementation to process XML securely.
+ * {@code true} instructs the implementation to process XML securely.
* This may set limits on XML constructs to avoid conditions such as denial of service attacks.
*
* -
- *
false
instructs the implementation to process XML acording the letter of the XML specifications
- * ingoring security issues such as limits on XML constructs to avoid conditions such as denial of service attacks.
+ * {@code false} instructs the implementation to process XML in accordance with the XML specifications
+ * ignoring security issues such as limits on XML constructs to avoid conditions such as denial of service attacks.
*
*
*/
public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing";
+
+
+ /**
+ * Property: accessExternalDTD
+ *
+ *
+ * Restrict access to external DTDs and external Entity References to the protocols specified.
+ * If access is denied due to the restriction of this property, a runtime exception that
+ * is specific to the context is thrown. In the case of {@link javax.xml.parsers.SAXParser}
+ * for example, {@link org.xml.sax.SAXException} is thrown.
+ *
+ *
+ *
+ * Value: a list of protocols separated by comma. A protocol is the scheme portion of a
+ * {@link java.net.URI}, or in the case of the JAR protocol, "jar" plus the scheme portion
+ * separated by colon.
+ * A scheme is defined as:
+ *
+ *
+ * scheme = alpha *( alpha | digit | "+" | "-" | "." )
+ * where alpha = a-z and A-Z.
+ *
+ * And the JAR protocol:
+ *
+ * jar[:scheme]
+ *
+ * Protocols including the keyword "jar" are case-insensitive. Any whitespaces as defined by
+ * {@link java.lang.Character#isSpaceChar } in the value will be ignored.
+ * Examples of protocols are file, http, jar:file.
+ *
+ *
+ *
+ *
+ *
+ * Default value: The default value is implementation specific and therefore not specified.
+ * The following options are provided for consideration:
+ *
+ *
+ * - an empty string to deny all access to external references;
+ * - a specific protocol, such as file, to give permission to only the protocol;
+ * - the keyword "all" to grant permission to all protocols.
+ *
+ * When FEATURE_SECURE_PROCESSING is enabled, it is recommended that implementations
+ * restrict external connections by default, though this may cause problems for applications
+ * that process XML/XSD/XSL with external references.
+ *
+ *
+ *
+ *
+ * Granting all access: the keyword "all" grants permission to all protocols.
+ *
+ *
+ * System Property: The value of this property can be set or overridden by
+ * system property {@code javax.xml.accessExternalDTD}.
+ *
+ *
+ *
+ * ${JAVA_HOME}/lib/jaxp.properties: This configuration file is in standard
+ * {@link java.util.Properties} format. If the file exists and the system property is specified,
+ * its value will be used to override the default of the property.
+ *
+ *
+ *
+ *
+ *
+ * @since 1.7
+ */
+ public static final String ACCESS_EXTERNAL_DTD = "http://javax.xml.XMLConstants/property/accessExternalDTD";
+
+ /**
+ * Property: accessExternalSchema
+ *
+ *
+ * Restrict access to the protocols specified for external reference set by the
+ * schemaLocation attribute, Import and Include element. If access is denied
+ * due to the restriction of this property, a runtime exception that is specific
+ * to the context is thrown. In the case of {@link javax.xml.validation.SchemaFactory}
+ * for example, org.xml.sax.SAXException is thrown.
+ *
+ *
+ * Value: a list of protocols separated by comma. A protocol is the scheme portion of a
+ * {@link java.net.URI}, or in the case of the JAR protocol, "jar" plus the scheme portion
+ * separated by colon.
+ * A scheme is defined as:
+ *
+ *
+ * scheme = alpha *( alpha | digit | "+" | "-" | "." )
+ * where alpha = a-z and A-Z.
+ *
+ * And the JAR protocol:
+ *
+ * jar[:scheme]
+ *
+ * Protocols including the keyword "jar" are case-insensitive. Any whitespaces as defined by
+ * {@link java.lang.Character#isSpaceChar } in the value will be ignored.
+ * Examples of protocols are file, http, jar:file.
+ *
+ *
+ *
+ *
+ *
+ * Default value: The default value is implementation specific and therefore not specified.
+ * The following options are provided for consideration:
+ *
+ *
+ * - an empty string to deny all access to external references;
+ * - a specific protocol, such as file, to give permission to only the protocol;
+ * - the keyword "all" to grant permission to all protocols.
+ *
+ * When FEATURE_SECURE_PROCESSING is enabled, it is recommended that implementations
+ * restrict external connections by default, though this may cause problems for applications
+ * that process XML/XSD/XSL with external references.
+ *
+ *
+ *
+ * Granting all access: the keyword "all" grants permission to all protocols.
+ *
+ *
+ *
+ * System Property: The value of this property can be set or overridden by
+ * system property {@code javax.xml.accessExternalSchema}
+ *
+ *
+ *
+ * ${JAVA_HOME}/lib/jaxp.properties: This configuration file is in standard
+ * java.util.Properties format. If the file exists and the system property is specified,
+ * its value will be used to override the default of the property.
+ *
+ * @since 1.7
+ *
+ */
+ public static final String ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema";
+
+ /**
+ * Property: accessExternalStylesheet
+ *
+ *
+ * Restrict access to the protocols specified for external references set by the
+ * stylesheet processing instruction, Import and Include element, and document function.
+ * If access is denied due to the restriction of this property, a runtime exception
+ * that is specific to the context is thrown. In the case of constructing new
+ * {@link javax.xml.transform.Transformer} for example,
+ * {@link javax.xml.transform.TransformerConfigurationException}
+ * will be thrown by the {@link javax.xml.transform.TransformerFactory}.
+ *
+ *
+ * Value: a list of protocols separated by comma. A protocol is the scheme portion of a
+ * {@link java.net.URI}, or in the case of the JAR protocol, "jar" plus the scheme portion
+ * separated by colon.
+ * A scheme is defined as:
+ *
+ *
+ * scheme = alpha *( alpha | digit | "+" | "-" | "." )
+ * where alpha = a-z and A-Z.
+ *
+ * And the JAR protocol:
+ *
+ * jar[:scheme]
+ *
+ * Protocols including the keyword "jar" are case-insensitive. Any whitespaces as defined by
+ * {@link java.lang.Character#isSpaceChar } in the value will be ignored.
+ * Examples of protocols are file, http, jar:file.
+ *
+ *
+ *
+ *
+ *
+ * Default value: The default value is implementation specific and therefore not specified.
+ * The following options are provided for consideration:
+ *
+ *
+ * - an empty string to deny all access to external references;
+ * - a specific protocol, such as file, to give permission to only the protocol;
+ * - the keyword "all" to grant permission to all protocols.
+ *
+ * When FEATURE_SECURE_PROCESSING is enabled, it is recommended that implementations
+ * restrict external connections by default, though this may cause problems for applications
+ * that process XML/XSD/XSL with external references.
+ *
+ *
+ *
+ * Granting all access: the keyword "all" grants permission to all protocols.
+ *
+ *
+ *
+ * System Property: The value of this property can be set or overridden by
+ * system property {@code javax.xml.accessExternalStylesheet}
+ *
+ *
+ *
+ * ${JAVA_HOME}/lib/jaxp.properties: This configuration file is in standard
+ * java.util.Properties format. If the file exists and the system property is specified,
+ * its value will be used to override the default of the property.
+ *
+ * @since 1.7
+ */
+ public static final String ACCESS_EXTERNAL_STYLESHEET = "http://javax.xml.XMLConstants/property/accessExternalStylesheet";
+
}
diff --git a/jaxp/src/javax/xml/parsers/DocumentBuilderFactory.java b/jaxp/src/javax/xml/parsers/DocumentBuilderFactory.java
index 0ef1c13cecb..748a1636f0a 100644
--- a/jaxp/src/javax/xml/parsers/DocumentBuilderFactory.java
+++ b/jaxp/src/javax/xml/parsers/DocumentBuilderFactory.java
@@ -351,6 +351,31 @@ public abstract class DocumentBuilderFactory {
/**
* Allows the user to set specific attributes on the underlying
* implementation.
+ *
+ * All implementations that implement JAXP 1.5 or newer are required to
+ * support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} and
+ * {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} properties.
+ *
+ *
+ * -
+ *
+ * Setting the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} property
+ * restricts the access to external DTDs, external Entity References to the
+ * protocols specified by the property.
+ * If access is denied during parsing due to the restriction of this property,
+ * {@link org.xml.sax.SAXException} will be thrown by the parse methods defined by
+ * {@link javax.xml.parsers.DocumentBuilder}.
+ *
+ *
+ * Setting the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} property
+ * restricts the access to external Schema set by the schemaLocation attribute to
+ * the protocols specified by the property. If access is denied during parsing
+ * due to the restriction of this property, {@link org.xml.sax.SAXException}
+ * will be thrown by the parse methods defined by
+ * {@link javax.xml.parsers.DocumentBuilder}.
+ *
+ *
+ *
*
* @param name The name of the attribute.
* @param value The value of the attribute.
diff --git a/jaxp/src/javax/xml/parsers/SAXParser.java b/jaxp/src/javax/xml/parsers/SAXParser.java
index ef7b2e942c3..5461413eb41 100644
--- a/jaxp/src/javax/xml/parsers/SAXParser.java
+++ b/jaxp/src/javax/xml/parsers/SAXParser.java
@@ -441,6 +441,29 @@ public abstract class SAXParser {
* A list of the core features and properties can be found at
*
* http://sax.sourceforge.net/?selected=get-set.
+ *
+ * All implementations that implement JAXP 1.5 or newer are required to
+ * support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} and
+ * {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} properties.
+ *
+ *
+ * -
+ *
+ * Setting the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} property
+ * restricts the access to external DTDs, external Entity References to
+ * the protocols specified by the property. If access is denied during parsing
+ * due to the restriction of this property, {@link org.xml.sax.SAXException}
+ * will be thrown by the parse methods defined by {@link javax.xml.parsers.SAXParser}.
+ *
+ *
+ * Setting the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} property
+ * restricts the access to external Schema set by the schemaLocation attribute to
+ * the protocols specified by the property. If access is denied during parsing
+ * due to the restriction of this property, {@link org.xml.sax.SAXException}
+ * will be thrown by the parse methods defined by the {@link javax.xml.parsers.SAXParser}.
+ *
+ *
+ *
*
* @param name The name of the property to be set.
* @param value The value of the property to be set.
diff --git a/jaxp/src/javax/xml/stream/XMLInputFactory.java b/jaxp/src/javax/xml/stream/XMLInputFactory.java
index 2bfbad5d461..3e75f9ff1c9 100644
--- a/jaxp/src/javax/xml/stream/XMLInputFactory.java
+++ b/jaxp/src/javax/xml/stream/XMLInputFactory.java
@@ -433,9 +433,25 @@ public abstract class XMLInputFactory {
public abstract void setXMLReporter(XMLReporter reporter);
/**
- * Allows the user to set specific feature/property on the underlying implementation. The underlying implementation
- * is not required to support every setting of every property in the specification and may use IllegalArgumentException
- * to signal that an unsupported property may not be set with the specified value.
+ * Allows the user to set specific feature/property on the underlying
+ * implementation. The underlying implementation is not required to support
+ * every setting of every property in the specification and may use
+ * IllegalArgumentException to signal that an unsupported property may not be
+ * set with the specified value.
+ *
+ * All implementations that implement JAXP 1.5 or newer are required to
+ * support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} property.
+ *
+ *
+ * -
+ *
+ * Access to external DTDs, external Entity References is restricted to the
+ * protocols specified by the property. If access is denied during parsing
+ * due to the restriction of this property, {@link javax.xml.stream.XMLStreamException}
+ * will be thrown.
+ *
+ *
+ *
* @param name The name of the property (may not be null)
* @param value The value of the property
* @throws java.lang.IllegalArgumentException if the property is not supported
diff --git a/jaxp/src/javax/xml/transform/TransformerFactory.java b/jaxp/src/javax/xml/transform/TransformerFactory.java
index 61528855be6..9c4a076549d 100644
--- a/jaxp/src/javax/xml/transform/TransformerFactory.java
+++ b/jaxp/src/javax/xml/transform/TransformerFactory.java
@@ -325,6 +325,46 @@ public abstract class TransformerFactory {
* be an option that the implementation provides.
* An IllegalArgumentException
is thrown if the underlying
* implementation doesn't recognize the attribute.
+ *
+ * All implementations that implement JAXP 1.5 or newer are required to
+ * support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} and
+ * {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_STYLESHEET} properties.
+ *
+ *
+ * -
+ *
+ * Access to external DTDs in the source file is restricted to the protocols
+ * specified by the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} property.
+ * If access is denied during transformation due to the restriction of this property,
+ * {@link javax.xml.transform.TransformerException} will be thrown by
+ * {@link javax.xml.transform.Transformer#transform(Source, Result)}.
+ *
+ *
+ * Access to external DTDs in the stylesheet is restricted to the protocols
+ * specified by the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} property.
+ * If access is denied during the creation of a new transformer due to the
+ * restriction of this property,
+ * {@link javax.xml.transform.TransformerConfigurationException} will be thrown
+ * by the {@link #newTransformer(Source)} method.
+ *
+ *
+ * Access to external reference set by the stylesheet processing instruction,
+ * Import and Include element is restricted to the protocols specified by the
+ * {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_STYLESHEET} property.
+ * If access is denied during the creation of a new transformer due to the
+ * restriction of this property,
+ * {@link javax.xml.transform.TransformerConfigurationException} will be thrown
+ * by the {@link #newTransformer(Source)} method.
+ *
+ *
+ * Access to external document through XSLT document function is restricted
+ * to the protocols specified by the property. If access is denied during
+ * the transformation due to the restriction of this property,
+ * {@link javax.xml.transform.TransformerException} will be thrown by the
+ * {@link javax.xml.transform.Transformer#transform(Source, Result)} method.
+ *
+ *
+ *
*
* @param name The name of the attribute.
* @param value The value of the attribute.
diff --git a/jaxp/src/javax/xml/validation/SchemaFactory.java b/jaxp/src/javax/xml/validation/SchemaFactory.java
index 6f156af0ff5..d99f45011f7 100644
--- a/jaxp/src/javax/xml/validation/SchemaFactory.java
+++ b/jaxp/src/javax/xml/validation/SchemaFactory.java
@@ -390,8 +390,44 @@ public abstract class SchemaFactory {
* possible for a {@link SchemaFactory} to recognize a property name but
* to be unable to change the current value.
*
- * {@link SchemaFactory}s are not required to recognize setting
- * any specific property names.
+ *
+ * All implementations that implement JAXP 1.5 or newer are required to
+ * support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} and
+ * {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} properties.
+ *
+ *
+ * -
+ *
Access to external DTDs in Schema files is restricted to the protocols
+ * specified by the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} property.
+ * If access is denied during the creation of new Schema due to the restriction
+ * of this property, {@link org.xml.sax.SAXException} will be thrown by the
+ * {@link #newSchema(Source)} or {@link #newSchema(File)}
+ * or {@link #newSchema(URL)} or or {@link #newSchema(Source[])} method.
+ *
+ * Access to external DTDs in xml source files is restricted to the protocols
+ * specified by the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} property.
+ * If access is denied during validation due to the restriction
+ * of this property, {@link org.xml.sax.SAXException} will be thrown by the
+ * {@link javax.xml.validation.Validator#validate(Source)} or
+ * {@link javax.xml.validation.Validator#validate(Source, Result)} method.
+ *
+ * Access to external reference set by the schemaLocation attribute is
+ * restricted to the protocols specified by the
+ * {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} property.
+ * If access is denied during validation due to the restriction of this property,
+ * {@link org.xml.sax.SAXException} will be thrown by the
+ * {@link javax.xml.validation.Validator#validate(Source)} or
+ * {@link javax.xml.validation.Validator#validate(Source, Result)} method.
+ *
+ * Access to external reference set by the Import
+ * and Include element is restricted to the protocols specified by the
+ * {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} property.
+ * If access is denied during the creation of new Schema due to the restriction
+ * of this property, {@link org.xml.sax.SAXException} will be thrown by the
+ * {@link #newSchema(Source)} or {@link #newSchema(File)}
+ * or {@link #newSchema(URL)} or {@link #newSchema(Source[])} method.
+ *
+ *
*
* @param name The property name, which is a non-null fully-qualified URI.
* @param object The requested value for the property.
diff --git a/jaxp/src/javax/xml/validation/Validator.java b/jaxp/src/javax/xml/validation/Validator.java
index ee66a6d1f45..fad7c5ac4f0 100644
--- a/jaxp/src/javax/xml/validation/Validator.java
+++ b/jaxp/src/javax/xml/validation/Validator.java
@@ -440,8 +440,27 @@ public abstract class Validator {
* in specific contexts, such as before, during, or after
* a validation.
*
- * {@link Validator}s are not required to recognize setting
- * any specific property names.
+ *
+ * All implementations that implement JAXP 1.5 or newer are required to
+ * support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} and
+ * {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} properties.
+ *
+ *
+ * -
+ *
Access to external DTDs in source or Schema file is restricted to
+ * the protocols specified by the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD}
+ * property. If access is denied during validation due to the restriction
+ * of this property, {@link org.xml.sax.SAXException} will be thrown by the
+ * {@link #validate(Source)} method.
+ *
+ * Access to external reference set by the schemaLocation attribute is
+ * restricted to the protocols specified by the
+ * {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} property.
+ * If access is denied during validation due to the restriction of this property,
+ * {@link org.xml.sax.SAXException} will be thrown by the
+ * {@link #validate(Source)} method.
+ *
+ *
*
* @param name The property name, which is a non-null fully-qualified URI.
* @param object The requested value for the property.