cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r523500 - in /cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon: components/elementprocessor/NoOpElementProcessor.java serialization/ElementProcessorSerializer.java
Date Wed, 28 Mar 2007 23:06:40 GMT
Author: joerg
Date: Wed Mar 28 16:06:39 2007
New Revision: 523500

URL: http://svn.apache.org/viewvc?view=rev&rev=523500
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/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/NoOpElementProcessor.java
Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java?view=diff&rev=523500&r1=523499&r2=523500
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java
Wed Mar 28 16:06:39 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;
@@ -55,7 +54,6 @@
     extends AbstractLogEnabled implements Serializer, Serviceable {
 
     private final Stack openElements;
-    private final ElementProcessor noOpElementProcessor;
     
     protected ServiceManager manager;
 
@@ -67,7 +65,6 @@
      */
     public ElementProcessorSerializer() {
         this.openElements = new Stack();
-        this.noOpElementProcessor = new NoOpElementProcessor();
     }
 
     public void service(ServiceManager manager) {
@@ -142,7 +139,7 @@
     }
 
     private ElementProcessor getCurrentElementProcessor() {
-        return this.openElements.empty() ? this.noOpElementProcessor
+        return this.openElements.empty() ? null
                                          : (ElementProcessor)this.openElements.peek();
     }
 
@@ -236,7 +233,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));
+        }
     }
 
     /**
@@ -272,7 +272,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));
+        }
     }
 
     /**



Mime
View raw message