This is the usual deep versus shallow copy discussion, and actually both 
methods make sense for different purposes. 
I think we should provide a deep-duplicate or such method, as there might be 
someone out there, who has coded against the shallow copy behaviour.

--Søren

On Friday 09 September 2005 09:45, Stefano Bagnara (JIRA) wrote:
>     [
> http://issues.apache.org/jira/browse/JAMES-421?page=comments#action_1232300
>6 ]
>
> 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.

-- 
Søren Hilmer, M.Sc.
R&D manager             Phone:  +45 72 30 64 00
TietoEnator IT+ A/S     Fax:    +45 72 30 64 40
Ved Lunden 12           Direct: +45 72 30 64 57
DK-8230 Åbyhøj          Email:  soren.hilmer <at> tietoenator.com

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

Reply via email to