diff -Nru jaxp.orig/build.properties jaxp/build.properties
--- openjdk.orig/jaxp/build.properties	2010-02-17 03:11:24.000000000 +0000
+++ openjdk/jaxp/build.properties	2011-02-11 16:56:51.000000000 +0000
@@ -77,6 +77,9 @@
 # Where patches to drop bundle sources live
 patches.dir=patches
 
+# Patches to apply
+jaxp_src.patch.list=6927050.patch
+
 # Sanity information
 sanity.info= Sanity Settings:${line.separator}\
   ant.home=${ant.home}${line.separator}\
diff -Nru jaxp.orig/patches/jaxp_src/6927050.patch jaxp/patches/jaxp_src/6927050.patch
--- openjdk.orig/jaxp/patches/jaxp_src/6927050.patch	1970-01-01 01:00:00.000000000 +0100
+++ openjdk/jaxp/patches/jaxp_src/6927050.patch	2011-02-11 16:54:43.000000000 +0000
@@ -0,0 +1,990 @@
+diff -Nru src/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java
+--- src/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java	2011-02-10 04:57:47.000000000 +0000
++++ src/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java	2011-02-11 16:48:41.000000000 +0000
+@@ -20,6 +20,8 @@
+ 
+ package com.sun.org.apache.xerces.internal.jaxp.validation;
+ 
++import java.util.HashMap;
++
+ import javax.xml.validation.Schema;
+ import javax.xml.validation.Validator;
+ import javax.xml.validation.ValidatorHandler;
+@@ -32,6 +34,16 @@
+ abstract class AbstractXMLSchema extends Schema implements
+         XSGrammarPoolContainer {
+ 
++    /**
++     * Map containing the initial values of features for
++     * validators created using this grammar pool container.
++     */
++    private final HashMap<String,Boolean> fFeatures;
++
++    public AbstractXMLSchema() {
++        fFeatures = new HashMap<String,Boolean>();
++    }
++
+     /*
+      * Schema methods
+      */
+@@ -50,4 +62,26 @@
+         return new ValidatorHandlerImpl(this);
+     }
+ 
++    /*
++     * XSGrammarPoolContainer methods
++     */
++
++    /**
++     * Returns the initial value of a feature for validators created
++     * using this grammar pool container or null if the validators
++     * should use the default value.
++     */
++    public final Boolean getFeature(String featureId) {
++        return fFeatures.get(featureId);
++    }
++
++    /*
++     * Other methods
++     */
++
++    final void setFeature(String featureId, boolean state) {
++        fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE);
++    }
++
++
+ } // AbstractXMLSchema
+diff -Nru src/com/sun/org/apache/xerces/internal/jaxp/validation/EmptyXMLSchema.java src/com/sun/org/apache/xerces/internal/jaxp/validation/EmptyXMLSchema.java
+--- src/com/sun/org/apache/xerces/internal/jaxp/validation/EmptyXMLSchema.java	2011-02-10 04:57:47.000000000 +0000
++++ src/com/sun/org/apache/xerces/internal/jaxp/validation/EmptyXMLSchema.java	2011-02-11 16:48:41.000000000 +0000
+@@ -32,17 +32,10 @@
+  */
+ final class EmptyXMLSchema extends AbstractXMLSchema implements XMLGrammarPool {
+ 
+-    private static EmptyXMLSchema EMPTY_XML_SCHEMA_INSTANCE = new EmptyXMLSchema();
+-
+     /** Zero length grammar array. */
+     private static final Grammar [] ZERO_LENGTH_GRAMMAR_ARRAY = new Grammar [0];
+ 
+-    /** Returns the one and only instance of this class. */
+-    public static EmptyXMLSchema getInstance() {
+-        return EMPTY_XML_SCHEMA_INSTANCE;
+-    }
+-
+-    private EmptyXMLSchema() {}
++    public EmptyXMLSchema() {}
+ 
+     /*
+      * XMLGrammarPool methods
+diff -Nru src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java
+--- src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java	2011-02-10 04:57:47.000000000 +0000
++++ src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java	2011-02-11 16:49:57.000000000 +0000
+@@ -64,46 +64,46 @@
+  * @version $Id: XMLSchemaFactory.java,v 1.5 2009/07/28 23:48:30 joehw Exp $
+  */
+ public final class XMLSchemaFactory extends SchemaFactory {
+-    
++
+     // property identifiers
+-    
++
+     /** Feature identifier: schema full checking. */
+     private static final String SCHEMA_FULL_CHECKING =
+         Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_FULL_CHECKING;
+-    
++
+     /** Property identifier: grammar pool. */
+     private static final String XMLGRAMMAR_POOL =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
+-    
++
+     /** Property identifier: SecurityManager. */
+     private static final String SECURITY_MANAGER =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
+-    
++
+     //
+     // Data
+     //
+-    
++
+     /** The XMLSchemaLoader */
+     private final XMLSchemaLoader fXMLSchemaLoader = new XMLSchemaLoader();
+-    
++
+     /** User-specified ErrorHandler; can be null. */
+     private ErrorHandler fErrorHandler;
+-    
++
+     /** The LSResrouceResolver */
+     private LSResourceResolver fLSResourceResolver;
+-    
++
+     /** The DOMEntityResolverWrapper */
+     private final DOMEntityResolverWrapper fDOMEntityResolverWrapper;
+-    
++
+     /** The ErrorHandlerWrapper */
+     private ErrorHandlerWrapper fErrorHandlerWrapper;
+-    
++
+     /** The SecurityManager. */
+     private SecurityManager fSecurityManager;
+-    
+-    /** The container for the real grammar pool. */ 
++
++    /** The container for the real grammar pool. */
+     private XMLGrammarPoolWrapper fXMLGrammarPoolWrapper;
+-    
++
+     public XMLSchemaFactory() {
+         fErrorHandlerWrapper = new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
+         fDOMEntityResolverWrapper = new DOMEntityResolverWrapper();
+@@ -117,7 +117,7 @@
+         fSecurityManager = new SecurityManager();
+         fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
+     }
+-    
++
+     /**
+      * <p>Is specified schema supported by this <code>SchemaFactory</code>?</p>
+      *
+@@ -132,43 +132,43 @@
+      */
+     public boolean isSchemaLanguageSupported(String schemaLanguage) {
+         if (schemaLanguage == null) {
+-            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
++            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+                     "SchemaLanguageNull", null));
+         }
+         if (schemaLanguage.length() == 0) {
+-            throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
++            throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+                     "SchemaLanguageLengthZero", null));
+         }
+-        // only W3C XML Schema 1.0 is supported 
++        // only W3C XML Schema 1.0 is supported
+         return schemaLanguage.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+     }
+-    
++
+     public LSResourceResolver getResourceResolver() {
+         return fLSResourceResolver;
+     }
+-    
++
+     public void setResourceResolver(LSResourceResolver resourceResolver) {
+         fLSResourceResolver = resourceResolver;
+         fDOMEntityResolverWrapper.setEntityResolver(resourceResolver);
+         fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
+     }
+-    
++
+     public ErrorHandler getErrorHandler() {
+         return fErrorHandler;
+     }
+-    
++
+     public void setErrorHandler(ErrorHandler errorHandler) {
+         fErrorHandler = errorHandler;
+         fErrorHandlerWrapper.setErrorHandler(errorHandler != null ? errorHandler : DraconianErrorHandler.getInstance());
+         fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);
+-    }  
+-    
++    }
++
+     public Schema newSchema( Source[] schemas ) throws SAXException {
+-        
++
+         // this will let the loader store parsed Grammars into the pool.
+         XMLGrammarPoolImplExtension pool = new XMLGrammarPoolImplExtension();
+         fXMLGrammarPoolWrapper.setGrammarPool(pool);
+-        
++
+         XMLInputSource[] xmlInputSources = new XMLInputSource[schemas.length];
+         InputStream inputStream;
+         Reader reader;
+@@ -188,7 +188,7 @@
+                 SAXSource saxSource = (SAXSource) source;
+                 InputSource inputSource = saxSource.getInputSource();
+                 if (inputSource == null) {
+-                    throw new SAXException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
++                    throw new SAXException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+                             "SAXSourceNullInputSource", null));
+                 }
+                 xmlInputSources[i] = new SAXInputSource(saxSource.getXMLReader(), inputSource);
+@@ -196,60 +196,65 @@
+             else if (source instanceof DOMSource) {
+                 DOMSource domSource = (DOMSource) source;
+                 Node node = domSource.getNode();
+-                String systemID = domSource.getSystemId();          
++                String systemID = domSource.getSystemId();
+                 xmlInputSources[i] = new DOMInputSource(node, systemID);
+             }
+             else if (source == null) {
+-                throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
++                throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+                         "SchemaSourceArrayMemberNull", null));
+             }
+             else {
+-                throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
+-                        "SchemaFactorySourceUnrecognized", 
++                throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
++                        "SchemaFactorySourceUnrecognized",
+                         new Object [] {source.getClass().getName()}));
+             }
+         }
+-        
++
+         try {
+             fXMLSchemaLoader.loadGrammar(xmlInputSources);
+-        } 
++        }
+         catch (XNIException e) {
+             // this should have been reported to users already.
+             throw Util.toSAXException(e);
+-        } 
++        }
+         catch (IOException e) {
+             // this hasn't been reported, so do so now.
+             SAXParseException se = new SAXParseException(e.getMessage(),null,e);
+             fErrorHandler.error(se);
+             throw se; // and we must throw it.
+         }
+-        
++
+         // Clear reference to grammar pool.
+         fXMLGrammarPoolWrapper.setGrammarPool(null);
+-        
++
+         // Select Schema implementation based on grammar count.
+         final int grammarCount = pool.getGrammarCount();
++        AbstractXMLSchema schema = null;
+         if (grammarCount > 1) {
+-            return new XMLSchema(new ReadOnlyGrammarPool(pool));
++            schema = new XMLSchema(new ReadOnlyGrammarPool(pool));
+         }
+         else if (grammarCount == 1) {
+             Grammar[] grammars = pool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA);
+-            return new SimpleXMLSchema(grammars[0]);
++            schema = new SimpleXMLSchema(grammars[0]);
+         }
+         else {
+-            return EmptyXMLSchema.getInstance();
++            schema = new EmptyXMLSchema();
+         }
++        propagateFeatures(schema);
++        return schema;
+     }
+-    
++
+     public Schema newSchema() throws SAXException {
+         // Use a Schema that uses the system id as the equality source.
+-        return new WeakReferenceXMLSchema();
++        AbstractXMLSchema schema = new WeakReferenceXMLSchema();
++        propagateFeatures(schema);
++        return schema;
+     }
+-    
+-    public boolean getFeature(String name) 
++
++    public boolean getFeature(String name)
+         throws SAXNotRecognizedException, SAXNotSupportedException {
+         if (name == null) {
+-            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
++            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+                     "FeatureNameNull", null));
+         }
+         if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+@@ -262,21 +267,21 @@
+             String identifier = e.getIdentifier();
+             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
+                 throw new SAXNotRecognizedException(
+-                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
++                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                         "feature-not-recognized", new Object [] {identifier}));
+             }
+             else {
+                 throw new SAXNotSupportedException(
+-                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
++                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                         "feature-not-supported", new Object [] {identifier}));
+             }
+         }
+     }
+-    
+-    public Object getProperty(String name) 
++
++    public Object getProperty(String name)
+         throws SAXNotRecognizedException, SAXNotSupportedException {
+         if (name == null) {
+-            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
++            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+                     "ProperyNameNull", null));
+         }
+         if (name.equals(SECURITY_MANAGER)) {
+@@ -284,7 +289,7 @@
+         }
+         else if (name.equals(XMLGRAMMAR_POOL)) {
+             throw new SAXNotSupportedException(
+-                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
++                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                     "property-not-supported", new Object [] {name}));
+         }
+         try {
+@@ -294,27 +299,27 @@
+             String identifier = e.getIdentifier();
+             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
+                 throw new SAXNotRecognizedException(
+-                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
++                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                         "property-not-recognized", new Object [] {identifier}));
+             }
+             else {
+                 throw new SAXNotSupportedException(
+-                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
++                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                         "property-not-supported", new Object [] {identifier}));
+             }
+         }
+     }
+-    
++
+     public void setFeature(String name, boolean value)
+         throws SAXNotRecognizedException, SAXNotSupportedException {
+         if (name == null) {
+-            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
++            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+                     "FeatureNameNull", null));
+         }
+         if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+             if (System.getSecurityManager() != null && (!value)) {
+                 throw new SAXNotSupportedException(
+-                        SAXMessageFormatter.formatMessage(null, 
++                        SAXMessageFormatter.formatMessage(null,
+                         "jaxp-secureprocessing-feature", null));
+             }
+             fSecurityManager = value ? new SecurityManager() : null;
+@@ -328,21 +333,21 @@
+             String identifier = e.getIdentifier();
+             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
+                 throw new SAXNotRecognizedException(
+-                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
++                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                         "feature-not-recognized", new Object [] {identifier}));
+             }
+             else {
+                 throw new SAXNotSupportedException(
+-                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
++                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                         "feature-not-supported", new Object [] {identifier}));
+             }
+         }
+     }
+-    
++
+     public void setProperty(String name, Object object)
+         throws SAXNotRecognizedException, SAXNotSupportedException {
+         if (name == null) {
+-            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
++            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+                     "ProperyNameNull", null));
+         }
+         if (name.equals(SECURITY_MANAGER)) {
+@@ -352,7 +357,7 @@
+         }
+         else if (name.equals(XMLGRAMMAR_POOL)) {
+             throw new SAXNotSupportedException(
+-                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
++                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                     "property-not-supported", new Object [] {name}));
+         }
+         try {
+@@ -362,23 +367,32 @@
+             String identifier = e.getIdentifier();
+             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
+                 throw new SAXNotRecognizedException(
+-                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
++                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                         "property-not-recognized", new Object [] {identifier}));
+             }
+             else {
+                 throw new SAXNotSupportedException(
+-                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
++                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                         "property-not-supported", new Object [] {identifier}));
+             }
+         }
+     }
+-    
+-    /** 
++
++    private void propagateFeatures(AbstractXMLSchema schema) {
++        schema.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, fSecurityManager != null);
++        String[] features = fXMLSchemaLoader.getRecognizedFeatures();
++        for (int i = 0; i < features.length; ++i) {
++            boolean state = fXMLSchemaLoader.getFeature(features[i]);
++            schema.setFeature(features[i], state);
++        }
++    }
++
++    /**
+      * Extension of XMLGrammarPoolImpl which exposes the number of
+      * grammars stored in the grammar pool.
+      */
+     static class XMLGrammarPoolImplExtension extends XMLGrammarPoolImpl {
+-        
++
+         /** Constructs a grammar pool with a default number of buckets. */
+         public XMLGrammarPoolImplExtension() {
+             super();
+@@ -388,25 +402,25 @@
+         public XMLGrammarPoolImplExtension(int initialCapacity) {
+             super(initialCapacity);
+         }
+-        
++
+         /** Returns the number of grammars contained in this pool. */
+         int getGrammarCount() {
+             return fGrammarCount;
+         }
+-        
++
+     } // XMLSchemaFactory.XMLGrammarPoolImplExtension
+-    
++
+     /**
+      * A grammar pool which wraps another.
+      */
+     static class XMLGrammarPoolWrapper implements XMLGrammarPool {
+ 
+         private XMLGrammarPool fGrammarPool;
+-        
++
+         /*
+          * XMLGrammarPool methods
+          */
+-        
++
+         public Grammar[] retrieveInitialGrammarSet(String grammarType) {
+             return fGrammarPool.retrieveInitialGrammarSet(grammarType);
+         }
+@@ -430,19 +444,19 @@
+         public void clear() {
+             fGrammarPool.clear();
+         }
+-        
++
+         /*
+          * Other methods
+          */
+-        
++
+         void setGrammarPool(XMLGrammarPool grammarPool) {
+             fGrammarPool = grammarPool;
+         }
+-        
++
+         XMLGrammarPool getGrammarPool() {
+             return fGrammarPool;
+         }
+-        
++
+     } // XMLSchemaFactory.XMLGrammarPoolWrapper
+-    
++
+ } // XMLSchemaFactory
+diff -Nru src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java
+--- src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java	2011-02-10 04:57:47.000000000 +0000
++++ src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java	2011-02-11 16:52:41.000000000 +0000
+@@ -21,6 +21,8 @@
+ package com.sun.org.apache.xerces.internal.jaxp.validation;
+ 
+ import java.util.HashMap;
++import java.util.Iterator;
++import java.util.Map;
+ 
+ import javax.xml.XMLConstants;
+ 
+@@ -46,19 +48,19 @@
+ 
+ /**
+  * <p>An implementation of XMLComponentManager for a schema validator.</p>
+- * 
++ *
+  * @author Michael Glavassevich, IBM
+  * @version $Id: XMLSchemaValidatorComponentManager.java,v 1.5 2009/07/28 23:48:30 joehw Exp $
+  */
+ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettings implements
+         XMLComponentManager {
+-    
++
+     // feature identifiers
+-    
++
+     /** Feature identifier: schema validation. */
+     private static final String SCHEMA_VALIDATION =
+         Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE;
+-    
++
+     /** Feature identifier: validation. */
+     private static final String VALIDATION =
+         Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
+@@ -66,53 +68,53 @@
+     /** Feature identifier: send element default value via characters() */
+     private static final String SCHEMA_ELEMENT_DEFAULT =
+         Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_ELEMENT_DEFAULT;
+-    
++
+     /** Feature identifier: use grammar pool only. */
+     private static final String USE_GRAMMAR_POOL_ONLY =
+         Constants.XERCES_FEATURE_PREFIX + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE;
+-    
++
+     // property identifiers
+ 
+     /** Property identifier: entity manager. */
+     private static final String ENTITY_MANAGER =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
+-    
++
+     /** Property identifier: entity resolver. */
+     private static final String ENTITY_RESOLVER =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
+-    
++
+     /** Property identifier: error handler. */
+-    private static final String ERROR_HANDLER = 
++    private static final String ERROR_HANDLER =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
+-    
++
+     /** Property identifier: error reporter. */
+     private static final String ERROR_REPORTER =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
+-    
++
+     /** Property identifier: namespace context. */
+     private static final String NAMESPACE_CONTEXT =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_CONTEXT_PROPERTY;
+-    
++
+     /** Property identifier: XML Schema validator. */
+     private static final String SCHEMA_VALIDATOR =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_VALIDATOR_PROPERTY;
+-    
++
+     /** Property identifier: security manager. */
+     private static final String SECURITY_MANAGER =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
+-    
++
+     /** Property identifier: symbol table. */
+     private static final String SYMBOL_TABLE =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
+-    
++
+     /** Property identifier: validation manager. */
+     private static final String VALIDATION_MANAGER =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
+-    
++
+     /** Property identifier: grammar pool. */
+     private static final String XMLGRAMMAR_POOL =
+         Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
+-    
++
+     //
+     // Data
+     //
+@@ -120,69 +122,82 @@
+      * <p>State of secure mode.</p>
+      */
+     private boolean _isSecureMode = false;
+-    
+-    /** 
+-     * fConfigUpdated is set to true if there has been any change to the configuration settings, 
++
++    /**
++     * fConfigUpdated is set to true if there has been any change to the configuration settings,
+      * i.e a feature or a property was changed.
+      */
+     private boolean fConfigUpdated = true;
+-    
+-    /** 
+-     * Tracks whether the validator should use components from 
++
++    /**
++     * Tracks whether the validator should use components from
+      * the grammar pool to the exclusion of all others.
+      */
+     private boolean fUseGrammarPoolOnly;
+-    
++
+     /** Lookup map for components required for validation. **/
+     private final HashMap fComponents = new HashMap();
+-    
++
+     //
+     // Components
+     //
+-    
++
+     /** Entity manager. */
+     private XMLEntityManager fEntityManager;
+-    
++
+     /** Error reporter. */
+     private XMLErrorReporter fErrorReporter;
+-    
++
+     /** Namespace context. */
+     private NamespaceContext fNamespaceContext;
+-    
++
+     /** XML Schema validator. */
+     private XMLSchemaValidator fSchemaValidator;
+-       
++
+     /** Validation manager. */
+     private ValidationManager fValidationManager;
+-    
++
++    //
++    // Configuration
++    //
++
++   /** Stores initial feature values for validator reset. */
++    private final HashMap<String,Boolean> fInitFeatures = new HashMap<String,Boolean>();
++
++    /** Stores initial property values for validator reset. */
++    private final HashMap<String,Object> fInitProperties = new HashMap<String,Object>();
++
++    /** Stores the initial security manager. */
++    private final SecurityManager fInitSecurityManager;
++
+     //
+     // User Objects
+     //
+-    
++
+     /** Application's ErrorHandler. **/
+     private ErrorHandler fErrorHandler = null;
+-    
++
+     /** Application's LSResourceResolver. */
+     private LSResourceResolver fResourceResolver = null;
+-    
++
+     /** Constructs a component manager suitable for Xerces' schema validator. */
+     public XMLSchemaValidatorComponentManager(XSGrammarPoolContainer grammarContainer) {
+-        // setup components 
++        // setup components
+         fEntityManager = new XMLEntityManager();
+         fComponents.put(ENTITY_MANAGER, fEntityManager);
+-        
++
+         fErrorReporter = new XMLErrorReporter();
+         fComponents.put(ERROR_REPORTER, fErrorReporter);
+-        
++
+         fNamespaceContext = new NamespaceSupport();
+         fComponents.put(NAMESPACE_CONTEXT, fNamespaceContext);
+-        
++
+         fSchemaValidator = new XMLSchemaValidator();
+         fComponents.put(SCHEMA_VALIDATOR, fSchemaValidator);
+-        
++
+         fValidationManager = new ValidationManager();
+         fComponents.put(VALIDATION_MANAGER, fValidationManager);
+-        
++
+         // setup other properties
+         fComponents.put(ENTITY_RESOLVER, null);
+         fComponents.put(ERROR_HANDLER, null);
+@@ -190,30 +205,41 @@
+         if (System.getSecurityManager() != null) {
+             _isSecureMode = true;
+             setProperty(SECURITY_MANAGER, new SecurityManager());
+-        } else {        
++        } else {
+             fComponents.put(SECURITY_MANAGER, null);
+         }
+         fComponents.put(SYMBOL_TABLE, new SymbolTable());
+-        
++
+         // setup grammar pool
+         fComponents.put(XMLGRAMMAR_POOL, grammarContainer.getGrammarPool());
+         fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
+-        
++
+         // add schema message formatter to error reporter
+         fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
+-        
++
+         // add all recognized features and properties and apply their defaults
+-        addRecognizedParamsAndSetDefaults(fEntityManager);
+-        addRecognizedParamsAndSetDefaults(fErrorReporter);
+-        addRecognizedParamsAndSetDefaults(fSchemaValidator); 
++        addRecognizedParamsAndSetDefaults(fEntityManager, grammarContainer);
++        addRecognizedParamsAndSetDefaults(fErrorReporter, grammarContainer);
++        addRecognizedParamsAndSetDefaults(fSchemaValidator, grammarContainer);
++
++        // if the secure processing feature is set to true, add a security manager to the configuration
++        Boolean secureProcessing = grammarContainer.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING);
++        if (Boolean.TRUE.equals(secureProcessing)) {
++            fInitSecurityManager = new SecurityManager();
++        }
++        else {
++            fInitSecurityManager = null;
++        }
++        fComponents.put(SECURITY_MANAGER, fInitSecurityManager);
++
+     }
+ 
+     /**
+      * Returns the state of a feature.
+-     * 
++     *
+      * @param featureId The feature identifier.
+      * @return true if the feature is supported
+-     * 
++     *
+      * @throws XMLConfigurationException Thrown for configuration error.
+      *                                   In general, components should
+      *                                   only throw this exception if
+@@ -239,7 +265,7 @@
+         }
+         return super.getFeature(featureId);
+     }
+-    
++
+     /**
+      * Set the state of a feature.
+      *
+@@ -258,7 +284,6 @@
+         else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
+             throw new XMLConfigurationException(XMLConfigurationException.NOT_SUPPORTED, featureId);
+         }
+-        fConfigUpdated = true;
+         if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
+             if (_isSecureMode && !value) {
+                 throw new XMLConfigurationException(XMLConfigurationException.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
+@@ -266,18 +291,23 @@
+             setProperty(SECURITY_MANAGER, value ? new SecurityManager() : null);
+             return;
+         }
++        fConfigUpdated = true;
+         fEntityManager.setFeature(featureId, value);
+         fErrorReporter.setFeature(featureId, value);
+         fSchemaValidator.setFeature(featureId, value);
++        if (!fInitFeatures.containsKey(featureId)) {
++            boolean current = super.getFeature(featureId);
++            fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
++        }
+         super.setFeature(featureId, value);
+     }
+-    
++
+     /**
+      * Returns the value of a property.
+-     * 
++     *
+      * @param propertyId The property identifier.
+      * @return the value of the property
+-     * 
++     *
+      * @throws XMLConfigurationException Thrown for configuration error.
+      *                                   In general, components should
+      *                                   only throw this exception if
+@@ -295,13 +325,13 @@
+         }
+         return super.getProperty(propertyId);
+     }
+-    
++
+     /**
+      * Sets the state of a property.
+-     * 
++     *
+      * @param propertyId The unique identifier (URI) of the property.
+      * @param value The requested state of the property.
+-     * 
++     *
+      * @exception XMLConfigurationException If the requested property is not known.
+      */
+     public void setProperty(String propertyId, Object value) throws XMLConfigurationException {
+@@ -315,14 +345,17 @@
+         fEntityManager.setProperty(propertyId, value);
+         fErrorReporter.setProperty(propertyId, value);
+         fSchemaValidator.setProperty(propertyId, value);
+-        if (ENTITY_RESOLVER.equals(propertyId) || ERROR_HANDLER.equals(propertyId) || 
++        if (ENTITY_RESOLVER.equals(propertyId) || ERROR_HANDLER.equals(propertyId) ||
+                 SECURITY_MANAGER.equals(propertyId)) {
+             fComponents.put(propertyId, value);
+             return;
+         }
++        if (!fInitProperties.containsKey(propertyId)) {
++            fInitProperties.put(propertyId, super.getProperty(propertyId));
++        }
+         super.setProperty(propertyId, value);
+     }
+-    
++
+     /**
+      * Adds all of the component's recognized features and properties
+      * to the list of default recognized features and properties, and
+@@ -332,21 +365,21 @@
+      * @param component The component whose recognized features
+      * and properties will be added to the configuration
+      */
+-    public void addRecognizedParamsAndSetDefaults(XMLComponent component) {
+-        
++    public void addRecognizedParamsAndSetDefaults(XMLComponent component, XSGrammarPoolContainer grammarContainer) {
++
+         // register component's recognized features
+         final String[] recognizedFeatures = component.getRecognizedFeatures();
+         addRecognizedFeatures(recognizedFeatures);
+-        
++
+         // register component's recognized properties
+         final String[] recognizedProperties = component.getRecognizedProperties();
+         addRecognizedProperties(recognizedProperties);
+ 
+         // set default values
+-        setFeatureDefaults(component, recognizedFeatures);
++        setFeatureDefaults(component, recognizedFeatures, grammarContainer);
+         setPropertyDefaults(component, recognizedProperties);
+     }
+-    
++
+     /** Calls reset on each of the components owned by this component manager. **/
+     public void reset() throws XNIException {
+         fNamespaceContext.reset();
+@@ -357,53 +390,70 @@
+         // Mark configuration as fixed.
+         fConfigUpdated = false;
+     }
+-    
++
+     void setErrorHandler(ErrorHandler errorHandler) {
+         fErrorHandler = errorHandler;
+-        setProperty(ERROR_HANDLER, (errorHandler != null) ? new ErrorHandlerWrapper(errorHandler) : 
++        setProperty(ERROR_HANDLER, (errorHandler != null) ? new ErrorHandlerWrapper(errorHandler) :
+                 new ErrorHandlerWrapper(DraconianErrorHandler.getInstance()));
+     }
+-    
++
+     ErrorHandler getErrorHandler() {
+         return fErrorHandler;
+     }
+-    
++
+     void setResourceResolver(LSResourceResolver resourceResolver) {
+         fResourceResolver = resourceResolver;
+         setProperty(ENTITY_RESOLVER, new DOMEntityResolverWrapper(resourceResolver));
+     }
+-    
++
+     public LSResourceResolver getResourceResolver() {
+         return fResourceResolver;
+     }
+-    
++
+     /** Cleans out configuration, restoring it to its initial state. */
+     void restoreInitialState() {
+         fConfigUpdated = true;
+-        
+-        // Clear feature and property tables.
+-        fFeatures.clear();
+-        fProperties.clear();
+-        
++
+         // Remove error resolver and error handler
+         fComponents.put(ENTITY_RESOLVER, null);
+         fComponents.put(ERROR_HANDLER, null);
+-        
+-        // Restore component defaults.
+-        setFeatureDefaults(fEntityManager, fEntityManager.getRecognizedFeatures());
+-        setPropertyDefaults(fEntityManager, fEntityManager.getRecognizedProperties());
+-        setFeatureDefaults(fErrorReporter, fErrorReporter.getRecognizedFeatures());
+-        setPropertyDefaults(fErrorReporter, fErrorReporter.getRecognizedProperties());
+-        setFeatureDefaults(fSchemaValidator, fSchemaValidator.getRecognizedFeatures());
+-        setPropertyDefaults(fSchemaValidator, fSchemaValidator.getRecognizedProperties());
++
++        // Restore initial security manager
++        fComponents.put(SECURITY_MANAGER, fInitSecurityManager);
++
++        // Reset feature and property values to their initial values
++        if (!fInitFeatures.isEmpty()) {
++            Iterator<Map.Entry<String,Boolean>> iter = fInitFeatures.entrySet().iterator();
++            while (iter.hasNext()) {
++                Map.Entry<String,Boolean> entry = iter.next();
++                String name = entry.getKey();
++                boolean value = entry.getValue().booleanValue();
++                super.setFeature(name, value);
++            }
++            fInitFeatures.clear();
++        }
++        if (!fInitProperties.isEmpty()) {
++            Iterator<Map.Entry<String,Object>> iter = fInitProperties.entrySet().iterator();
++            while (iter.hasNext()) {
++                Map.Entry<String,Object> entry = iter.next();
++                String name = entry.getKey();
++                Object value = entry.getValue();
++                super.setProperty(name, value);
++            }
++            fInitProperties.clear();
++        }
+     }
+-    
++
+     /** Sets feature defaults for the given component on this configuration. */
+-    private void setFeatureDefaults(final XMLComponent component, final String [] recognizedFeatures) {
++    private void setFeatureDefaults(final XMLComponent component,
++            final String [] recognizedFeatures, XSGrammarPoolContainer grammarContainer) {
+         if (recognizedFeatures != null) {
+             for (int i = 0; i < recognizedFeatures.length; ++i) {
+                 String featureId = recognizedFeatures[i];
+-                Boolean state = component.getFeatureDefault(featureId);
++                Boolean state = grammarContainer.getFeature(featureId);
++                if (state == null) {
++                    state = component.getFeatureDefault(featureId);
++                }
+                 if (state != null) {
+                     // Do not overwrite values already set on the configuration.
+                     if (!fFeatures.containsKey(featureId)) {
+@@ -418,7 +468,7 @@
+             }
+         }
+     }
+-    
++
+     /** Sets property defaults for the given component on this configuration. */
+     private void setPropertyDefaults(final XMLComponent component, final String [] recognizedProperties) {
+         if (recognizedProperties != null) {
+@@ -439,6 +489,6 @@
+             }
+         }
+     }
+-    
++
+ } // XMLSchemaValidatorComponentManager
+- 
++
+diff -Nru src/com/sun/org/apache/xerces/internal/jaxp/validation/XSGrammarPoolContainer.java src/com/sun/org/apache/xerces/internal/jaxp/validation/XSGrammarPoolContainer.java
+--- src/com/sun/org/apache/xerces/internal/jaxp/validation/XSGrammarPoolContainer.java	2011-02-10 04:57:47.000000000 +0000
++++ src/com/sun/org/apache/xerces/internal/jaxp/validation/XSGrammarPoolContainer.java	2011-02-11 16:48:41.000000000 +0000
+@@ -47,4 +47,11 @@
+      */
+     public boolean isFullyComposed();
+ 
++    /**
++     * Returns the initial value of a feature for validators created
++     * using this grammar pool container or null if the validators
++     * should use the default value.
++     */
++    public Boolean getFeature(String featureId);
++
+ }
