[prev in list] [next in list] [prev in thread] [next in thread]
List: xml-cocoon-dev
Subject: [C2] Patch: ArrayIndexOutOfBoundsException after other exceptions
From: "Jeff Skaistis" <jeff.skaistis () alistia ! com>
Date: 2001-05-31 16:12:25
[Download RAW message or body]
Hi all,
The attached patch to ServerPagesGenerator.java fixes an issue with
ArrayIndexOutOfBoundsExceptions (from xalan) being appended to pages after
another exception is thrown while procssing a page previously.
It makes sure that the event stack is always cleared after processing a page
with an exception, as well as when the component is recycled.
-------------------------
Jeff Skaistis
jeff.skaistis@alistia.com
["ServerPagesGenerator.java.diff" (application/octet-stream)]
cvs diff -u -r1.5 ServerPagesGenerator.java
Index: ServerPagesGenerator.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/generation/ServerPagesGenerator.java,v
retrieving revision 1.5
diff -u -r1.5 ServerPagesGenerator.java
--- ServerPagesGenerator.java 2001/05/29 06:13:47 1.5
+++ ServerPagesGenerator.java 2001/05/31 16:03:44
@@ -191,37 +191,36 @@
if(generator != null)
programGenerator.release(generator);
generator = null;
+ // End any started events in case of premature return
+ while (this.eventStack.size()!=0) {
+ EventData eventData = (EventData) this.eventStack.removeFirst();
+
+ switch (eventData.eventType) {
+ case DOCUMENT:
+ this.contentHandler.endDocument();
+ break;
+ case ELEMENT:
+ this.contentHandler.endElement(
+ eventData.getNamespaceURI(),
+ eventData.getLocalName(),
+ eventData.getRawName()
+ );
+ break;
+ case PREFIX_MAPPING:
+ this.contentHandler.endPrefixMapping(eventData.getPrefix());
+ break;
+ case CDATA:
+ this.lexicalHandler.endCDATA();
+ break;
+ case DTD:
+ this.lexicalHandler.endDTD();
+ break;
+ case ENTITY:
+ this.lexicalHandler.endEntity(eventData.getName());
+ break;
+ }
+ }
}
-
- // End any started events in case of premature return
- while (this.eventStack.size()!=0) {
- EventData eventData = (EventData) this.eventStack.removeFirst();
-
- switch (eventData.eventType) {
- case DOCUMENT:
- this.contentHandler.endDocument();
- break;
- case ELEMENT:
- this.contentHandler.endElement(
- eventData.getNamespaceURI(),
- eventData.getLocalName(),
- eventData.getRawName()
- );
- break;
- case PREFIX_MAPPING:
- this.contentHandler.endPrefixMapping(eventData.getPrefix());
- break;
- case CDATA:
- this.lexicalHandler.endCDATA();
- break;
- case DTD:
- this.lexicalHandler.endDTD();
- break;
- case ENTITY:
- this.lexicalHandler.endEntity(eventData.getName());
- break;
- }
- }
}
/* Handlers */
@@ -444,6 +443,8 @@
programGenerator.release(generator);
this.generator = null;
this.inputSource = null;
+ // clear the event stack
+ this.eventStack.clear();
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic