[ 
http://issues.apache.org/jira/browse/JAMES-421?page=comments#action_12323006 ] 

Stefano Bagnara commented on JAMES-421:
---------------------------------------

Here is what it happens in my test:
I send a mail "mail1" to [EMAIL PROTECTED] and [EMAIL PROTECTED] and "original 
body" body.
The first matcher split the mail1 by duplicating it to "mail1-!27120": it then 
remove a recipient from mail1 and the other from mail1-!27120.
mail1 run to the fist MyMailet that change its body to new text 0.
Both Mails run then through the second MyMailet that should change the body of 
one mail to "new text 1" and the body of the other mail to "new text 2".
I then print the 2 bodies: I have 2 messages with "new text 2" body and NO ONE 
with "new text 1".

- AbstractRedirect does correctly clone the MimeMessage after the call to 
MailImpl.duplicate
- Many mailets just use sendMail with the shared MimeMessage: we should add a 
comment to mailetContext sendMails to let the use know that we lock the 
MimeMessage until we processed it and we never change it.
- LinearProcessor (after partial matching) does duplicate and this way sends 
multiple Mails with sharing MimeMessage to the following mailets.

We could solve the issue by cloning the MimeMessage in LinearProcessor but this 
is too easy to exploit: IMHO we should change the duplicate so that we wrap the 
object with a "CopyOnWrite" shield: so we can safely share the MimeMessage also 
when storing it and after multiple operations.



> MailImpls sharing MimeMessage's!
> --------------------------------
>
>          Key: JAMES-421
>          URL: http://issues.apache.org/jira/browse/JAMES-421
>      Project: James
>         Type: Bug
>   Components: James Core
>     Versions: 2.3.0, 2.2.0
>     Reporter: Stefano Bagnara
>     Assignee: Stefano Bagnara
>     Priority: Critical
>      Fix For: 2.3.0
>  Attachments: LinearProcessorTest.java
>
> LinearProcessor match a single recipient for a 2 recipient mail.
> it run "MailImpl.duplicate". duplicate DOES NOT clone the "MimeMessage".
> The following mailet will handle 2 different MailImpl sharing the same 
> MimeMessage.
> Attached is the proving test.

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to