src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/MtomCodec.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -110,13 +110,19 @@
     public ContentType getStaticContentType(Packet packet) {
         return getStaticContentTypeStatic(packet, version);
     }
 
     public static ContentType getStaticContentTypeStatic(Packet packet, SOAPVersion version) {
-        ContentType ct = (ContentType) packet.getInternalContentType();
-        if ( ct != null ) return ct;
-
+        ContentTypeImpl ct = (ContentTypeImpl) packet.getInternalContentType();
+        if ( ct != null ) {
+                //Note - this case of boundary = null or root content ID = null should never happen
+                //after a recent bug fix in Packet.shouldUseMtom logic, but just in
+                //case we get here with a Packet that has a non-null content type with
+                //a null boundary, the content type of the Packet will be reset
+                if (ct.getBoundary() != null && ct.getRootId() != null)
+                        return ct;
+        }
         String uuid = UUID.randomUUID().toString();
         String boundary = "uuid:" + uuid;
         String rootId = "<rootpart*"+uuid+"@example.jaxws.sun.com>";
         String soapActionParameter = SOAPVersion.SOAP_11.equals(version) ?  null : createActionParameter(packet);
 

@@ -325,11 +331,11 @@
         // Use default encoding for client-side request messages
         return SOAPBindingCodec.DEFAULT_ENCODING;
     }
 
     public static class MtomStreamWriterImpl extends XMLStreamWriterFilter implements XMLStreamWriterEx,
-            MtomStreamWriter, HasEncoding {
+    com.sun.xml.internal.org.jvnet.staxex.util.MtomStreamWriter, HasEncoding {
         private final List<ByteArrayBuffer> mtomAttachments;
         private final String boundary;
         private final MTOMFeature myMtomFeature;
         public MtomStreamWriterImpl(XMLStreamWriter w, List<ByteArrayBuffer> mtomAttachments, String b, MTOMFeature myMtomFeature) {
             super(w);