Author: darran.lofthouse(a)jboss.com
Date: 2007-08-10 12:29:39 -0400 (Fri, 10 Aug 2007)
New Revision: 4323
Modified:
stack/native/trunk/.classpath
stack/native/trunk/ant-import/build-thirdparty.xml
stack/native/trunk/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java
stack/native/trunk/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java
stack/native/trunk/src/main/java/org/jboss/ws/core/soap/XMLFragment.java
Log:
[JBWS-1763] - Incorrect handling of charsets when the default charset is not UTF-8.
Modified: stack/native/trunk/.classpath
===================================================================
--- stack/native/trunk/.classpath 2007-08-10 16:29:14 UTC (rev 4322)
+++ stack/native/trunk/.classpath 2007-08-10 16:29:39 UTC (rev 4323)
@@ -38,5 +38,8 @@
<classpathentry combineaccessrules="false" kind="src"
path="/spi"/>
<classpathentry combineaccessrules="false" kind="src"
path="/common"/>
<classpathentry kind="lib" path="thirdparty/junit.jar"/>
+ <classpathentry kind="lib"
path="thirdparty/ejb3.deployer/jboss-ejb3x.jar"/>
+ <classpathentry kind="lib"
path="thirdparty/ejb3.deployer/jboss-ejb3.jar"/>
+ <classpathentry kind="lib"
path="thirdparty/ejb3.deployer/jboss-ejb3.jar"/>
<classpathentry kind="output" path="output/eclipse"/>
</classpath>
Modified: stack/native/trunk/ant-import/build-thirdparty.xml
===================================================================
--- stack/native/trunk/ant-import/build-thirdparty.xml 2007-08-10 16:29:14 UTC (rev 4322)
+++ stack/native/trunk/ant-import/build-thirdparty.xml 2007-08-10 16:29:39 UTC (rev 4323)
@@ -143,8 +143,8 @@
<pathelement
location="${thirdparty.dir}/ejb3.deployer/jboss-annotations-ejb3.jar"/>
<pathelement
location="${thirdparty.dir}/ejb3.deployer/jboss-ejb3x.jar"/>
- <pathelement location="${thirdparty.dir}/ant.jar"/>
- <pathelement location="${thirdparty.dir}/activation.jar"/>
+ <pathelement location="${thirdparty.dir}/ant.jar"/>
+ <pathelement location="${thirdparty.dir}/activation.jar"/>
<pathelement location="${thirdparty.dir}/dom4j.jar"/>
<pathelement location="${thirdparty.dir}/getopt.jar"/>
<pathelement location="${thirdparty.dir}/javassist.jar"/>
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java 2007-08-10
16:29:14 UTC (rev 4322)
+++
stack/native/trunk/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java 2007-08-10
16:29:39 UTC (rev 4323)
@@ -27,6 +27,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
import java.io.Writer;
import javax.xml.transform.stream.StreamResult;
@@ -51,7 +52,7 @@
{
try
{
- IOUtils.copyStream(getOutputStream(), new
ByteArrayInputStream(xmlFragment.getBytes()));
+ IOUtils.copyStream(getOutputStream(), new
ByteArrayInputStream(xmlFragment.getBytes("UTF-8")));
}
catch (IOException e)
{
@@ -85,6 +86,16 @@
public String toString()
{
- return baos.toString();
+ String result = null;
+ try
+ {
+ result = baos.toString("UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ WSException.rethrow(e);
+ }
+
+ return result;
}
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java 2007-08-10
16:29:14 UTC (rev 4322)
+++
stack/native/trunk/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java 2007-08-10
16:29:39 UTC (rev 4323)
@@ -24,6 +24,7 @@
// $Id$
import java.io.ByteArrayOutputStream;
+import java.io.UnsupportedEncodingException;
import javax.xml.namespace.QName;
import javax.xml.rpc.encoding.Deserializer;
@@ -97,7 +98,7 @@
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
StreamResult streamResult = new StreamResult(baos);
tf.newTransformer().transform(source, streamResult);
- xmlFragment = new String(baos.toByteArray());
+ xmlFragment = new String(baos.toByteArray(),"UTF-8");
if (xmlFragment.startsWith("<?xml"))
{
int index = xmlFragment.indexOf(">");
@@ -109,6 +110,10 @@
{
WSException.rethrow(e);
}
+ catch (UnsupportedEncodingException e)
+ {
+ WSException.rethrow(e);
+ }
return xmlFragment;
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java 2007-08-10
16:29:14 UTC (rev 4322)
+++
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java 2007-08-10
16:29:39 UTC (rev 4323)
@@ -30,6 +30,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.io.UnsupportedEncodingException;
import javax.xml.transform.stream.StreamSource;
@@ -112,7 +113,16 @@
{
String retStr = null;
if (bytes != null)
- retStr = new String(bytes);
+ {
+ try
+ {
+ retStr = new String(bytes, "UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ WSException.rethrow(e);
+ }
+ }
else if (chars != null)
retStr = new String(chars);
return "" + retStr;
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/soap/XMLFragment.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/soap/XMLFragment.java 2007-08-10
16:29:14 UTC (rev 4322)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/soap/XMLFragment.java 2007-08-10
16:29:39 UTC (rev 4323)
@@ -177,7 +177,7 @@
Reader reader = streamSource.getReader();
{
if (reader == null)
- reader = new InputStreamReader(streamSource.getInputStream());
+ reader = new InputStreamReader(streamSource.getInputStream(),
"UTF-8");
}
char[] cbuf = new char[1024];