Actually, more importantly, this makes the payload different depending on if its from Unix or Windows. According to the mid spec:
http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html (section 7.2.1) it should always be a CRLF, so the code would be updated to always use that for the attachment boundaries. Dan On Nov 19, 2012, at 9:21 PM, Daniel Kulp <[email protected]> wrote: > > Umm… don't use anything from sun.* packages. You can use > org.apache.cxf.common.util.SystemPropertyAction if that works. > > > Dan > > > > On Nov 19, 2012, at 8:56 PM, [email protected] wrote: > >> Author: ffang >> Date: Tue Nov 20 01:56:17 2012 >> New Revision: 1411506 >> >> URL: http://svn.apache.org/viewvc?rev=1411506&view=rev >> Log: >> [CXF-4482]get line.separator system property ensure CR/LF works across >> platforms >> >> Modified: >> >> cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java >> >> Modified: >> cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java >> URL: >> http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java?rev=1411506&r1=1411505&r2=1411506&view=diff >> ============================================================================== >> --- >> cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java >> (original) >> +++ >> cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java >> Tue Nov 20 01:56:17 2012 >> @@ -153,7 +153,9 @@ public class AttachmentSerializer { >> encoding = "UTF-8"; >> } >> StringWriter writer = new StringWriter(); >> - writer.write("\n"); >> + String lineSeparator = java.security.AccessController.doPrivileged( >> + new sun.security.action.GetPropertyAction("line.separator")); >> + writer.write(lineSeparator); >> writer.write("--"); >> writer.write(bodyBoundary); >> >> >> > > -- > Daniel Kulp > [email protected] - http://dankulp.com/blog > Talend Community Coder - http://coders.talend.com > -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
