You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2006/09/30 11:32:44 UTC

svn commit: r451567 - in /james/server/trunk/src/java/org/apache/james/fetchmail: MessageProcessor.java ParsedConfiguration.java

Author: norman
Date: Sat Sep 30 02:32:44 2006
New Revision: 451567

URL: http://svn.apache.org/viewvc?view=rev&rev=451567
Log:
Replace InetAddress usage to lookup dns (where its possible). See JAMES-643
Remove some code which was only needed for supporting jdk < 1.4

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

Modified: james/server/trunk/src/java/org/apache/james/fetchmail/MessageProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/fetchmail/MessageProcessor.java?view=diff&rev=451567&r1=451566&r2=451567
==============================================================================
--- james/server/trunk/src/java/org/apache/james/fetchmail/MessageProcessor.java (original)
+++ james/server/trunk/src/java/org/apache/james/fetchmail/MessageProcessor.java Sat Sep 30 02:32:44 2006
@@ -21,7 +21,6 @@
  
 package org.apache.james.fetchmail;
 
-import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -800,15 +799,7 @@
         {
             try
             {
-                InetAddress addr1 = java.net.InetAddress.getLocalHost();
-                // These shenanigans are required to get the fully qualified                 
-                // hostname prior to JDK 1.4 in which getCanonicalHostName()                 
-                // does the job for us                 
-                InetAddress addr2 =
-                    java.net.InetAddress.getByName(addr1.getHostAddress());
-                InetAddress addr3 =
-                    java.net.InetAddress.getByName(addr2.getHostName());
-                domainBuffer.append(addr3.getHostName());
+                domainBuffer.append(java.net.InetAddress.getLocalHost().getCanonicalHostName());
             }
             catch (UnknownHostException ue)
             {
@@ -1477,12 +1468,7 @@
     protected String computeRemoteHostName()
         throws MessagingException, UnknownHostException
     {
-        // These shenanigans are required to get the fully qualified
-        // hostname prior to JDK 1.4 in which get getCanonicalHostName()
-        // does the job for us
-        InetAddress addr1 = getDNSServer().getByName(getRemoteAddress());
-        InetAddress addr2 = getDNSServer().getByName(addr1.getHostAddress());
-        return addr2.getHostName();
+        return getDNSServer().getHostName(getDNSServer().getByName(getRemoteAddress()));
     }        
 
     /**

Modified: james/server/trunk/src/java/org/apache/james/fetchmail/ParsedConfiguration.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/fetchmail/ParsedConfiguration.java?view=diff&rev=451567&r1=451566&r2=451567
==============================================================================
--- james/server/trunk/src/java/org/apache/james/fetchmail/ParsedConfiguration.java (original)
+++ james/server/trunk/src/java/org/apache/james/fetchmail/ParsedConfiguration.java Sat Sep 30 02:32:44 2006
@@ -21,7 +21,6 @@
  
 package org.apache.james.fetchmail;
 
-import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.HashSet;
 import java.util.Set;
@@ -895,12 +894,7 @@
         String hostName = null;
         try
         {
-            // These shenanigans are required to get the fully qualified
-            // hostname prior to JDK 1.4 in which get getCanonicalHostName()
-            // does the job for us
-            InetAddress addr1 = java.net.InetAddress.getLocalHost();
-            InetAddress addr2 = addr1.getByName(addr1.getHostAddress());
-            hostName = addr2.getHostName();
+            hostName = java.net.InetAddress.getLocalHost().getCanonicalHostName();
         }
         catch (UnknownHostException ue)
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org