You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Moebius <st...@yahoo.com> on 2002/06/03 15:42:24 UTC

multiline output

<echo>
  This is only a demo.

  Specifically, a demo with an empty line in the middle.
</echo>

... produces different output using ant 1.4.1 or ant 1.5beta1/2:
ant 1.4.1:

>     [echo]
>  This is only a demo.
>
>  Specifically, a demo with an empty line in the middle.

ant 1.5beta2:

>     [echo]   This is only a demo.
>     [echo]   Specifically, a demo with an empty line in the middle.

I check the changes documentation but couldn't find anything related to
the <echo> task. Is the behavior of 1.5b2 intended? If so, how can I
get a linefeed to appear in the output?

Cheers,
Stefan

=====
Stefan Moebius       <st...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: multiline output

Posted by Stefan Moebius <st...@yahoo.com>.
--- Stefan Bodewig <bo...@apache.org> wrote:
> On Tue, 4 Jun 2002, Stefan Moebius <st...@yahoo.com> wrote:
> 
> > A solution for this seems to be to replace the StringTokenizer by
> > BufferedReader(StringReader(event.getMessage())).
> 
> Done in the 1.5 branch, could you please confirm it fixed the bug?

Yup, fixed. 

> > Do you want me to come up with a patch?
> 
> Don't ask, submit ;-)

Sorry, next time ;-)

Stefan

=====
Stefan Moebius       <st...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: multiline output

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 4 Jun 2002, Stefan Moebius <st...@yahoo.com> wrote:

> A solution for this seems to be to replace the StringTokenizer by
> BufferedReader(StringReader(event.getMessage())).

Done in the 1.5 branch, could you please confirm it fixed the bug?

> Do you want me to come up with a patch?

Don't ask, submit ;-)

Stefan

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


Re: multiline output

Posted by Stefan Moebius <st...@yahoo.com>.
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 <st...@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       <st...@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:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
Stefan Moebius       <st...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: multiline output

Posted by Stefan Moebius <st...@yahoo.com>.
> 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 &#xa; do the job.

Probably a better solution would be to change DefaultLogger to also
print empty lines?

Stefan

=====
Stefan Moebius       <st...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: multiline output

Posted by Diane Holt <ho...@yahoo.com>.
--- Stefan Moebius <st...@yahoo.com> wrote:
> Mmh. Strange.

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:

$ ant echoit
echoit:
     [echo]   This is only a demo.
     [echo]   Specifically, a demo with an empty line in the middle.

$ ant -emacs echoit
echoit:

  This is only a demo.

  Specifically, a demo with an empty line in the middle.

Diane



=====
(holtdl@yahoo.com)



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

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


Re: multiline output

Posted by Stefan Moebius <st...@yahoo.com>.
Mmh. Strange.

<echo>
  This is only a demo.
  ${line.separator}
  Specifically, a demo with an empty line in the middle.
</echo>

..does the job, while

<echo>
  This is only a
demo.${line.separator}${line.separator}${line.separator}
  Specifically, a demo with an empty line in the middle.
</echo>

does not. Same result with &#xa;

Thank you anyway,

Stefan

--- Erik Hatcher <ja...@ehatchersolutions.com> wrote:
> This is probably due to the change in XML parser that we're using. 
> Have you
> tried using a CDATA section?  That might fix the multiline output. 
> Or
> probably using ${line.separator} (I think) or XML entities (like
> 
) .
> 
>     Erik
> 
> 
> ----- Original Message -----
> From: "Stefan Moebius" <st...@yahoo.com>
> To: <an...@jakarta.apache.org>
> Sent: Monday, June 03, 2002 9:42 AM
> Subject: <echo> multiline output
> 
> 
> > <echo>
> >   This is only a demo.
> >
> >   Specifically, a demo with an empty line in the middle.
> > </echo>
> >
> > ... produces different output using ant 1.4.1 or ant 1.5beta1/2:
> > ant 1.4.1:
> >
> > >     [echo]
> > >  This is only a demo.
> > >
> > >  Specifically, a demo with an empty line in the middle.
> >
> > ant 1.5beta2:
> >
> > >     [echo]   This is only a demo.
> > >     [echo]   Specifically, a demo with an empty line in the
> middle.
> >
> > I check the changes documentation but couldn't find anything
> related to
> > the <echo> task. Is the behavior of 1.5b2 intended? If so, how can
> I
> > get a linefeed to appear in the output?
> >
> > Cheers,
> > Stefan
> >
> > =====
> > Stefan Moebius       <st...@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:  
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
Stefan Moebius       <st...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: multiline output

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
This is probably due to the change in XML parser that we're using.  Have you
tried using a CDATA section?  That might fix the multiline output.  Or
probably using ${line.separator} (I think) or XML entities (like &#xa;) .

    Erik


----- Original Message -----
From: "Stefan Moebius" <st...@yahoo.com>
To: <an...@jakarta.apache.org>
Sent: Monday, June 03, 2002 9:42 AM
Subject: <echo> multiline output


> <echo>
>   This is only a demo.
>
>   Specifically, a demo with an empty line in the middle.
> </echo>
>
> ... produces different output using ant 1.4.1 or ant 1.5beta1/2:
> ant 1.4.1:
>
> >     [echo]
> >  This is only a demo.
> >
> >  Specifically, a demo with an empty line in the middle.
>
> ant 1.5beta2:
>
> >     [echo]   This is only a demo.
> >     [echo]   Specifically, a demo with an empty line in the middle.
>
> I check the changes documentation but couldn't find anything related to
> the <echo> task. Is the behavior of 1.5b2 intended? If so, how can I
> get a linefeed to appear in the output?
>
> Cheers,
> Stefan
>
> =====
> Stefan Moebius       <st...@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:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


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