noel 2004/04/13 23:41:56 Modified: src/java/org/apache/james/transport Tag: branch_2_1_fcs LinearProcessor.java Log: Fix JAMES-240. Catch ArrayStoreException when a non-MailAddress object is put into a recipient list. Revision Changes Path No revision No revision 1.10.4.7 +11 -3 james-server/src/java/org/apache/james/transport/LinearProcessor.java Index: LinearProcessor.java =================================================================== RCS file: /home/cvs/james-server/src/java/org/apache/james/transport/LinearProcessor.java,v retrieving revision 1.10.4.6 retrieving revision 1.10.4.7 diff -u -r1.10.4.6 -r1.10.4.7 --- LinearProcessor.java 15 Mar 2004 03:54:18 -0000 1.10.4.6 +++ LinearProcessor.java 14 Apr 2004 06:41:56 -0000 1.10.4.7 @@ -471,8 +471,16 @@ * @throws MessagingException when the <code>Collection</code> contains objects that are not <code>MailAddress</code> objects */ private void verifyMailAddresses(Collection col) throws MessagingException { - MailAddress addresses[] = (MailAddress[])col.toArray(new MailAddress[0]); - if (addresses.length != col.size()) { + try { + MailAddress addresses[] = (MailAddress[])col.toArray(new MailAddress[0]); + + // Why is this here? According to the javadoc for + // java.util.Collection.toArray(Object[]), this should + // never happen. The exception will be thrown. + if (addresses.length != col.size()) { + throw new MailetException("The recipient list contains objects other than MailAddress objects"); + } + } catch (ArrayStoreException ase) { throw new MailetException("The recipient list contains objects other than MailAddress objects"); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]