diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 3e3ba7842d2..3bc286641a9 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2002-12-06 Mark Wielaard + + * 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 * include/java-interp.h (class _Jv_InterpMethod): Added diff --git a/libjava/java/net/InetAddress.java b/libjava/java/net/InetAddress.java index c15c0f6dc41..4a32352b481 100644 --- a/libjava/java/net/InetAddress.java +++ b/libjava/java/net/InetAddress.java @@ -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; } /** diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java index b900801a16b..592f39a3dd3 100644 --- a/libjava/java/net/Socket.java +++ b/libjava/java/net/Socket.java @@ -892,6 +892,9 @@ public class Socket if (sm != null) sm.checkSetFactory(); + if (fac == null) + throw new SocketException("SocketImplFactory cannot be null"); + factory = fac; }