You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2007/03/29 01:09:21 UTC

svn commit: r523501 - in /cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon: components/elementprocessor/NoOpElementProcessor.java serialization/ElementProcessorSerializer.java

Author: joerg
Date: Wed Mar 28 16:09:20 2007
New Revision: 523501

URL: http://svn.apache.org/viewvc?view=rev&rev=523501
Log:
COCOON-1976: bugfix, trial 2, using the original proposal with null checks
(NoOpElementProcessor did not work as a parent-child-hierarchy was created with casts on specific implementation)

Removed:
    cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/NoOpElementProcessor.java
Modified:
    cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java

Modified: cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java?view=diff&rev=523501&r1=523500&r2=523501
==============================================================================
--- cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java (original)
+++ cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java Wed Mar 28 16:09:20 2007
@@ -27,7 +27,6 @@
 import org.apache.cocoon.components.elementprocessor.CannotCreateElementProcessorException;
 import org.apache.cocoon.components.elementprocessor.ElementProcessor;
 import org.apache.cocoon.components.elementprocessor.ElementProcessorFactory;
-import org.apache.cocoon.components.elementprocessor.NoOpElementProcessor;
 import org.apache.cocoon.components.elementprocessor.types.Attribute;
 
 import org.xml.sax.Attributes;
@@ -53,7 +52,6 @@
     extends AbstractLogEnabled implements Serializer, Serviceable {
 
     private final Stack openElements;
-    private final ElementProcessor noOpElementProcessor;
     
     protected ServiceManager manager;
 
@@ -65,7 +63,6 @@
      */
     public ElementProcessorSerializer() {
         this.openElements = new Stack();
-        this.noOpElementProcessor = new NoOpElementProcessor();
     }
 
     public void service(ServiceManager manager) {
@@ -140,7 +137,7 @@
     }
 
     private ElementProcessor getCurrentElementProcessor() {
-        return this.openElements.empty() ? this.noOpElementProcessor
+        return this.openElements.empty() ? null
                                          : (ElementProcessor)this.openElements.peek();
     }
 
@@ -234,7 +231,10 @@
      *            the character data
      */
     public void characters(final char [] ch, final int start, final int length) throws SAXException {
-        getCurrentElementProcessor().acceptCharacters(cleanupArray(ch, start, length));
+        ElementProcessor currentElementProcessor = getCurrentElementProcessor();
+        if (currentElementProcessor != null) {
+            currentElementProcessor.acceptCharacters(cleanupArray(ch, start, length));
+        }
     }
 
     /**
@@ -270,7 +270,10 @@
      *            the character data
      */
     public void ignorableWhitespace(final char [] ch, final int start, final int length) throws SAXException {
-        getCurrentElementProcessor().acceptWhitespaceCharacters(cleanupArray(ch, start, length));
+        ElementProcessor currentElementProcessor = getCurrentElementProcessor();
+        if (currentElementProcessor != null) {
+            currentElementProcessor.acceptWhitespaceCharacters(cleanupArray(ch, start, length));
+        }
     }
 
     /**