Author: scheu
Date: Sat Feb 17 10:57:25 2007
New Revision: 508793

URL: http://svn.apache.org/viewvc?view=rev&rev=508793
Log:
WSCOMMONS-167 WSCOMMONS-168
Contributor: Rich Scheuerle
Removed invalid ";" from content-type generation.  Corrected getBytes() code 
for boundary generation.

Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java?view=diff&rev=508793&r1=508792&r2=508793
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
 Sat Feb 17 10:57:25 2007
@@ -20,6 +20,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PushbackInputStream;
+import java.io.UnsupportedEncodingException;
 import java.util.Set;
 import java.util.TreeMap;
 
@@ -133,9 +134,18 @@
                     "Invalid Content Type Field in the Mime Message"
                     , e);
         }
+        // REVIEW: This conversion is hard-coded to UTF-8.
+        // The complete solution is to respect the charset setting of the 
message.
+        // However this may cause problems in BoundaryDelimittedStream and 
other
+        // lower level classes.
+        
         // Boundary always have the prefix "--".
-        this.boundary = ("--" + contentType.getParameter("boundary"))
-                .getBytes();
+        try {
+            this.boundary = ("--" + contentType.getParameter("boundary"))
+                    .getBytes("UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            throw new OMException(e);
+        }
 
         // do we need to wrap InputStream from a BufferedInputStream before
         // wrapping from PushbackStream

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java?view=diff&rev=508793&r1=508792&r2=508793
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
 Sat Feb 17 10:57:25 2007
@@ -51,7 +51,7 @@
 
             rootMimeBodyPart.addHeader("content-type",
                     "application/xop+xml; charset=" + charSetEncoding +
-                    "; type=\""+SOAPContentType+"\";");
+                    "; type=\""+SOAPContentType+"\"");
             rootMimeBodyPart.addHeader("content-transfer-encoding", "binary");
             rootMimeBodyPart.addHeader("content-id","<"+contentId+">");
 
@@ -97,8 +97,12 @@
         */
     public static void writeMimeBoundary(OutputStream outStream,
                                          String boundary) throws IOException {
+        // REVIEW: This conversion is hard-coded to UTF-8.
+        // The complete solution is to respect the charset setting of the 
message.
+        // However this may cause problems in BoundaryDelimittedStream and 
other
+        // lower level classes.
         outStream.write(new byte[]{45, 45});
-        outStream.write(boundary.getBytes());
+        outStream.write(boundary.getBytes("UTF-8"));
     }
 
     /**
@@ -223,6 +227,7 @@
                    sb.append("; ");
                    sb.append("boundary=");
                    sb.append("\""+innerBoundary+"\"");
+            // REVIEW Should this be getBytes("UTF-8") or getBytes(charset)
                    outputStream.write(sb.toString().getBytes());
                    outputStream.write(CRLF); 
                    StringBuffer sb1 = new StringBuffer();
@@ -230,6 +235,7 @@
                    sb1.append("<");
                    sb1.append(innerPartCID);
                    sb1.append(">");
+                   // REVIEW Should this be getBytes("UTF-8") or 
getBytes(charset)
                        outputStream.write(sb1.toString().getBytes());
                    outputStream.write(CRLF);
                    outputStream.write(CRLF);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to