noel        2003/07/02 22:27:45

  Modified:    src/java/org/apache/james/transport/mailets Forward.java
  Log:
  Ensure that recipient list has no errors, and is not empty.
  
  Revision  Changes    Path
  1.17      +18 -12    
james-server/src/java/org/apache/james/transport/mailets/Forward.java
  
  Index: Forward.java
  ===================================================================
  RCS file: 
/home/cvs/james-server/src/java/org/apache/james/transport/mailets/Forward.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Forward.java      30 Jun 2003 09:41:03 -0000      1.16
  +++ Forward.java      3 Jul 2003 05:27:45 -0000       1.17
  @@ -148,20 +148,26 @@
        * @return the <CODE>recipients</CODE> init parameter or null if missing
        */
       protected Collection getRecipients() throws MessagingException {
  -        Collection newRecipients = new HashSet();
  +        Collection newRecipients = null;
  +        boolean error = false;
           String addressList = getInitParameter("forwardto");
  -        // if nothing was specified, return null meaning no change
  -        if (addressList == null) {
  -            return null;
  -        }
  -        StringTokenizer st = new StringTokenizer(addressList, ",", false);
  -        while(st.hasMoreTokens()) {
  -            try {
  -                newRecipients.add(new MailAddress(st.nextToken()));
  -            } catch(Exception e) {
  -                log("add recipient failed in getRecipients");
  +        if (addressList != null) {
  +            newRecipients = new HashSet();
  +            StringTokenizer st = new StringTokenizer(addressList, ",", false);
  +            while(st.hasMoreTokens()) {
  +                String recipient = st.nextToken();
  +                try {
  +                    newRecipients.add(new MailAddress(recipient));
  +                } catch(Exception e) {
  +                    log("Add \"" + recipient + "\" failed", e);
  +                    error = true;
  +                }
               }
           }
  +        if (error || newRecipients == null || newRecipients.size() == 0) {
  +            throw new MessagingException("Failed to initialize recipient list; see 
mailet log.");
  +        }
  +
           return newRecipients;
       }
   
  
  
  

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

Reply via email to