Re: svn commit: r1411506 - /cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java

2012-11-20 Thread Sergey Beryozkin

On 20/11/12 09:42, Freeman Fang wrote:

Thanks Sergey.

Dan pointed out we actually needn't CR/LF here at all, please see my last 
comment in CXF-4482.


thanks, I've just seen that too...I guess I'd then only consider the 
addition property if we had a case of the consumer failing to read 
without the extra CR/LF, etc, and it can no be fixed, may be in cases 
like that...


Cheers, Sergey


-
Freeman(Yue) Fang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-11-20, at 下午5:33, Sergey Beryozkin wrote:


Hi
On 20/11/12 02:40, Freeman Fang wrote:

Hi Dan,

But if on unix/linux platform, if we have "\r\n", it interpret as two new line, which can 
cause some service providers can't handle the request, I think what we want should be a "new 
line" here, so use system property line.separator should be OK, please see the initial 
description from CXF-4482[1].


IMHO it has to be 'attachment.line.separator' (to support the legacy providers 
or the ones which can not handle CR/LF) contextual property, using system 
property just won't work because we can have Unix on one end, Win on the other 
end, or vice versa

Sergey



Btw, seems any jira update can't send out mail notification now.

[1]https://issues.apache.org/jira/browse/CXF-4482


Freeman
-
Freeman(Yue) Fang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-11-20, at 上午10:31, Daniel Kulp wrote:



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   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, ff...@apache.org 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
dk...@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com



--
Daniel Kulp
dk...@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com







--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com








Re: svn commit: r1411506 - /cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java

2012-11-20 Thread Freeman Fang
Thanks Sergey.

Dan pointed out we actually needn't CR/LF here at all, please see my last 
comment in CXF-4482.

-
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-11-20, at 下午5:33, Sergey Beryozkin wrote:

> Hi
> On 20/11/12 02:40, Freeman Fang wrote:
>> Hi Dan,
>> 
>> But if on unix/linux platform, if we have "\r\n", it interpret as two new 
>> line, which can cause some service providers can't handle the request, I 
>> think what we want should be a "new line" here, so use system property 
>> line.separator should be OK, please see the initial description from 
>> CXF-4482[1].
>> 
> IMHO it has to be 'attachment.line.separator' (to support the legacy 
> providers or the ones which can not handle CR/LF) contextual property, using 
> system property just won't work because we can have Unix on one end, Win on 
> the other end, or vice versa
> 
> Sergey
> 
> 
>> Btw, seems any jira update can't send out mail notification now.
>> 
>> [1]https://issues.apache.org/jira/browse/CXF-4482
>> 
>> 
>> Freeman
>> -
>> Freeman(Yue) Fang
>> 
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Web: http://fusesource.com | http://www.redhat.com/
>> Twitter: freemanfang
>> Blog: http://freemanfang.blogspot.com
>> http://blog.sina.com.cn/u/1473905042
>> weibo: http://weibo.com/u/1473905042
>> 
>> On 2012-11-20, at 上午10:31, Daniel Kulp wrote:
>> 
>>> 
>>> 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  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, ff...@apache.org 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
 dk...@apache.org - http://dankulp.com/blog
 Talend Community Coder - http://coders.talend.com
 
>>> 
>>> --
>>> Daniel Kulp
>>> dk...@apache.org - http://dankulp.com/blog
>>> Talend Community Coder - http://coders.talend.com
>>> 
>> 
>> 
> 
> 
> -- 
> Sergey Beryozkin
> 
> Talend Community Coders
> http://coders.talend.com/
> 
> Blog: http://sberyozkin.blogspot.com



Re: svn commit: r1411506 - /cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java

2012-11-20 Thread Sergey Beryozkin

Hi
On 20/11/12 02:40, Freeman Fang wrote:

Hi Dan,

But if on unix/linux platform, if we have "\r\n", it interpret as two new line, which can 
cause some service providers can't handle the request, I think what we want should be a "new 
line" here, so use system property line.separator should be OK, please see the initial 
description from CXF-4482[1].

IMHO it has to be 'attachment.line.separator' (to support the legacy 
providers or the ones which can not handle CR/LF) contextual property, 
using system property just won't work because we can have Unix on one 
end, Win on the other end, or vice versa


Sergey



Btw, seems any jira update can't send out mail notification now.

[1]https://issues.apache.org/jira/browse/CXF-4482


Freeman
-
Freeman(Yue) Fang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-11-20, at 上午10:31, Daniel Kulp wrote:



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  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, ff...@apache.org 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
dk...@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com



--
Daniel Kulp
dk...@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com







--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com


Re: svn commit: r1411506 - /cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java

2012-11-19 Thread Daniel Kulp

On Nov 19, 2012, at 10:02 PM, Freeman Fang  wrote:

