[ 
http://issues.apache.org/jira/browse/JAMES-302?page=comments#action_12322681 ] 

Arjan Veenstra commented on JAMES-302:
--------------------------------------

The issue is not specific for localhost. localhost is by no means a special 
name, but is normally declared as 127.0.0.1 in the OS host file. Some testing 
here (on a linux machine) shows that java.net.InetAddress.getByName returns 
addresses specified in the host file, while DNSJava does not. 
When I remove the localhost line in the host file 
java.net.InetAddress.getByName will no longer 'resolve' localhost. When I add 
other lines and they will be 'resolved' by java.net.InetAddress.getByName, but 
not by DNSJava. 

Hostnames within the local domain (as declared in /etc/resolv.conf) are 
correctly resolved by DNSJava overhere. My guess whould be that DNSJava is 
unable to determine the localdomain on (your?) windows machine. 

I seem to remember reading in some RFC that mail should always rely on DNS 
information and should not be delivered base on local host tables, so the 
DNSJava behaviour might just be more correct, at least when it comes to mail 
delivery. (And, sadly, pretty inconvenient in most other situations.)


> Functionality of org.apache.james.dnsserver.DNSServer.getByName(String) is 
> not symetric to java.net.InetAddress.getByName(String)
> ---------------------------------------------------------------------------------------------------------------------------------
>
>          Key: JAMES-302
>          URL: http://issues.apache.org/jira/browse/JAMES-302
>      Project: James
>         Type: Bug
>   Components: DNSServer
>     Versions: 2.2.0
>  Environment: Tested on WIN2000, JDK 1.4.1_01-b01
>     Reporter: Steve Brewin
>     Priority: Minor
>      Fix For: 2.3.0

>
> org.apache.james.dnsserver.DNSServer.getByName(String) does not always return 
> the same result as java.net.InetAddress.getByName(address). Sometimes an 
> exception is thrown when the standard implementation does not.
> When passed a fully qualified domain name the results are the same. When 
> passed a hostname or the special name 'localhost', a 
> java.net.UnknownHostException is thrown by 
> org.apache.james.dnsserver.DNSServer while java.net.InetAddress resolves the 
> addresses correctly.
> This is a critical issue as in v2.2.0 java.net.InetAddress.getByName() has 
> pretty thoroughly been replaced by 
> org.apache.james.dnsserver.DNSServer.getByName(), but in the noted 
> circumstances it doesn't perform the same. Dependent code breaks.
> Here are the contrasting examples...
> // FAILS
> String address = "localhost";
> java.net.InetAddress inetAddress = 
> org.apache.james.dnsserver.DNSServer.getByName(address);
> return inetAddress;
> // FAILS
> String address = "hostname";
> java.net.InetAddress inetAddress = 
> org.apache.james.dnsserver.DNSServer.getByName(address);
> return inetAddress;
> // SUCCEEDS
> String address = "localhost";
> java.net.InetAddress inetAddress = java.net.InetAddress.getByName(address);
> return inetAddress;
> // SUCCEEDS
> String address = "hostname";
> java.net.InetAddress inetAddress = java.net.InetAddress.getByName(address);
> return inetAddress;

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to