cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r492297 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/NoOpElementProcessor.java src/blocks/poi/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java status.xml
Date Wed, 03 Jan 2007 20:55:34 GMT
Author: joerg
Date: Wed Jan  3 12:55:33 2007
New Revision: 492297

URL: http://svn.apache.org/viewvc?view=rev&rev=492297
Log:
COCOON-1976: Prevent NPE in ElementProcessorSerializer on characters before first startElement.

Added:
    cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/NoOpElementProcessor.java
  (with props)
Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/serialization/ElementProcessorSerializer.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/NoOpElementProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/NoOpElementProcessor.java?view=auto&rev=492297
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/NoOpElementProcessor.java
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/NoOpElementProcessor.java
Wed Jan  3 12:55:33 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.components.elementprocessor;
+
+import java.io.IOException;
+
+import org.apache.cocoon.components.elementprocessor.types.Attribute;
+
+/**
+ * @version $ID$
+ */
+public class NoOpElementProcessor implements ElementProcessor {
+
+    public void initialize(Attribute[] attributes, ElementProcessor parent) throws IOException
{ }
+
+    public void acceptCharacters(char[] data) { }
+
+    public void acceptWhitespaceCharacters(char[] data) { }
+
+    public void endProcessing() throws IOException { }
+
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/NoOpElementProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=492297&r1=492296&r2=492297
==============================================================================
--- 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 Jan  3 12:55:33 2007
@@ -27,6 +27,7 @@
 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,16 +54,20 @@
 public abstract class ElementProcessorSerializer
     extends AbstractLogEnabled implements Serializer, Serviceable {
 
-    private OutputStream outputStream;
-    private Stack openElements;
-    private Locator locator;
+    private final Stack openElements;
+    private final ElementProcessor noOpElementProcessor;
+    
     protected ServiceManager manager;
 
+    private OutputStream outputStream;
+    private Locator locator;
+    
     /**
      * Constructor
      */
     public ElementProcessorSerializer() {
         this.openElements = new Stack();
+        this.noOpElementProcessor = new NoOpElementProcessor();
     }
 
     public void service(ServiceManager manager) {
@@ -137,7 +142,7 @@
     }
 
     private ElementProcessor getCurrentElementProcessor() {
-        return this.openElements.empty() ? null
+        return this.openElements.empty() ? this.noOpElementProcessor
                                          : (ElementProcessor)this.openElements.peek();
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&rev=492297&r1=492296&r2=492297
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Wed Jan  3 12:55:33 2007
@@ -181,6 +181,9 @@
 
   <changes>
   <release version="2.1.11" date="TBD">
+    <action dev="JH" type="fix" fixes-bug="COCOON-1976" due-to="Rob Berens">
+      POI Block: Prevent NPE in ElementProcessorSerializer on characters before first startElement.
+    </action>
     <action dev="CZ" type="fix" fixes-bug="COCOON-1776" due-to="Vincent Demay">
       Portal Block: Applied and improved patch for reloading bookmarks based on their (file)
validity.
     </action>



Mime
View raw message