From: Thomas D. <tho...@jb...> - 2006-04-12 21:27:54
|
User: tdiesler Date: 06/04/12 17:27:51 Modified: src/main/org/jboss/util/xml Tag: Branch_4_0 DOMUtils.java DOMWriter.java Log: JBWS-812 Invalid byte 2 of 2-byte UTF-8 sequence Revision Changes Path No revision No revision 1.4.2.9 +4 -4 jboss-common/src/main/org/jboss/util/xml/DOMUtils.java (In the diff below, changes in quantity of whitespace are not shown.) Index: DOMUtils.java =================================================================== RCS file: /cvsroot/jboss/jboss-common/src/main/org/jboss/util/xml/DOMUtils.java,v retrieving revision 1.4.2.8 retrieving revision 1.4.2.9 diff -u -b -r1.4.2.8 -r1.4.2.9 --- DOMUtils.java 5 Apr 2006 12:23:45 -0000 1.4.2.8 +++ DOMUtils.java 12 Apr 2006 21:27:51 -0000 1.4.2.9 @@ -41,7 +41,7 @@ * DOM2 utilites * * @author Tho...@jb... - * @version $Revision: 1.4.2.8 $ + * @version $Revision: 1.4.2.9 $ */ public final class DOMUtils { @@ -62,7 +62,7 @@ } catch (ParserConfigurationException e) { - throw new RuntimeException("Failed to create DoucmentBuilder", e); + throw new RuntimeException("Failed to create DocumentBuilder", e); } } }; @@ -86,7 +86,7 @@ { try { - return parse(new ByteArrayInputStream(xmlString.getBytes())); + return parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8"))); } catch (IOException e) { 1.4.6.8 +21 -11 jboss-common/src/main/org/jboss/util/xml/DOMWriter.java (In the diff below, changes in quantity of whitespace are not shown.) Index: DOMWriter.java =================================================================== RCS file: /cvsroot/jboss/jboss-common/src/main/org/jboss/util/xml/DOMWriter.java,v retrieving revision 1.4.6.7 retrieving revision 1.4.6.8 diff -u -b -r1.4.6.7 -r1.4.6.8 --- DOMWriter.java 16 Mar 2006 14:36:58 -0000 1.4.6.7 +++ DOMWriter.java 12 Apr 2006 21:27:51 -0000 1.4.6.8 @@ -55,6 +55,8 @@ */ package org.jboss.util.xml; +// $Id: DOMWriter.java,v 1.4.6.8 2006/04/12 21:27:51 tdiesler Exp $ + import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; @@ -72,7 +74,7 @@ * * @author Andy Clark, IBM * @author Tho...@jb... - * @version $Revision: 1.4.6.7 $ + * @version $Revision: 1.4.6.8 $ */ public class DOMWriter { @@ -98,7 +100,14 @@ public DOMWriter(OutputStream stream) { - this.out = new PrintWriter(new OutputStreamWriter(stream)); + try + { + this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8")); + } + catch (UnsupportedEncodingException e) + { + // ignore, UTF-8 should be available + } } public DOMWriter(OutputStream stream, String charsetName) @@ -184,6 +193,7 @@ { return; } + // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); |