ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulo Gaspar" <>
Subject RE: modifying optional task code / <mimemail>
Date Mon, 11 Jun 2001 12:49:33 GMT
Hi Erik,

I agree that my coding style is different and that Steve's task is the
way to go - even (besides code style) because he was more careful about
compatibility with the existing mail task.

However, there was an interesting bit you missed in my task: having CC
(Carbon Copy) and BCC (Blind Carbon Copy) recipient lists. For some
tasks these can be (as my data exports (o;= ) they can be quite

There was also had a bug on building filenames for filesets - a base
directory argument was missing for building the File objects.

BUT I just loved the HTML mail thing! It really works!

I made some fixes for the above problems and I send attached to this
mail both my new version of the MimeMail task ("") and a
diff ("patch.txt") of the changes I made.

Going trough the changes as shown in the diff file:
 1- Changed imports to make dependencies explicit on a class-by-class
 2- Added "ccList" and "bccList" properties;
 3- Changed validate() method to reflect the addition of the "ccList"
    and "bccList" properties - now the rule for destination is that
    at least one of "toList", "ccList" and "bccList" properties
    should be filled;
 4- Added addRecipients() helper method which helps on adding the
    addresses for each of the recipient lists. Another change is that
    I use the InternetAddress.parse() method instead of a
    StringTokenizer to build parse those lists;
 5- Fixed the above mentioned bug by using the base directory for
    each file in a file set;
 6- Changed the message of the exception thrown when a file does not
    exist or is not readable (this helped me diagnosing the above
    mentioned bug) in order to also show the absolute path of such

Now I am throwing away my task and using this one.

Have fun,
Paulo Gaspar

> -----Original Message-----
> From: Erik Hatcher []
> Sent: Monday, June 11, 2001 7:19 AM
> To: ant-dev
> Subject: Re: modifying optional task code / <mimemail>
> Stefan, Steve, Paulo, and others interested,
> Attached is a .zip file with my modifications for the JUnitReport task and
> the MimeMail task.   Shall I post the patch difference files also so that
> someone can commit these changes if they are acceptable?
> Note - There has been a change since the 1.3 release to
> XMLJUnitResultFormatter, but my code is built on the 1.3 codebase.
> The MimeMail task that is attached is a modified version of Steve's task.
> I've also included an HTML file in Ant-style describing its
> usage.   I added
> the FileSet capability, and another attribute called 'messageFile' so that
> the message body can be pulled either from the 'message' attribute or from
> the file pointed to by 'messageFile'.   The handy thing about
> 'messageFile'
> is that HTML files can be sent so that e-mail readers will recognize them
> inline rather than as an attachment (but the messageMimeType must be
> specified as "text/html" also).   This is nice when sending
> JUnitReport HTML
> results.
> I will address a few issues that have been brought up:
> - Should we merge MimeMail and Mail?   It would be nice, but is
> unnecessary.
> Its probably not a huge effort, but more effort than its worth
> since whoever
> needs the MimeMail capability can just get the necessary .jar files and
> <taskdef>.
> - Should the other JUnitResultFormatters be modified to pick up the newly
> added properties with the JUnitTask modification?   I looked at the
> PlainJUnitResultFormatter, and did not want to mess with its output as
> someone may be relying on it as-is, but its easy enough for any of these
> formatters to be modified to grab these properties if desired.
> startTestSuite(JUnitTest suite) and  endTestSuite(JUnitTest
> suite) both, of
> course, have access to the JUnitTest and I added a method on JUnitTest
> called getProperties that hands back a Properties object that contains the
> name/value pairs.   Stefan proposed a different method to hand Properties
> off to the formatters - I'm not sure what his proposed method
> gives us that
> mine misses.
> - As for Paulo's task - now that MimeMail has been modified to support
> FileSet's there really isn't much difference except MimeMail has the
> messageMimeType.   MimeMail seems to be more in line with the coding style
> of the other Ant tasks.   I vote we stick with MimeMail and make that an
> optional task.
> - I've included the necessary XSL files to generate an overview of JUnit
> tests.   I only modified overview-summary.xsl (but toolkit.xsl is
> needed in
> the same directory).   I added the display of each test-suites
> properties -
> and in IE5 the display of these properties can be toggled.   I
> didn't spend
> a lot of time making this display of the properties really nice, but the
> good thing is now that they are there in the XML its easy enough to do
> something with them.  Let me know if you have any suggestions on how they
> should be reported.
> - This probably isn't behavior that can be relied upon, but by placing
> JUnitMail.jar into my ANT_HOME/lib directory I'm able to
> <taskdef> MimeMail
> and it works fine, as well as have my modified JUnitTask picked up in the
> classpath prior to the one in optional.jar.   I'm assuming this is because
> the loop in Ant.bat to add the lib .jar files is picking them up
> alphabetically.   Will this work consistently on Windows and
> other platforms
> in this manner if folks are using the wrapper scripts to start Ant?
> Thanks again for everyones assistance,
>     Erik

View raw message