Author: darran.lofthouse(a)jboss.com
Date: 2007-08-10 11:48:41 -0400 (Fri, 10 Aug 2007)
New Revision: 4319
Modified:
stack/native/branches/native-2.0/.classpath
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java
stack/native/branches/native-2.0/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/branches/native-2.0/.classpath
===================================================================
--- stack/native/branches/native-2.0/.classpath 2007-08-10 15:03:11 UTC (rev 4318)
+++ stack/native/branches/native-2.0/.classpath 2007-08-10 15:48:41 UTC (rev 4319)
@@ -38,5 +38,6 @@
<classpathentry kind="lib" path="thirdparty/junit.jar"/>
<classpathentry kind="lib" path="thirdparty/jbossws-common.jar"
sourcepath="thirdparty/jbossws-common-src.zip"/>
<classpathentry kind="lib" path="thirdparty/jbossws-spi.jar"
sourcepath="thirdparty/jbossws-spi-src.zip"/>
+ <classpathentry kind="lib"
path="thirdparty/ejb3.deployer/jboss-ejb3.jar"/>
<classpathentry kind="output" path="output/eclipse"/>
</classpath>
Modified:
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java
===================================================================
---
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java 2007-08-10
15:03:11 UTC (rev 4318)
+++
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java 2007-08-10
15:48:41 UTC (rev 4319)
@@ -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/branches/native-2.0/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java
===================================================================
---
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java 2007-08-10
15:03:11 UTC (rev 4318)
+++
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java 2007-08-10
15:48:41 UTC (rev 4319)
@@ -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/branches/native-2.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java
===================================================================
---
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java 2007-08-10
15:03:11 UTC (rev 4318)
+++
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java 2007-08-10
15:48:41 UTC (rev 4319)
@@ -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/branches/native-2.0/src/main/java/org/jboss/ws/core/soap/XMLFragment.java
===================================================================
---
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/soap/XMLFragment.java 2007-08-10
15:03:11 UTC (rev 4318)
+++
stack/native/branches/native-2.0/src/main/java/org/jboss/ws/core/soap/XMLFragment.java 2007-08-10
15:48:41 UTC (rev 4319)
@@ -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];
Show replies by date