[ http://issues.apache.org/jira/browse/COCOON-1818?page=comments#action_12372442 ]
Simone Gianni commented on COCOON-1818: --------------------------------------- IMMO, it's a good idea to report an exception indicating that a single email was not sent in the XML report. This is useful to report to the user which email was invialid, and more important since sending a bunch of emails is not transactional, it's not possible to rollback, and this if the entire batch sending is aborted with an exception when an email fails there would be no way to avoid sending some emails more than once. Jasha, you are completely right : if the exception happens before the result element is opened, with my patch it would be closed anyway, so there are three possible solutions : 1) Use a boolean to indicate that the result element was opened, and check this boolean before closing it in the finally. Pros are that it's simple to implement, cons are that the result XML will have sometimes have a result containing an exception, other times only the exception not wrapped inside a result. 2) Open the result element always after everything has been done, so that a result will always contain the result of a good email, while exceptions will always be reported outside the result element. 3) Open the result element always before everything is done, so that an exception will always be wrapped inside a result, wether it happens at the very early stage of email sending or at the last step of it. I think the number 3 is the best one. It should not be that hard to implement, just moving the start element up in the code as much as possible (if possible, at the first line of the sendMail method). Jasha, do you want to try? :) > SendMailTransformer misses closing tag when recipient address is malformed > -------------------------------------------------------------------------- > > Key: COCOON-1818 > URL: http://issues.apache.org/jira/browse/COCOON-1818 > Project: Cocoon > Type: Bug > Components: Blocks: Mail > Reporter: Jasha Joachimsthal > Attachments: sendmail-exceptions.diff > > When a recipient address contains an illegal character (, ; <space> [EMAIL > PROTECTED]@com etc), an exception is being thrown by method sendMail(List > newAddresses, Transport trans). > The execution of the try in method sendMail() is stopped which may have > created a <email:result> tag. > No </email:result> end tag is created when this occurs. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira