xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrgla...@apache.org
Subject svn commit: r654392 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
Date Thu, 08 May 2008 02:28:50 GMT
Author: mrglavas
Date: Wed May  7 19:28:50 2008
New Revision: 654392

URL: http://svn.apache.org/viewvc?rev=654392&view=rev
Log:
Before returning control to the user, disconnect the validator and other
objects from the XMLReader. This keeps the user's application from mucking around
with the Validator's internal ValidatorHandler and may allow for better garbage
collection.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java?rev=654392&r1=654391&r2=654392&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
Wed May  7 19:28:50 2008
@@ -663,8 +663,9 @@
                 setContentHandler(ch);
             }
             
+            XMLReader reader = null;
             try {
-                XMLReader reader = saxSource.getXMLReader();
+                reader = saxSource.getXMLReader();
                 if (reader == null) {
                     // create one now
                     SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -716,8 +717,21 @@
                 reader.parse(is);
             } 
             finally {
-                // release the reference to user's handler ASAP
+                // Release the reference to user's ContentHandler ASAP
                 setContentHandler(null);
+                // Disconnect the validator and other objects from the XMLReader
+                if (reader != null) {
+                    try {
+                        reader.setContentHandler(null);
+                        reader.setDTDHandler(null);
+                        reader.setErrorHandler(null);
+                        reader.setEntityResolver(null);
+                        fResolutionForwarder.setEntityResolver(null);
+                        reader.setProperty(LEXICAL_HANDLER, null);
+                    }
+                    // Ignore the exception if the lexical handler cannot be unset.
+                    catch (Exception exc) {}
+                }
             }
             return;
         }



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


Mime
View raw message