cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject svn commit: r170991 - /cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectPipe.java
Date Thu, 19 May 2005 20:36:11 GMT
Author: tim
Date: Thu May 19 13:36:10 2005
New Revision: 170991

URL: http://svn.apache.org/viewcvs?rev=170991&view=rev
Log:
Optimize EffectPipe buffer handling and add locator support to buffers.

Modified:
    cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectPipe.java

Modified: cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectPipe.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectPipe.java?rev=170991&r1=170990&r2=170991&view=diff
==============================================================================
--- cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectPipe.java
(original)
+++ cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/transformation/EffectPipe.java
Thu May 19 13:36:10 2005
@@ -21,6 +21,7 @@
 import org.xml.sax.Attributes;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
+import org.xml.sax.helpers.LocatorImpl;
 
 import java.util.LinkedList;
 
@@ -174,83 +175,88 @@
      */
     protected class BufferHandler extends NullHandler {
         public Handler startDocument() throws SAXException {
-            if (buffer != null) buffer.startDocument();
+            buffer.startDocument();
             return this;
         }
 
+        public void setDocumentLocator(Locator paramLocator) {
+            locator = new LocatorImpl(paramLocator);
+            buffer.setDocumentLocator(paramLocator);
+        }
+
         public void endDocument() throws SAXException {
-            if (buffer != null) buffer.endDocument();
+            buffer.endDocument();
         }
 
         public void startPrefixMapping(String prefix, String uri) throws SAXException {
-            if (buffer != null) buffer.startPrefixMapping(prefix, uri);
+            buffer.startPrefixMapping(prefix, uri);
         }
 
         public void endPrefixMapping(String prefix) throws SAXException {
-            if (buffer != null) buffer.endPrefixMapping(prefix);
+            buffer.endPrefixMapping(prefix);
         }
 
         public Handler startElement(String uri, String loc, String raw, Attributes attrs)
throws SAXException {
-            if (buffer != null) buffer.startElement(uri, loc, raw, attrs);
+            buffer.startElement(uri, loc, raw, attrs);
             return this;
         }
 
         public void endElement(String uri, String loc, String raw) throws SAXException {
-            if (buffer != null) buffer.endElement(uri, loc, raw);
+            buffer.endElement(uri, loc, raw);
         }
 
         public Handler characters(char ch[], int start, int length) throws SAXException {
-            if (buffer != null) buffer.characters(ch, start, length);
+            buffer.characters(ch, start, length);
             return this;
         }
 
         public Handler ignorableWhitespace(char ch[], int start, int length) throws SAXException
{
-            if (buffer != null) buffer.ignorableWhitespace(ch, start, length);
+            buffer.ignorableWhitespace(ch, start, length);
             return this;
         }
 
         public Handler processingInstruction(String target, String data) throws SAXException
{
-            if (buffer != null) buffer.processingInstruction(target, data);
+            buffer.processingInstruction(target, data);
             return this;
         }
 
         public Handler skippedEntity(String name) throws SAXException {
-            if (buffer != null) buffer.skippedEntity(name);
+            buffer.skippedEntity(name);
             return this;
         }
 
         public Handler startDTD(String name, String publicId, String systemId) throws SAXException
{
-            if (buffer != null) buffer.startDTD(name, publicId, systemId);
+            buffer.startDTD(name, publicId, systemId);
             return this;
         }
 
         public Handler endDTD() throws SAXException {
-            if (buffer != null) buffer.endDTD();
+            buffer.endDTD();
             return this;
         }
 
         public Handler startEntity(String name) throws SAXException {
-            if (buffer != null) buffer.startEntity(name);
+            buffer.startEntity(name);
             return this;
         }
 
         public Handler endEntity(String name) throws SAXException {
-            if (buffer != null) buffer.endEntity(name);
+            buffer.endEntity(name);
             return this;
         }
 
         public Handler startCDATA() throws SAXException {
-            if (buffer != null) buffer.startCDATA();
+            buffer.startCDATA();
             return this;
         }
 
         public Handler endCDATA() throws SAXException {
-            if (buffer != null) buffer.endCDATA();
+            buffer.endCDATA();
             return this;
         }
 
         public Handler comment(char c[], int start, int len) throws SAXException {
-            if (buffer != null) buffer.comment(c, start, len);
+            buffer.comment(c, start, len);
             return this;
         }
     }
@@ -422,6 +428,7 @@
     private Handler handler;
 
     private LinkedList buffers;
+    private LinkedList locators;
     private SaxBuffer buffer;
 
 
@@ -429,6 +436,7 @@
      * Initialize the pipe before starting processing
      */
     protected void init(Handler top) {
+        locators = new LinkedList();
         handlers = new LinkedList();
         handler = top;
     }
@@ -443,6 +451,7 @@
         buffers = null;
         buffer = null;
         locator = null;
+        locators = null;
     }
 
     /**
@@ -475,6 +484,8 @@
             }
             this.buffers.addFirst(this.buffer);
         }
+        locators.addFirst(locator);
+        locator = new LocatorImpl(locator);
         this.buffer = new SaxBuffer();
     }
 
@@ -485,6 +496,7 @@
         } else {
             this.buffer = null;
         }
+        locator = (Locator)locators.removeFirst();
         return buffer;
     }
 



Mime
View raw message