Author: dkulp
Date: Thu May 14 14:53:59 2009
New Revision: 774800

URL: http://svn.apache.org/viewvc?rev=774800&view=rev
Log:
Merged revisions 773693 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r773693 | dkulp | 2009-05-11 16:57:47 -0400 (Mon, 11 May 2009) | 3 lines
  
  If message has attachments, force into mime mode
  If attachment doesn't have an ID, be OK with that.  Don't NPE.
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
    
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 14 14:53:59 2009
@@ -1 +1 @@
-/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691
+/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: 
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java?rev=774800&r1=774799&r2=774800&view=diff
==============================================================================
--- 
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
 (original)
+++ 
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
 Thu May 14 14:53:59 2009
@@ -124,13 +124,16 @@
 
         writer.write("Content-Transfer-Encoding: binary\r\n");
 
-        writer.write("Content-ID: <");
-        if (attachmentId.charAt(0) == '<'
-            && attachmentId.charAt(attachmentId.length() - 1) == '>') {
-            attachmentId = attachmentId.substring(1, attachmentId.length() - 
1);
+        if (attachmentId != null) {
+            writer.write("Content-ID: <");
+            if (attachmentId.charAt(0) == '<'
+                && attachmentId.charAt(attachmentId.length() - 1) == '>') {
+                attachmentId = attachmentId.substring(1, attachmentId.length() 
- 1);
+            }
+            writer.write(URLDecoder.decode(attachmentId, "UTF-8"));
+            writer.write(">\r\n");
         }
-        writer.write(URLDecoder.decode(attachmentId, "UTF-8"));
-        writer.write(">\r\n\r\n");
+        writer.write("\r\n");
     }
 
     /**

Modified: 
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java?rev=774800&r1=774799&r2=774800&view=diff
==============================================================================
--- 
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
 (original)
+++ 
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
 Thu May 14 14:53:59 2009
@@ -47,7 +47,8 @@
         // by declaring the Object.
         Object prop = 
message.getContextualProperty(org.apache.cxf.message.Message.MTOM_ENABLED); 
         boolean mtomEnabled = MessageUtils.isTrue(prop);
-        boolean writeAtts = 
MessageUtils.isTrue(message.getContextualProperty(WRITE_ATTACHMENTS));
+        boolean writeAtts = 
MessageUtils.isTrue(message.getContextualProperty(WRITE_ATTACHMENTS))
+            || (message.getAttachments() != null && 
!message.getAttachments().isEmpty());
         
         if (!mtomEnabled && !writeAtts) {
             return;


Reply via email to