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

Robert Burrell Donkin closed JSIEVE-6.
--------------------------------------

    Resolution: Fixed

Forked jtt schema from Mime4J for sample and test implementations of 
MailAdapter. JAMES implementation will use Mime4J directly. Corrected 
inheritance hierarchy,

> There is a bug while processing email addresses in Address class
> ----------------------------------------------------------------
>
>                 Key: JSIEVE-6
>                 URL: https://issues.apache.org/jira/browse/JSIEVE-6
>             Project: jSieve
>          Issue Type: Bug
>    Affects Versions: 0.2
>            Reporter: Vladimir
>            Assignee: Robert Burrell Donkin
>             Fix For: 0.2
>
>
> An email can contain multiple recipients in header. They are separated with 
> ",". Method match in class Address fails to parse this situation.
> Buggy method:protected boolean match(MailAdapter mail,
>                             String addressPart,
>                             String comparator,
>                             String matchType,
>                             String headerName,
>                             String key)
>             throws SieveException
> You'd better replace it's content part:
>                 isMatched =
>                         match(addressPart,
>                               comparator,
>                               matchType,
>                               ((String) headerValuesIter.next()),
>                               key);
> with:
>             final String headerValues = ((String) headerValuesIter.next());
>             StringTokenizer stringTokenizer = new 
> StringTokenizer(headerValues, ",");
>             while(!isMatched && stringTokenizer.hasMoreTokens()){
>                 isMatched =
>                         match(addressPart,
>                               comparator,
>                               matchType,
>                               stringTokenizer.nextToken(),
>                               key);
>             }
> You'll get such a new method:
>     protected boolean match(MailAdapter mail,
>                             String addressPart,
>                             String comparator,
>                             String matchType,
>                             String headerName,
>                             String key)
>             throws SieveException {
>         Iterator headerValuesIter =
>                 getMatchingValues(mail, headerName).iterator();
>         boolean isMatched = false;
>         while (!isMatched && headerValuesIter.hasNext()) {
>             final String headerValues = ((String) headerValuesIter.next());
>             StringTokenizer stringTokenizer = new 
> StringTokenizer(headerValues, ",");
>             while(!isMatched && stringTokenizer.hasMoreTokens()){
>                 isMatched =
>                         match(addressPart,
>                               comparator,
>                               matchType,
>                               stringTokenizer.nextToken(),
>                               key);
>             }
>         }
>         return isMatched;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to