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,3 +1,10 @@
2002-12-06 Mark Wielaard <mark@klomp.org>
* 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.
2002-12-06 Tom Tromey <tromey@redhat.com> 2002-12-06 Tom Tromey <tromey@redhat.com>
* include/java-interp.h (class _Jv_InterpMethod): Added * include/java-interp.h (class _Jv_InterpMethod): Added

View File

@ -1,6 +1,6 @@
// INetAddress.java -- An Internet Protocol (IP) address. // 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. This file is part of libgcj.
@ -413,12 +413,13 @@ public class InetAddress implements Serializable
*/ */
public String toString() public String toString()
{ {
String hostname = getHostName (); String result;
String address = getHostAddress();
if (hostname == "") if (hostName != null)
hostname = getHostAddress (); result = hostName + "/" + address;
else
return hostname + '/' + getHostAddress (); result = address;
return result;
} }
/** /**

View File

@ -892,6 +892,9 @@ public class Socket
if (sm != null) if (sm != null)
sm.checkSetFactory(); sm.checkSetFactory();
if (fac == null)
throw new SocketException("SocketImplFactory cannot be null");
factory = fac; factory = fac;
} }