> Hi Dan,
> 
> Did another commit using org.apache.cxf.common.util.SystemPropertyAction 
> instead of sun.security.action.GetPropertyAction.
> 
> And IMO different platform interpret CRLF with different way, on windows, it 
> need "\r\n",  and on unix/linux, it just need "\n", and system property 
> line.separator exactly can do this job.

No, this is NOT ok.   This is a generated message going TO  a .NET service.  
But we don't know where this message is going.   The current platform that CXF 
is running on has no impact on what the other side of the wire will accept.   
With this change, a windows client will work against a  .NET service, but a 
Unix one won't…  I'm certainly not OK with that.

Dan


> 
> Please let me know if it's OK.
> Thanks
> -
> Freeman(Yue) Fang
> 
> Red Hat, Inc. 
> FuseSource is now part of Red Hat
> Web: http://fusesource.com | http://www.redhat.com/
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: http://weibo.com/u/1473905042
> 
> On 2012-11-20, at 上午10:40, Freeman Fang wrote:
> 
>> Hi Dan,
>> 
>> But if on unix/linux platform, if we have "\r\n", it interpret as two new 
>> line, which can cause some service providers can't handle the request, I 
>> think what we want should be a "new line" here, so use system property 
>> line.separator should be OK, please see the initial description from 
>> CXF-4482[1].
>> 
>> Btw, seems any jira update can't send out mail notification now.
>> 
>> [1]https://issues.apache.org/jira/browse/CXF-4482
>> 
>> 
>> Freeman
>> -
>> Freeman(Yue) Fang
>> 
>> Red Hat, Inc. 
>> FuseSource is now part of Red Hat
>> Web: http://fusesource.com | http://www.redhat.com/
>> Twitter: freemanfang
>> Blog: http://freemanfang.blogspot.com
>> http://blog.sina.com.cn/u/1473905042
>> weibo: http://weibo.com/u/1473905042
>> 
>> On 2012-11-20, at 上午10:31, Daniel Kulp wrote:
>> 
>>> 
>>> 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  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, ff...@apache.org 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
 dk...@apache.org - http://dankulp.com/blog
 Talend Community Coder - http://coders.talend.com
 
>>> 
>>> -- 
>>> Daniel Kulp
>>> dk...@apache.org - http://dankulp.com/blog
>>> Talend Community Coder - http://coders.talend.com
>>> 
>> 
> 

-- 
Daniel Kulp
dk...@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com



Re: svn commit: r1411506 - /cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java

2012-11-19 Thread Freeman Fang
Hi Dan,

Did another commit using org.apache.cxf.common.util.SystemPropertyAction 
instead of sun.security.action.GetPropertyAction.

And IMO different platform interpret CRLF with different way, on windows, it 
need "\r\n",  and on unix/linux, it just need "\n", and system property 
line.separator exactly can do this job.

Please let me know if it's OK.
Thanks
-
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-11-20, at 上午10:40, Freeman Fang wrote:

> Hi Dan,
> 
> But if on unix/linux platform, if we have "\r\n", it interpret as two new 
> line, which can cause some service providers can't handle the request, I 
> think what we want should be a "new line" here, so use system property 
> line.separator should be OK, please see the initial description from 
> CXF-4482[1].
> 
> Btw, seems any jira update can't send out mail notification now.
> 
> [1]https://issues.apache.org/jira/browse/CXF-4482
> 
> 
> Freeman
> -
> Freeman(Yue) Fang
> 
> Red Hat, Inc. 
> FuseSource is now part of Red Hat
> Web: http://fusesource.com | http://www.redhat.com/
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: http://weibo.com/u/1473905042
> 
> On 2012-11-20, at 上午10:31, Daniel Kulp wrote:
> 
>> 
>> 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  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, ff...@apache.org 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
>>> dk...@apache.org - http://dankulp.com/blog
>>> Talend Community Coder - http://coders.talend.com
>>> 
>> 
>> -- 
>> Daniel Kulp
>> dk...@apache.org - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com
>> 
> 



Re: svn commit: r1411506 - /cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java

2012-11-19 Thread Freeman Fang
Hi Dan,

But if on unix/linux platform, if we have "\r\n", it interpret as two new line, 
which can cause some service providers can't handle the request, I think what 
we want should be a "new line" here, so use system property line.separator 
should be OK, please see the initial description from CXF-4482[1].

Btw, seems any jira update can't send out mail notification now.

[1]https://issues.apache.org/jira/browse/CXF-4482


Freeman
-
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-11-20, at 上午10:31, Daniel Kulp wrote:

> 
> 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  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, ff...@apache.org 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
>> dk...@apache.org - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com
>> 
> 
> -- 
> Daniel Kulp
> dk...@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
> 



Re: svn commit: r1411506 - /cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java

2012-11-19 Thread Daniel Kulp

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  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, ff...@apache.org 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
> dk...@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
> 

-- 
Daniel Kulp
dk...@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com



Re: svn commit: r1411506 - /cxf/trunk/api/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java

2012-11-19 Thread Daniel Kulp

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, ff...@apache.org 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
dk...@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com