]> gcc.gnu.org Git - gcc.git/commitdiff
InetAddress.java (toString): Use hostname when not null, don't do an explicit reverse...
authorMark Wielaard <mark@klomp.org>
Sat, 7 Dec 2002 01:19:02 +0000 (01:19 +0000)
committerMark Wielaard <mark@gcc.gnu.org>
Sat, 7 Dec 2002 01:19:02 +0000 (01:19 +0000)
        * 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

libjava/ChangeLog
libjava/java/net/InetAddress.java
libjava/java/net/Socket.java

index 3e3ba7842d22cc5e0109cf753f11936b898748bc..3bc286641a9aec5c3048ab7921dd528bc24742b2 100644 (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>
 
        * include/java-interp.h (class _Jv_InterpMethod): Added
index c15c0f6dc412c460d81b5c3890690c4f8505d53f..4a32352b481436183655fa10806b31518a410f60 100644 (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;
   }
 
   /**
index b900801a16b052adc380179542dd9eebf09a30ad..592f39a3dd3eeb58de0df7b1f1b79cce11cca374 100644 (file)
@@ -892,6 +892,9 @@ public class Socket
     if (sm != null)
       sm.checkSetFactory();
 
+    if (fac == null)
+      throw new SocketException("SocketImplFactory cannot be null");
+
     factory = fac;
   }
 
This page took 0.079794 seconds and 5 git commands to generate.