You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Romin Irani <ri...@insyncinfo.com> on 2002/08/08 19:54:59 UTC
[PATCH] - DOCS - org.apache.ant.tools.listener.MailLogger
Please find the documentation patch for the changes made to the MailLogger.
FILE: docs/manual/listeners.html
...Romin
-----Original Message-----
From: Erik Hatcher [mailto:jakarta-ant@ehatchersolutions.com]
Sent: Thursday, August 08, 2002 7:38 AM
To: Ant Developers List
Subject: Re: [PATCH] - org.apache.ant.tools.listener.MailLogger
Oh, one more thing... how about a documentation patch to the
listeners/loggers docs file? :)) docs/manual/listeners.html
Romin Irani wrote:
> CURRENT ISSUE
> -------------
> There is no way for providing the SMTP port to the MailLogger. The
> MailLogger uses the default constructor for MailMessage as a result of
which
> it is imperative that the SMTP port be running only on 25 (DEFAULT_PORT).
>
> It would be good to provide an additional parameter in the
> MailLogger.properties called MailLogger.port, so that one can also specify
> the SMTP port # instead of just the host name (MailLogger.mailhost)
>
> PATCH DETAILS
> -------------
> 1) The MailLogger now checks for a property named MailLogger.port. If it
is
> not present, it defaults to MailMessage.DEFAULT_PORT.
>
> 2) The sendMail signature is now changed to accomodate a "port" parameter
> also.
>
> 3) The sendMail method now does:
> MailMessage mailMessage = new MailMessage(mailhost, port);
>
> instead of
> MailMessage mailMessage = new MailMessage(mailhost);
>
> Thanks,
> Romin.
>
>
>
> ------------------------------------------------------------------------
>
> Index: jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogger.java
> ===================================================================
> RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogge
r.java,v
> retrieving revision 1.11
> diff -u -r1.11 MailLogger.java
> --- jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogger.java 25
Jul 2002 15:21:03 -0000 1.11
> +++ jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogger.java 7
Aug 2002 14:08:05 -0000
> @@ -72,6 +72,7 @@
> * results. The following Project properties are used to send the mail.
> * <ul>
> * <li> MailLogger.mailhost [default: localhost] - Mail server to
use</li>
> + * <li> MailLogger.port [default: 25] - Default port for SMTP </li>
> *
> * <li> MailLogger.from [required] - Mail "from" address</li>
> * <li> MailLogger.failure.notify [default: true] - Send build failure
> @@ -97,6 +98,7 @@
> * <a href="mailto:ehatcher@apache.org">ehatcher@apache.org</a>
> */
> public class MailLogger extends DefaultLogger {
> +
> /** Buffer in which the message is constructed prior to sending */
> private StringBuffer buffer = new StringBuffer();
>
> @@ -150,13 +152,15 @@
> }
>
> String mailhost = getValue(properties, "mailhost",
"localhost");
> + int port =
Integer.parseInt(getValue(properties,"port",String.valueOf(MailMessage.DEFAU
LT_PORT)));
> +
> String from = getValue(properties, "from", null);
>
> String toList = getValue(properties, prefix + ".to", null);
> String subject = getValue(properties, prefix + ".subject",
> (success) ? "Build Success" : "Build Failure");
>
> - sendMail(mailhost, from, toList, subject, buffer.toString());
> + sendMail(mailhost, port, from, toList, subject,
buffer.toString());
> } catch (Exception e) {
> System.out.println("MailLogger failed to send e-mail!");
> e.printStackTrace(System.err);
> @@ -207,15 +211,16 @@
> * Send the mail
> *
> * @param mailhost mail server
> + * @param port mail server port number
> * @param from from address
> * @param toList comma-separated recipient list
> * @param subject mail subject
> * @param message mail body
> * @exception IOException thrown if sending message fails
> */
> - private void sendMail(String mailhost, String from, String toList,
> + private void sendMail(String mailhost, int port, String from, String
toList,
> String subject, String message) throws
IOException {
> - MailMessage mailMessage = new MailMessage(mailhost);
> + MailMessage mailMessage = new MailMessage(mailhost, port);
>
> mailMessage.from(from);
>
>
>
>
>
> ------------------------------------------------------------------------
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [PATCH] - DOCS - org.apache.ant.tools.listener.MailLogger
Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Applied, thanks!
Romin Irani wrote:
> Please find the documentation patch for the changes made to the MailLogger.
>
> FILE: docs/manual/listeners.html
>
> ...Romin
>
> -----Original Message-----
> From: Erik Hatcher [mailto:jakarta-ant@ehatchersolutions.com]
> Sent: Thursday, August 08, 2002 7:38 AM
> To: Ant Developers List
> Subject: Re: [PATCH] - org.apache.ant.tools.listener.MailLogger
>
>
> Oh, one more thing... how about a documentation patch to the
> listeners/loggers docs file? :)) docs/manual/listeners.html
>
> Romin Irani wrote:
>
>>CURRENT ISSUE
>>-------------
>>There is no way for providing the SMTP port to the MailLogger. The
>>MailLogger uses the default constructor for MailMessage as a result of
>
> which
>
>>it is imperative that the SMTP port be running only on 25 (DEFAULT_PORT).
>>
>>It would be good to provide an additional parameter in the
>>MailLogger.properties called MailLogger.port, so that one can also specify
>>the SMTP port # instead of just the host name (MailLogger.mailhost)
>>
>>PATCH DETAILS
>>-------------
>>1) The MailLogger now checks for a property named MailLogger.port. If it
>
> is
>
>>not present, it defaults to MailMessage.DEFAULT_PORT.
>>
>>2) The sendMail signature is now changed to accomodate a "port" parameter
>>also.
>>
>>3) The sendMail method now does:
>> MailMessage mailMessage = new MailMessage(mailhost, port);
>>
>> instead of
>> MailMessage mailMessage = new MailMessage(mailhost);
>>
>>Thanks,
>>Romin.
>>
>>
>>
>>------------------------------------------------------------------------
>>
>>Index: jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogger.java
>>===================================================================
>>RCS file:
>
> /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogge
> r.java,v
>
>>retrieving revision 1.11
>>diff -u -r1.11 MailLogger.java
>>--- jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogger.java 25
>
> Jul 2002 15:21:03 -0000 1.11
>
>>+++ jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogger.java 7
>
> Aug 2002 14:08:05 -0000
>
>>@@ -72,6 +72,7 @@
>> * results. The following Project properties are used to send the mail.
>> * <ul>
>> * <li> MailLogger.mailhost [default: localhost] - Mail server to
>
> use</li>
>
>>+ * <li> MailLogger.port [default: 25] - Default port for SMTP </li>
>> *
>> * <li> MailLogger.from [required] - Mail "from" address</li>
>> * <li> MailLogger.failure.notify [default: true] - Send build failure
>>@@ -97,6 +98,7 @@
>> * <a href="mailto:ehatcher@apache.org">ehatcher@apache.org</a>
>> */
>> public class MailLogger extends DefaultLogger {
>>+
>> /** Buffer in which the message is constructed prior to sending */
>> private StringBuffer buffer = new StringBuffer();
>>
>>@@ -150,13 +152,15 @@
>> }
>>
>> String mailhost = getValue(properties, "mailhost",
>
> "localhost");
>
>>+ int port =
>
> Integer.parseInt(getValue(properties,"port",String.valueOf(MailMessage.DEFAU
> LT_PORT)));
>
>>+
>> String from = getValue(properties, "from", null);
>>
>> String toList = getValue(properties, prefix + ".to", null);
>> String subject = getValue(properties, prefix + ".subject",
>> (success) ? "Build Success" : "Build Failure");
>>
>>- sendMail(mailhost, from, toList, subject, buffer.toString());
>>+ sendMail(mailhost, port, from, toList, subject,
>
> buffer.toString());
>
>> } catch (Exception e) {
>> System.out.println("MailLogger failed to send e-mail!");
>> e.printStackTrace(System.err);
>>@@ -207,15 +211,16 @@
>> * Send the mail
>> *
>> * @param mailhost mail server
>>+ * @param port mail server port number
>> * @param from from address
>> * @param toList comma-separated recipient list
>> * @param subject mail subject
>> * @param message mail body
>> * @exception IOException thrown if sending message fails
>> */
>>- private void sendMail(String mailhost, String from, String toList,
>>+ private void sendMail(String mailhost, int port, String from, String
>
> toList,
>
>> String subject, String message) throws
>
> IOException {
>
>>- MailMessage mailMessage = new MailMessage(mailhost);
>>+ MailMessage mailMessage = new MailMessage(mailhost, port);
>>
>> mailMessage.from(from);
>>
>>
>>
>>
>>
>>------------------------------------------------------------------------
>>
>>--
>>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
> ------------------------------------------------------------------------
>
> Index: jakarta-ant/docs/manual/listeners.html
> ===================================================================
> RCS file: /home/cvspublic/jakarta-ant/docs/manual/listeners.html,v
> retrieving revision 1.9
> diff -u -r1.9 listeners.html
> --- jakarta-ant/docs/manual/listeners.html 1 Jun 2002 12:26:32 -0000 1.9
> +++ jakarta-ant/docs/manual/listeners.html 8 Aug 2002 17:42:42 -0000
> @@ -121,6 +121,11 @@
> <td width="63%">No, default "localhost"</td>
> </tr>
> <tr>
> + <td width="337">MailLogger.port </td>
> + <td width="63%">SMTP Port for the Mail server</td>
> + <td width="63%">No, default "25"</td>
> + </tr>
> + <tr>
> <td width="337">MailLogger.from</td>
> <td width="63%">Mail "from" address</td>
> <td width="63%">Yes, if mail needs to be sent</td>
>
>
>
> ------------------------------------------------------------------------
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>