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

Yin,Shiwu updated JAMES-1554:
-----------------------------

    Description: 
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.


  was:
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 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 MailStateNotEquals, and it is going to be 
routed again starting from root processor.



> 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
>
> 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
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to