re PR libgcj/17069 (InetAddress.getLocalHost() returns broken InetAddress object...
authorMichael Koch <konqueror@gmx.de>
Sun, 9 Jan 2005 18:57:32 +0000 (18:57 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Sun, 9 Jan 2005 18:57:32 +0000 (18:57 +0000)
2005-01-09  Michael Koch  <konqueror@gmx.de>

PR libgcj/17069
* java/net/InetAddress.java (getLocalHost):
Throw UnknownHostException if local hostname cannot be determined.

From-SVN: r93115

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

index 160dce07231ab321f982ac129c3b04d2aa8a3f6b..cf605f62aa3d755c4ee6e0ac8e400c46a66cc9a3 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-09  Michael Koch  <konqueror@gmx.de>
+
+       PR libgcj/17069
+       * java/net/InetAddress.java (getLocalHost):
+       Throw UnknownHostException if local hostname cannot be determined.
+
 2005-01-06  Tom Tromey  <tromey@redhat.com>
 
        * java/lang/ClassLoader.java (findClass): Fixed documentation.
index 3306803188405ed3e06ab89a52cbfe078d29edaf..cfcf22b42682745498b3975d6295cebde1b6c868 100644 (file)
@@ -714,7 +714,7 @@ public class InetAddress implements Serializable
          }
       }
     
-    if (hostname != null)
+    if (hostname != null && hostname.length() != 0)
       {
        try
          {
@@ -725,6 +725,8 @@ public class InetAddress implements Serializable
          {
          }
       }
+    else
+      throw new UnknownHostException();
     
     if (localhost == null)
       localhost = new InetAddress (loopbackAddress, "localhost");