You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2005/11/30 21:05:31 UTC

svn commit: r350035 - /xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java

Author: mrglavas
Date: Wed Nov 30 12:05:24 2005
New Revision: 350035

URL: http://svn.apache.org/viewcvs?rev=350035&view=rev
Log:
Since we release validators back to a static pool we have to be careful
not to pull in references to objects which aren't necessary. The DOMNormalizer
is registered as the document handler on the validator handler. Since the
DOMNormalizer has a reference to the DOM tree we were actually caching a DOM
in the pool along with the validator. We now remove the document handler
before returning the validator handler to the pool. If there was an exception
thrown during normalization we now ensure that the validator is released if
there was one.

Modified:
    xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java

Modified: xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java?rev=350035&r1=350034&r2=350035&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java Wed Nov 30 12:05:24 2005
@@ -249,18 +249,24 @@
             // release resources
             if (fValidationHandler != null) {
                 fValidationHandler.endDocument(null);
+                fValidationHandler.setDocumentHandler(null);
                 CoreDOMImplementationImpl.singleton.releaseValidator(schemaType, xmlVersion, fValidationHandler);
                 fValidationHandler = null;
             }
         }
         catch (RuntimeException e) {
-            if( e==abort )
+            // release resources
+            if (fValidationHandler != null) {
+                fValidationHandler.setDocumentHandler(null);
+                CoreDOMImplementationImpl.singleton.releaseValidator(schemaType, xmlVersion, fValidationHandler);
+                fValidationHandler = null;
+            }
+            if (e == abort) {
                 return; // processing aborted by the user
-            throw e;    // otherwise re-throw.
+            }
+            throw e; // otherwise re-throw.
         }
-        
     }
-
 
     /**
      * 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org