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

Robert Burrell Donkin commented on JSIEVE-6:
--------------------------------------------

There is also the design issue of where the address list parsing should be 
done. 

Adding a getAddresses(headerName) method to MailAdapter may allow the adapter 
to perform the parsing. The adapter may be able to optimise this or may be able 
to perform more intelligently parsing. However, this is at the cost of a wider 
API. Implementing in Address would have the advantage that it would only need 
to be done correctly in one place. 

> 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
>            Reporter: Vladimir
>            Assignee: Robert Burrell Donkin
>
> 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