Hi,
I'm currently using XML-RPC 3.0, and discovered that
DefaultXmlWriterFactory never use CharSetXmlWriterFactory because
CharSetXMLWriter is broken.
- CharSetXMLWriter#startDocument() throws IllegalArgumentException
when encoding == null.
(Charset.forName(null) cause IllegalArgumentException)
the patch also fixes bellow issues.
- CharSetXMLWriter doesn't generate 'XML declaration' because
#startDocument() overrides super.startDocument();
- #canEncode(char) should work when charsetEncoder == null.
Hope this helps.
--
Yasuoka Masahiko
Internet Initiative Japan Inc.
--- src/main/java/org/apache/ws/commons/serialize/CharSetXMLWriter.java-ORIG
2005-05-22 07:03:25.000000000 +0900
+++ src/main/java/org/apache/ws/commons/serialize/CharSetXMLWriter.java
2006-10-09 19:42:59.000000000 +0900
@@ -29,13 +29,16 @@
private CharsetEncoder charsetEncoder;
public void startDocument() throws SAXException {
- Charset charSet = Charset.forName(getEncoding());
- if (charSet.canEncode()) {
- charsetEncoder = charSet.newEncoder();
+ if (getEncoding() != null) {
+ Charset charSet = Charset.forName(getEncoding());
+ if (charSet.canEncode()) {
+ charsetEncoder = charSet.newEncoder();
+ }
}
+ super.startDocument();
}
public boolean canEncode(char c) {
- return (charsetEncoder == null) ? false :
charsetEncoder.canEncode(c);
+ return (charsetEncoder == null) ? super.canEncode(c) :
charsetEncoder.canEncode(c);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]