[jbossws-commits] JBossWS SVN: r4342 - in legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core: soap and 1 other directory.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Aug 13 11:47:05 EDT 2007


Author: darran.lofthouse at jboss.com
Date: 2007-08-13 11:47:05 -0400 (Mon, 13 Aug 2007)
New Revision: 4342

Modified:
   legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamResult.java
   legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java
   legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java
   legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java
Log:
Set encoding in a few locations.

Modified: legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamResult.java
===================================================================
--- legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamResult.java	2007-08-13 15:40:40 UTC (rev 4341)
+++ legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamResult.java	2007-08-13 15:47:05 UTC (rev 4342)
@@ -28,6 +28,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.Writer;
+import java.io.UnsupportedEncodingException;
 
 import javax.xml.transform.stream.StreamResult;
 
@@ -64,7 +65,7 @@
    {
       return null;
    }
-   
+
    @Override
    public OutputStream getOutputStream()
    {
@@ -82,9 +83,19 @@
    {
       throw new UnsupportedOperationException();
    }
-   
+
    public String toString()
    {
-      return baos.toString();
+      String result = null;
+      try
+      {
+         result = baos.toString("UTF-8");
+      }
+      catch (UnsupportedEncodingException e)
+      {
+         WSException.rethrow(e);
+      }
+
+      return result;
    }
 }

Modified: legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java
===================================================================
--- legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java	2007-08-13 15:40:40 UTC (rev 4341)
+++ legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java	2007-08-13 15:47:05 UTC (rev 4342)
@@ -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: legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java
===================================================================
--- legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java	2007-08-13 15:40:40 UTC (rev 4341)
+++ legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java	2007-08-13 15:47:05 UTC (rev 4342)
@@ -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: legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java
===================================================================
--- legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java	2007-08-13 15:40:40 UTC (rev 4341)
+++ legacy/branches/dlofthouse/ASPATCH-260/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java	2007-08-13 15:47:05 UTC (rev 4342)
@@ -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];




More information about the jbossws-commits mailing list