Yin,Shiwu created JAMES-1554:
--------------------------------

             Summary: 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: 3.0-Beta4 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 unexpected results. I dig into...
(see org.apache.james.mailetcontainer.impl.camel.MatcherSplitter line 130~140)
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);

The variable newMail (a.k.a. matched mail) don't inherit state from the 
original mail.

(see org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor line 
159~166)
.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();

The newMail could be matched by MailStateNotEquals, and it is going to 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