noel 2003/07/02 22:25:30
Modified: src/java/org/apache/james/transport/mailets Tag:
branch_2_1_fcs Forward.java
Log:
Ensure that recipient list has no errors, and is not empty.
Revision Changes Path
No revision
No revision
1.6.4.10 +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.6.4.9
retrieving revision 1.6.4.10
diff -u -r1.6.4.9 -r1.6.4.10
--- Forward.java 30 Jun 2003 09:42:07 -0000 1.6.4.9
+++ Forward.java 3 Jul 2003 05:25:30 -0000 1.6.4.10
@@ -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]