JDK-4916158 : RFE:Add isReverseResolved to InetSocketAddress
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 1.4.2,5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2003-09-02
  • Updated: 2006-12-13
  • Resolved: 2006-12-13
Related Reports
Relates :  
Description
Name: rmT116609			Date: 09/02/2003


A DESCRIPTION OF THE REQUEST :
It would be nice if one could check to see if reverse DNS would be required before calling getHostName().

For instance HTTP logging code could do something like this:

InetSocketAddress a = (InetSocketAddress)socket.getLocalSocketAddress();
if (a.isReverseResolved()) {
  out.print(a.getHostName());
} else {
  out.print(a.getAddress().getHostAddress());
}


JUSTIFICATION :
In various circumstances, such as logging HTTP requests, it is useful to provide a DNS name, but not worth the performance hit if the address has not be reverse resolved, particularly if there is a risk that address has no corresponding DNS name.  To support this it would be nice if a new method isReverseResolved() was added to InetSocketAddress.
(Incident Review ID: 201605) 
======================================================================

Comments
EVALUATION The InetSocketAddress.getHostString() method, introduced in jdk7, does provide the needed functionality since it does guarantee that no reverse lookup will happen.
13-12-2006

EVALUATION There is some value in the suggestion but I'm not quite sure this is the proper way to solve the problem. Too late for Tiger anyway, so will examine for mustang. ###@###.### 2003-09-04
04-09-2003