You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Pavel Ausianik <Pa...@epam.com> on 2002/11/15 16:22:31 UTC

optimizing write() and StringUtils.lineSeparator

> Hi,
> 
> While doing a patch replacing write(A  +B  +C ) to separated writes I have
> made a mistake. Usually compiler concatenates strings which already
> constants, and I when write following code
> 
>       sink.write('>' + StringUtils.lineSeparator);	
> 
> it will be single constant too. This however does not happens since
> StringUtils.lineSeparator right now is not a Constant in fact but var (it
> assigned after class load).  It defined as follows
> 
>   public static final String lineSeparator =
>     System.getProperty("line.separator", "\n");
> 
> To fix the problem is necessary to either redefine  lineSeparator  like
> 
>   public static final String lineSeparator = "\n";
> 
> or change 6 classes were improper usage appears.
> 
> I think in fact is possible to hardcode separator, since anyway we  use it
> the internet, were we know nothing about other part we communicate to
> (either server or client).
> 
> Best regards,
> Pavel Ausianik
> 

Re: optimizing write() and StringUtils.lineSeparator

Posted by WJCarpenter <bi...@carpenter.org>.
>> I think in fact is possible to hardcode separator, since anyway we
>> use it the internet, were we know nothing about other part we
>> communicate to (either server or client).

That should certainly be true because for both SMTP and HTTP the
header line separator is platform-independent (CRLF pair).  For all
the XML payloads, they'll be consumed by an XML parser which will
treat all the perumations (CRLF, CR, LF, LFCR) the same: ignorable
whitespace.

The one place to be cautious is probably handled by mailapi outside
of SOAP.  The line ending surrounding the MIME boundaries (in the
multipart messages containing SOAP attachments) should be CRLF to
make sure there isn't an off-by-one error during the receiver parse.




Re: optimizing write() and StringUtils.lineSeparator

Posted by WJCarpenter <bi...@carpenter.org>.
>> I think in fact is possible to hardcode separator, since anyway we
>> use it the internet, were we know nothing about other part we
>> communicate to (either server or client).

That should certainly be true because for both SMTP and HTTP the
header line separator is platform-independent (CRLF pair).  For all
the XML payloads, they'll be consumed by an XML parser which will
treat all the perumations (CRLF, CR, LF, LFCR) the same: ignorable
whitespace.

The one place to be cautious is probably handled by mailapi outside
of SOAP.  The line ending surrounding the MIME boundaries (in the
multipart messages containing SOAP attachments) should be CRLF to
make sure there isn't an off-by-one error during the receiver parse.




--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>