[ 
https://issues.apache.org/jira/browse/JAMES-1554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benoit Tellier closed JAMES-1554.
---------------------------------
    Resolution: Duplicate

> Matched Mail could be routed more than once
> -------------------------------------------
>
>                 Key: JAMES-1554
>                 URL: https://issues.apache.org/jira/browse/JAMES-1554
>             Project: James Server
>          Issue Type: Bug
>          Components: SpoolManager & Processors
>    Affects Versions: 3.0-beta4
>         Environment: James server 3.0-Beta4 on Win7
>            Reporter: Yin,Shiwu
>            Priority: Critical
>         Attachments: 2014-07-21_175109.png
>
>
> While I was debugging a mail with multiple recipients, I found that if the 
> mail was divided into two mails by a matcher, The matched mail was routed 
> again starting from root processor. it could lead to some unexpected results. 
> I dig into...
> (see org.apache.james.mailetcontainer.impl.camel.MatcherSplitter line 130~140)
> {quote}
>                     mail.setRecipients(rcpts);
>                     Mail newMail = new MailImpl(mail);
>                     newMail.setRecipients(matchedRcpts);
>                     // Set a header because the matcher matched. This can be
>                     // used later when processing the route
>                     newMail.setAttribute(MATCHER_MATCHED_ATTRIBUTE, true);
>                     // add the new generated mail to the mails list
>                     mails.add(newMail);
> {quote}
> The variable newMail (a.k.a. matched mail) don't inherit state from the 
> original mail. For example, I configured my Matcher-Mailet pair in the 
> transport processor. the state of the original mail is *transport*, but the 
> state of  newMail is *root*.
> (see org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor line 
> 159~166)
> {quote}
>                     
> .split().method(MatcherSplitter.class).aggregationStrategy(aggr)
>                         .choice().when(new 
> MatcherMatch()).process(mailetProccessor).end()
>                         .choice().when(new 
> MailStateEquals(Mail.GHOST)).process(disposeProcessor).stop().otherwise().process(removePropsProcessor).end()
>                         .choice().when(new 
> MailStateNotEquals(state)).process(stateChangedProcessor).process(completeProcessor).stop().end();
> {quote}
> The newMail could be matched by MatcherMatch, and it is going to be processed 
> by mailetProccessor.
> The newMail could be matched by MailStateNotEquals, and it will be routed 
> again starting from root processor.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to