[jbossws-commits] JBossWS SVN: r9684 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Mar 25 07:19:51 EDT 2009


Author: richard.opalka at jboss.com
Date: 2009-03-25 07:19:51 -0400 (Wed, 25 Mar 2009)
New Revision: 9684

Modified:
   stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
Log:
[JBWS-2405] applying user patch fixing WCF interoperability

Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java	2009-03-25 10:30:19 UTC (rev 9683)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java	2009-03-25 11:19:51 UTC (rev 9684)
@@ -23,6 +23,8 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -40,6 +42,7 @@
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 
+import org.jboss.logging.Logger;
 import org.jboss.ws.Constants;
 import org.jboss.ws.WSException;
 import org.jboss.ws.core.CommonMessageContext;
@@ -63,6 +66,8 @@
  */
 public class SOAPMessageImpl extends SOAPMessage implements SOAPMessageAbstraction
 {
+   private static Logger log = Logger.getLogger(SOAPMessageImpl.class);
+   
    private boolean saveRequired = true;
    private MimeHeaders mimeHeaders = new MimeHeaders();
    private List<AttachmentPart> attachments = new LinkedList<AttachmentPart>();
@@ -128,26 +133,50 @@
 
    public AttachmentPart getAttachmentByContentId(String cid) throws SOAPException
    {
+      String cidDecoded = decode(cid);
+      
       for (AttachmentPart part : attachments)
       {
-         String contentId = part.getContentId();
-         if (contentId.equals(cid))
+         String contentIdDecoded = decode(part.getContentId());
+         if (contentIdDecoded.equals(cidDecoded))
             return part;
       }
+
       return null;
    }
+   
+   public String decode(String cid)
+   {
+      String cidDecoded = cid;
+      
+      try
+      {
+         cidDecoded = URLDecoder.decode(cid, "UTF-8");
+      }
+      catch (UnsupportedEncodingException ex)
+      {
+         log.error("Cannot decode name for cid: " + ex);
+      }
+      
+      return cidDecoded;
+   }
 
    public AttachmentPart removeAttachmentByContentId(String cid)
    {
-      for (AttachmentPart part : attachments)
+      try
       {
-         String contentId = part.getContentId();
-         if (contentId.equals(cid))
+         AttachmentPart part = getAttachmentByContentId(cid);
+         if (part != null)
          {
             attachments.remove(part);
             return part;
          }
       }
+      catch (SOAPException ex)
+      {
+         // this used to not throw SOAPException
+         log.error("Ignore SOAPException: " + ex);
+      }
 
       return null;
    }




More information about the jbossws-commits mailing list