ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 31969] New: - Mail tasks depends on Java verifier
Date Fri, 29 Oct 2004 17:40:47 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31969>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31969

Mail tasks depends on Java verifier

           Summary: Mail tasks depends on Java verifier
           Product: Ant
           Version: 1.6.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: Matthew.Hawkins@oracle.com


When the Mail task is used with the encoding set to "auto", it attempts to
determine if MIME is available by calling Class.forName() on the
org.apache.tools.ant.taskdefs.email.MimeMailer class.  If this succeeds, it
assumes MIME mail is available and tries to use it.  However, the success of
this operation will depend on the presence of the Java verifier.  This code has
a "catch (Throwable e)".  When the verifier checks the MimeMailer class, it will
also check for the dependancy classes javax.mail.MessagingException and
javax.activation.DataSource classes.  These will only be found if the mail.jar
and activation.jar are on the classpath.  If they are not, a VerifyError is
thrown and the catch clause will fire.  It will then default to the UU encoding,
and the build will succeed, which is the correct behavior for the auto encoding.

However, if the verifier is not being used in the VM, then the Class.forName()
will check for the existance of the MimeMail class, but not the
MessagingException and DataSource classes.  If the mail.jar or activation.jar is
missing from the classpath, no error is thrown, the catch clause will not fire,
and it will continue on its way assuming that it should use MIME.  Later, it
will fail with a NoClassDefFoundError on the MessagingException and DataSource
classes and the Ant build will fail.

To reproduce: 

1) Set your ANT_OPTS environment variable to "-Xverify:none"
2) Try to run an Ant buildfile using the mail task with encoding set to "auto"
3) You will see a NoClassDefFoundError and the build fails

This is a problem for IDE's, which may not be running with the verifier.  If
they try to run Ant in the same VM as the IDE, the mail task will fail.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message