Author: mrglavas
Date: Fri Feb 19 14:39:08 2010
New Revision: 911824

URL: http://svn.apache.org/viewvc?rev=911824&view=rev
Log:
Reduce the cost of resetting the XMLSchemaValidator. The CMNodeFactory only 
needs to read properties from the XMLComponentManager if its configuration has 
changed since the last time it was read.

Modified:
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMNodeFactory.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=911824&r1=911823&r2=911824&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
 Fri Feb 19 14:39:08 2010
@@ -1433,9 +1433,6 @@
         // cleanup id table
         fValidationState.resetIDTables();
 
-        //pass the component manager to the factory..
-        nodeFactory.reset(componentManager);
-
         // reset schema loader
         fSchemaLoader.reset(componentManager);
 
@@ -1467,9 +1464,11 @@
             parser_settings = true;
         }
 
-        if (!parser_settings){
+        if (!parser_settings) {
             // parser settings have not been changed
             fValidationManager.addValidationState(fValidationState);
+            // the node limit on the SecurityManager may have changed so need 
to refresh.
+            nodeFactory.reset();
             // Re-parse external schema location properties.
             XMLSchemaLoader.processExternalHints(
                 fExternalSchemas,
@@ -1478,7 +1477,9 @@
                 fXSIErrorReporter.fErrorReporter);
             return;
         }
-
+        
+        // pass the component manager to the factory..
+        nodeFactory.reset(componentManager);
 
         // get symbol table. if it's a new one, add symbols to it.
         SymbolTable symbolTable = (SymbolTable) 
componentManager.getProperty(SYMBOL_TABLE);

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMNodeFactory.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMNodeFactory.java?rev=911824&r1=911823&r2=911824&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMNodeFactory.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMNodeFactory.java
 Fri Feb 19 14:39:08 2010
@@ -71,14 +71,11 @@
     public CMNodeFactory() {
     }
     
-    public void reset(XMLComponentManager componentManager){
+    public void reset(XMLComponentManager componentManager) {
         fErrorReporter = 
(XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
         try {
             fSecurityManager = 
(SecurityManager)componentManager.getProperty(SECURITY_MANAGER);
-            //we are setting the limit of number of nodes to 3times the 
maxOccur value..
-            if(fSecurityManager != null){
-                maxNodeLimit = fSecurityManager.getMaxOccurNodeLimit() * 
MULTIPLICITY ;
-            }
+            reset();
         }
         catch (XMLConfigurationException e) {
             fSecurityManager = null;
@@ -86,6 +83,13 @@
         
     }//reset()
     
+    public void reset() {
+        // we are setting the limit of number of nodes to 3 times the 
maxOccurs value.
+        if (fSecurityManager != null) {
+            maxNodeLimit = fSecurityManager.getMaxOccurNodeLimit() * 
MULTIPLICITY;
+        }
+    }
+    
     public CMNode getCMLeafNode(int type, Object leaf, int id, int position) {
         nodeCountCheck();
         return new XSCMLeaf(type, leaf, id, position) ;



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to