ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r704496 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/listener/MailLogger.java src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java src/main/org/apache/tools/ant/taskdefs/email/PlainMailer.java
Date Tue, 14 Oct 2008 11:59:51 GMT
Author: bodewig
Date: Tue Oct 14 04:59:50 2008
New Revision: 704496

URL: http://svn.apache.org/viewvc?rev=704496&view=rev
Log:
Fix potential NPE in mailers, remove root cause of NPE reported in PR 44009.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/PlainMailer.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=704496&r1=704495&r2=704496&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Oct 14 04:59:50 2008
@@ -244,6 +244,9 @@
    worked if JavaMail was available.
    Bugzilla Report 42389.
 
+ * MailLogger could cause a NullPointerException.
+   Bugzilla Report 44009.
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java?rev=704496&r1=704495&r2=704496&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java Tue Oct 14 04:59:50
2008
@@ -355,6 +355,7 @@
         mailer.setBccList(new Vector());
         mailer.setFiles(new Vector());
         mailer.setSubject(values.subject());
+        mailer.setHeaders(new Vector());
         mailer.send();
     }
     private Vector vectorizeEmailAddresses(String listString) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java?rev=704496&r1=704495&r2=704496&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java Tue Oct 14
04:59:50 2008
@@ -202,10 +202,12 @@
             }
             msg.addHeader("Date", getDate());
 
+            if (headers != null) {
             for (Iterator iter = headers.iterator(); iter.hasNext();) {
                 Header h = (Header) iter.next();
                 msg.addHeader(h.getName(), h.getValue());
             }
+            }
             PrintStream out = new PrintStream(sds.getOutputStream());
             message.print(out);
             out.close();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/PlainMailer.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/PlainMailer.java?rev=704496&r1=704495&r2=704496&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/PlainMailer.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/PlainMailer.java Tue Oct 14
04:59:50 2008
@@ -71,11 +71,13 @@
             } else {
                 mailMessage.setHeader("Content-Type", message.getMimeType());
             }
+            if (headers != null) {
             e = headers.elements();
             while (e.hasMoreElements()) {
                 Header h = (Header) e.nextElement();
                 mailMessage.setHeader(h.getName(), h.getValue());
             }
+            }
             PrintStream out = mailMessage.getPrintStream();
             message.print(out);
 



Mime
View raw message