InetAddress.java (toString): Use hostname when not null, don't do an explicit reverse getHostName() lookup.

* java/net/InetAddress.java (toString): Use hostname when not null,
        don't do an explicit reverse getHostName() lookup.
        * java/net/Socket.java (setSocketImplFactory): When fac == null throw
        NullPointerException.

From-SVN: r59902
This commit is contained in:
Mark Wielaard 2002-12-07 01:19:02 +00:00 committed by Mark Wielaard
parent 7089914828
commit 081a777dea
3 changed files with 18 additions and 7 deletions

View file

@ -1,6 +1,6 @@
// INetAddress.java -- An Internet Protocol (IP) address.
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation
This file is part of libgcj.
@ -413,12 +413,13 @@ public class InetAddress implements Serializable
*/
public String toString()
{
String hostname = getHostName ();
if (hostname == "")
hostname = getHostAddress ();
return hostname + '/' + getHostAddress ();
String result;
String address = getHostAddress();
if (hostName != null)
result = hostName + "/" + address;
else
result = address;
return result;
}
/**