ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant DefaultLogger.java
Date Fri, 14 Jun 2002 11:12:06 GMT
bodewig     2002/06/14 04:12:06

  Modified:    .        Tag: ANT_15_BRANCH WHATSNEW
               src/main/org/apache/tools/ant Tag: ANT_15_BRANCH
                        DefaultLogger.java
  Log:
  Don't swallow empty lines in DefaultLogger.
  
  Patch described by:	Stefan Moebius <stmoebius@yahoo.com>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.263.2.43 +2 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.263.2.42
  retrieving revision 1.263.2.43
  diff -u -r1.263.2.42 -r1.263.2.43
  --- WHATSNEW	14 Jun 2002 10:12:22 -0000	1.263.2.42
  +++ WHATSNEW	14 Jun 2002 11:12:06 -0000	1.263.2.43
  @@ -43,6 +43,8 @@
   
   * the plain mailer would always use port 25 in <mail>.
   
  +* Ant's default logger couls swallow empty lines.
  +
   Other changes:
   --------------
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.38.2.1  +19 -11    jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java
  
  Index: DefaultLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java,v
  retrieving revision 1.38
  retrieving revision 1.38.2.1
  diff -u -r1.38 -r1.38.2.1
  --- DefaultLogger.java	26 Apr 2002 01:02:26 -0000	1.38
  +++ DefaultLogger.java	14 Jun 2002 11:12:06 -0000	1.38.2.1
  @@ -54,8 +54,10 @@
   
   package org.apache.tools.ant;
   
  +import java.io.BufferedReader;
  +import java.io.IOException;
   import java.io.PrintStream;
  -import java.util.StringTokenizer;
  +import java.io.StringReader;
   
   import org.apache.tools.ant.util.StringUtils;
   import org.apache.tools.ant.util.DateUtils;
  @@ -261,18 +263,24 @@
                   tmp.append(label);
                   label = tmp.toString();
   
  -                StringTokenizer tok = new StringTokenizer(event.getMessage(),
  -                                                          "\r\n", false);
  -                boolean first = true;
  -                while (tok.hasMoreTokens()) {
  -                    if (!first) {
  -                        message.append(StringUtils.LINE_SEP);
  +                try {
  +                    BufferedReader r = 
  +                        new BufferedReader(
  +                            new StringReader(event.getMessage()));
  +                    String line = r.readLine();
  +                    boolean first = true;
  +                    while (line != null) {
  +                        if (!first) {
  +                            message.append(StringUtils.LINE_SEP);
  +                        }
  +                        first = false;
  +                        message.append(label).append(line);
  +                        line = r.readLine();
                       }
  -                    first = false;
  -                    message.append(label);
  -                    message.append(tok.nextToken());
  +                } catch (IOException e) {
  +                    // shouldn't be possible
  +                    message.append(label).append(event.getMessage());
                   }
  -
               } else {
                   message.append(event.getMessage());
               }
  
  
  

--
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