ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/listener MailLogger.java
Date Sun, 21 Apr 2002 18:15:13 GMT
ehatcher    02/04/21 11:15:13

  Modified:    src/main/org/apache/tools/ant/listener MailLogger.java
  Log:
  Enable property expansion when reading MailLogger.properties.file. Also, modified so error
stack trace goes to System.err.
  
  Revision  Changes    Path
  1.10      +12 -11    jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogger.java
  
  Index: MailLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogger.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MailLogger.java	15 Apr 2002 15:33:08 -0000	1.9
  +++ MailLogger.java	21 Apr 2002 18:15:13 -0000	1.10
  @@ -53,6 +53,12 @@
    */
   package org.apache.tools.ant.listener;
   
  +import org.apache.tools.ant.BuildEvent;
  +import org.apache.tools.ant.DefaultLogger;
  +import org.apache.tools.ant.Project;
  +import org.apache.tools.ant.util.StringUtils;
  +import org.apache.tools.mail.MailMessage;
  +
   import java.io.FileInputStream;
   import java.io.IOException;
   import java.io.InputStream;
  @@ -62,12 +68,6 @@
   import java.util.Properties;
   import java.util.StringTokenizer;
   
  -import org.apache.tools.ant.BuildEvent;
  -import org.apache.tools.ant.DefaultLogger;
  -import org.apache.tools.ant.Project;
  -import org.apache.tools.ant.util.StringUtils;
  -import org.apache.tools.mail.MailMessage;
  -
   /**
    *  Buffers log messages from DefaultLogger, and sends an e-mail with the
    *  results. The following Project properties are used to send the mail.
  @@ -94,7 +94,7 @@
    *  MailLogger.properties.file property</i> . Any properties defined in that
    *  file will override Ant properties.
    *
  - * @author Erik Hatcher 
  + * @author Erik Hatcher
    *         <a href="mailto:ehatcher@apache.org">ehatcher@apache.org</a>
    */
   public class MailLogger extends DefaultLogger {
  @@ -135,7 +135,8 @@
   
           for (Enumeration e = fileProperties.keys(); e.hasMoreElements();) {
               String key = (String) e.nextElement();
  -            properties.put(key, fileProperties.getProperty(key));
  +            String value = fileProperties.getProperty(key);
  +            properties.put(key, project.replaceProperties(value));
           }
   
           boolean success = (event.getException() == null);
  @@ -159,7 +160,7 @@
               sendMail(mailhost, from, toList, subject, buffer.toString());
           } catch (Exception e) {
               System.out.println("MailLogger failed to send e-mail!");
  -            e.printStackTrace();
  +            e.printStackTrace(System.err);
           }
       }
   
  @@ -180,13 +181,13 @@
        * @param  properties     Properties to obtain value from
        * @param  name           suffix of property name. "MailLogger." will be
        *      prepended internally.
  -     * @param  defaultValue   value returned if not present in the properties. 
  +     * @param  defaultValue   value returned if not present in the properties.
        *      Set to null to make required.
        * @return                The value of the property, or default value.
        * @exception  Exception  thrown if no default value is specified and the
        *      property is not present in properties.
        */
  -    private String getValue(Hashtable properties, String name, 
  +    private String getValue(Hashtable properties, String name,
                               String defaultValue) throws Exception {
           String propertyName = "MailLogger." + name;
           String value = (String) properties.get(propertyName);
  
  
  

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