noel 2004/08/19 20:39:35 Modified: src/java/org/apache/james/transport/mailets Tag: branch_2_1_fcs RemoteDelivery.java Log: Fix JAMES-318. JAMES-318 was identical to JAMES-236 except for the location of the code. The fix is essentially the same one used to fix JAMES-236. Revision Changes Path No revision No revision 1.33.4.22 +15 -8 james-server/src/java/org/apache/james/transport/mailets/RemoteDelivery.java Index: RemoteDelivery.java =================================================================== RCS file: /home/cvs/james-server/src/java/org/apache/james/transport/mailets/RemoteDelivery.java,v retrieving revision 1.33.4.21 retrieving revision 1.33.4.22 diff -u -r1.33.4.21 -r1.33.4.22 --- RemoteDelivery.java 2 May 2004 06:08:37 -0000 1.33.4.21 +++ RemoteDelivery.java 20 Aug 2004 03:39:35 -0000 1.33.4.22 @@ -1094,12 +1094,14 @@ private Iterator addresses = null; public boolean hasNext() { - return gateways.hasNext(); - } - - public Object next() { - if (addresses == null || !addresses.hasNext()) - { + /* Make sure that when next() is called, that we can + * provide a HostAddress. This means that we need to + * have an inner iterator, and verify that it has + * addresses. We could, for example, run into a + * situation where the next gateway didn't have any + * valid addresses. + */ + if ((addresses == null || !addresses.hasNext()) && gateways.hasNext()) do { String server = (String) gateways.next(); String port = "25"; @@ -1134,7 +1136,12 @@ log("Unknown gateway host: " + uhe.getMessage().trim()); log("This could be a DNS server error or configuration error."); } - } + } while (!addresses.hasNext() && gateways.hasNext()); + + return addresses != null && addresses.hasNext(); + } + + public Object next() { return (addresses != null) ? addresses.next() : null; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]