Author: norman
Date: Wed Oct 27 10:05:05 2010
New Revision: 1027884

URL: http://svn.apache.org/viewvc?rev=1027884&view=rev
Log:
Correctly parse ipaddresses which are enclosed by () (JAMES-344)

Modified:
    
james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java

Modified: 
james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java?rev=1027884&r1=1027883&r2=1027884&view=diff
==============================================================================
--- 
james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java
 (original)
+++ 
james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java
 Wed Oct 27 10:05:05 2010
@@ -1451,12 +1451,20 @@ public class MessageProcessor extends Pr
         String validatedAddress = null;
         int ipAddressStart = domain.indexOf('[');
         int ipAddressEnd = -1;
-        if (ipAddressStart > -1)
+        
+        if (ipAddressStart > -1) {
             ipAddressEnd = domain.indexOf(']', ipAddressStart);
-        if (ipAddressEnd > -1)
+        } else {
+            // Handle () which enclose the ipaddress
+            // See JAMES-344
+            ipAddressStart = domain.indexOf('(');
+            if (ipAddressStart > -1) {
+                ipAddressEnd = domain.indexOf(')', ipAddressStart);
+            }
+        }
+        if (ipAddressEnd > -1) {
             address = domain.substring(ipAddressStart + 1, ipAddressEnd);
-        else
-        {
+        } else{
             int hostNameEnd = domain.indexOf(' ');
             if (hostNameEnd == -1)
                 hostNameEnd = domain.length();



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to