proyal 2003/09/03 19:05:46
Modified: jelly/src/java/org/apache/commons/jelly XMLOutput.java
Log:
[JELLY-69] Test to make sure ContentHandler is an XMLWriter before casting
Patch from Willie Vu
Revision Changes Path
1.11 +11 -7
jakarta-commons/jelly/src/java/org/apache/commons/jelly/XMLOutput.java
Index: XMLOutput.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/XMLOutput.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XMLOutput.java 11 Jun 2003 15:55:58 -0000 1.10
+++ XMLOutput.java 4 Sep 2003 02:05:45 -0000 1.11
@@ -137,7 +137,10 @@
}
public void flush() throws IOException {
- ((XMLWriter)contentHandler).flush();
+ if( contentHandler instanceof XMLWriter )
+ {
+ ((XMLWriter)contentHandler).flush();
+ }
}
// Static helper methods
@@ -182,7 +185,8 @@
* @param escapeText is whether or not text output will be escaped. This must
be true
* if the underlying output is XML or could be false if the underlying output
is textual.
*/
- public static XMLOutput createXMLOutput(Writer writer, boolean escapeText)
throws UnsupportedEncodingException {
+ public static XMLOutput createXMLOutput(Writer writer, boolean escapeText)
+ {
XMLWriter xmlWriter = new XMLWriter(writer);
xmlWriter.setEscapeText(escapeText);
return createXMLOutput(xmlWriter);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]