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/taskdefs/email Mailer.java MimeMailer.java PlainMailer.java
Date Tue, 18 Jun 2002 07:03:50 GMT
bodewig     2002/06/18 00:03:50

  Modified:    src/main/org/apache/tools/ant/taskdefs/email Tag:
                        ANT_15_BRANCH Mailer.java MimeMailer.java
                        PlainMailer.java
  Log:
  Make "Date" header SMTP compliant in <mail>.
  
  PR: 9838
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.1   +16 -0     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/email/Mailer.java
  
  Index: Mailer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/email/Mailer.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- Mailer.java	14 Apr 2002 11:16:15 -0000	1.4
  +++ Mailer.java	18 Jun 2002 07:03:50 -0000	1.4.2.1
  @@ -53,6 +53,10 @@
    */
   package org.apache.tools.ant.taskdefs.email;
   
  +import java.text.DateFormat;
  +import java.text.SimpleDateFormat;
  +import java.util.Date;
  +import java.util.Locale;
   import java.util.Vector;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Task;
  @@ -76,6 +80,8 @@
       protected Task task;
       protected boolean includeFileNames = false;
   
  +    private static DateFormat df =
  +        new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
   
       /**
        * Sets the mail server
  @@ -194,5 +200,15 @@
        */
       public abstract void send()
            throws BuildException;
  +
  +    /**
  +     * Returns the current Date in a format suitable for a SMTP date
  +     * header.
  +     *
  +     * @since Ant 1.5
  +     */
  +    protected final String getDate() {
  +        return df.format(new Date());
  +    }
   }
   
  
  
  
  1.6.2.1   +1 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
  
  Index: MimeMailer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- MimeMailer.java	23 Apr 2002 20:42:58 -0000	1.6
  +++ MimeMailer.java	18 Jun 2002 07:03:50 -0000	1.6.2.1
  @@ -61,7 +61,6 @@
   import java.util.Enumeration;
   import java.util.Properties;
   import java.util.Vector;
  -import java.util.Date;
   import javax.activation.DataHandler;
   import javax.activation.FileDataSource;
   import javax.mail.Message;
  @@ -117,7 +116,7 @@
               if (subject != null) {
                   msg.setSubject(subject);
               }
  -            msg.addHeader("Date", (new Date()).toString());
  +            msg.addHeader("Date", getDate());
   
               ByteArrayOutputStream baos = new ByteArrayOutputStream();
               PrintStream out = new PrintStream(baos);
  
  
  
  1.5.2.2   +1 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/email/PlainMailer.java
  
  Index: PlainMailer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/email/PlainMailer.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- PlainMailer.java	14 Jun 2002 10:12:22 -0000	1.5.2.1
  +++ PlainMailer.java	18 Jun 2002 07:03:50 -0000	1.5.2.2
  @@ -59,7 +59,6 @@
   import java.io.IOException;
   import java.io.PrintStream;
   import java.util.Enumeration;
  -import java.util.Date;
   
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.mail.MailMessage;
  @@ -103,7 +102,7 @@
                   mailMessage.setSubject(subject);
               }
   
  -            mailMessage.setHeader("Date", (new Date()).toString());
  +            mailMessage.setHeader("Date", getDate());
               mailMessage.setHeader("Content-Type", message.getMimeType());
   
               PrintStream out = mailMessage.getPrintStream();
  
  
  

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