cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: r225810 - /cocoon/trunk/src/java/org/apache/cocoon/xml/AbstractXMLProducer.java
Date Thu, 28 Jul 2005 16:11:06 GMT
Author: sylvain
Date: Thu Jul 28 09:11:03 2005
New Revision: 225810

URL: http://svn.apache.org/viewcvs?rev=225810&view=rev
Log:
Fix bug #35913 (continued)

Modified:
    cocoon/trunk/src/java/org/apache/cocoon/xml/AbstractXMLProducer.java

Modified: cocoon/trunk/src/java/org/apache/cocoon/xml/AbstractXMLProducer.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/xml/AbstractXMLProducer.java?rev=225810&r1=225809&r2=225810&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/xml/AbstractXMLProducer.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/xml/AbstractXMLProducer.java Thu Jul 28 09:11:03
2005
@@ -19,6 +19,7 @@
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.DefaultHandler;
 
 /**
  * This abstract class provides default implementation of the methods specified
@@ -30,15 +31,17 @@
  */
 public abstract class AbstractXMLProducer extends AbstractLogEnabled
                                           implements XMLProducer, Recyclable {
+    
+    protected static final ContentHandler EMPTY_CONTENT_HANDLER = new DefaultHandler();
 
     /** The <code>XMLConsumer</code> receiving SAX events. */
     protected XMLConsumer xmlConsumer;
 
     /** The <code>ContentHandler</code> receiving SAX events. */
-    protected ContentHandler contentHandler;
+    protected ContentHandler contentHandler = EMPTY_CONTENT_HANDLER;
 
     /** The <code>LexicalHandler</code> receiving SAX events. */
-    protected LexicalHandler lexicalHandler;
+    protected LexicalHandler lexicalHandler = DefaultLexicalHandler.NULL_HANDLER;
 
     /**
      * Set the <code>XMLConsumer</code> that will receive XML data.
@@ -73,11 +76,12 @@
     }
 
     /**
-     * Recycle the producer by removing references
+     * Recycle the producer by removing references, and resetting handlers to
+     * null (empty) implementations.
      */
     public void recycle() {
         this.xmlConsumer = null;
-        this.contentHandler = null;
-        this.lexicalHandler = null;
+        this.contentHandler = EMPTY_CONTENT_HANDLER;
+        this.lexicalHandler = DefaultLexicalHandler.NULL_HANDLER;
     }
 }



Mime
View raw message