Author: mrglavas
Date: Wed May 7 19:27:39 2008
New Revision: 654391
URL: http://svn.apache.org/viewvc?rev=654391&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/trunk/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
Modified:
xerces/java/trunk/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
URL:
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java?rev=654391&r1=654390&r2=654391&view=diff
==============================================================================
---
xerces/java/trunk/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
(original)
+++
xerces/java/trunk/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
Wed May 7 19:27:39 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]