ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbaill...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant DefaultLogger.java
Date Sat, 15 Dec 2001 00:32:32 GMT
sbailliez    01/12/14 16:32:32

  Modified:    src/main/org/apache/tools/ant DefaultLogger.java
  Log:
  Take advantage of StringUtils
  
  Revision  Changes    Path
  1.23      +13 -13    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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- DefaultLogger.java	2001/12/11 15:06:23	1.22
  +++ DefaultLogger.java	2001/12/15 00:32:32	1.23
  @@ -58,6 +58,8 @@
   import java.io.PrintWriter;
   import java.io.StringWriter;
   
  +import org.apache.tools.ant.util.StringUtils;
  +
   /**
    *  Writes build event to a PrintStream. Currently, it
    *  only writes which targets are being executed, and
  @@ -71,8 +73,6 @@
       protected int msgOutputLevel = Project.MSG_ERR;
       private long startTime = System.currentTimeMillis();
   
  -    protected static String lSep = System.getProperty("line.separator");
  -
       protected boolean emacsMode = false;
   
       /**
  @@ -134,29 +134,29 @@
           StringBuffer message = new StringBuffer();
   
           if (error == null) {
  -            message.append(lSep + "BUILD SUCCESSFUL");
  +            message.append(StringUtils.LINE_SEP);
  +            message.append("BUILD SUCCESSFUL");
           }
           else {
  -            message.append(lSep + "BUILD FAILED" + lSep);
  +            message.append(StringUtils.LINE_SEP);
  +            message.append("BUILD FAILED");
  +            message.append(StringUtils.LINE_SEP);
   
               if (Project.MSG_VERBOSE <= msgOutputLevel ||
                   !(error instanceof BuildException)) {
  -                StringWriter sw = new StringWriter();
  -                PrintWriter pw = new PrintWriter(sw);
  -                error.printStackTrace(pw);
  -                message.append(sw.toString());
  +                message.append(StringUtils.getStackTrace(error));
               }
               else {
                   if (error instanceof BuildException) {
  -                    message.append(error.toString() + lSep);
  +                    message.append(error.toString()).append(StringUtils.LINE_SEP);
                   }
                   else {
  -                    message.append(error.getMessage() + lSep);
  +                    message.append(error.getMessage()).append(StringUtils.LINE_SEP);
                   }
               }
           }
  -
  -        message.append(lSep + "Total time: "
  +        message.append(StringUtils.LINE_SEP);
  +        message.append("Total time: "
                          + formatTime(System.currentTimeMillis() - startTime));
   
           String msg = message.toString();
  @@ -170,7 +170,7 @@
   
       public void targetStarted(BuildEvent event) {
           if (Project.MSG_INFO <= msgOutputLevel) {
  -            String msg = lSep + event.getTarget().getName() + ":";
  +            String msg = StringUtils.LINE_SEP + event.getTarget().getName() + ":";
               out.println(msg);
               log(msg);
           }
  
  
  

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