ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Moebius <stmoeb...@yahoo.com>
Subject Re: <echo> multiline output
Date Tue, 04 Jun 2002 07:09:24 GMT
A solution for this seems to be to replace the StringTokenizer by
BufferedReader(StringReader(event.getMessage())). Do you want me to
come up with a patch?

Stefan

--- Stefan Moebius <stmoebius@yahoo.com> wrote:
> > Another strange thing -- your original <echo> task does result in
> an
> > empty line in the middle in 1.5 if you include the -emacs
> command-line
> > flag:
> 
> Ok, I had a look a
> org.apache.tools.ant.DefaultLogger.messageLogged():
> If -emacs mode is off, a StringTokenizer is used to split the message
> into lines. The tokenizer does not return delimiters, which is why 
> <echo>
>   Some text${line.separator}
> 
>   Some more text.
> </echo>
> 
> does not get you an empty line. Likewise,
> 
> <echo>
>   Some text
> ${line.separator}
>   Some more text.
> </echo>
> 
> does not print the empty line, because the line contains only
> "\n\r\n\r" which is skipped by the tokenizer. On the other hand
> 
>  ${line.separator}
> 
> results in " \n\r\n\r" and the tokenizer returns the space (" ") and
> you get the empty line.
> 
> In -emacs mode, the message passed to messageLogged() is simply
> output.
> 
> Conclusion:
> The XML parser does not influence the output of the empty line, the
> only thing you need is the whitespace in that line, since most
> editors
> remove lonely spaces at line ends, you need something to protect the
> space that doesn't print. ${line.separator} or 
 do the job.
> 
> Probably a better solution would be to change DefaultLogger to also
> print empty lines?
> 
> Stefan
> 
> =====
> Stefan Moebius       <stmoebius@yahoo.com> 
>   Wurzener Str. 43        +49 351 8475827
>   01127 Dresden           +49 172 8739617
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
> 
> --
> To unsubscribe, e-mail:  
> <mailto:ant-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-dev-help@jakarta.apache.org>
> 


=====
Stefan Moebius       <stmoebius@yahoo.com> 
  Wurzener Str. 43        +49 351 8475827
  01127 Dresden           +49 172 8739617

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message