2004-03-16 Norbert Frese <postfach@nfrese.net>
authorNorbert Frese <postfach@nfrese.net>
Tue, 16 Mar 2004 09:47:14 +0000 (09:47 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Tue, 16 Mar 2004 09:47:14 +0000 (09:47 +0000)
* java/net/InetAddress.java
(getByName): Handle hostname == "" case.

From-SVN: r79529

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

index a0271368f78164fed4874e5316efb1ce44311207..8ce6ccfdefbb0b310facc4c21799ff0bd798c02a 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-16  Norbert Frese  <postfach@nfrese.net>
+
+       * java/net/InetAddress.java
+       (getByName): Handle hostname == "" case.
+
 2004-03-16  Dalibor Topic  <robilad@kaffe.org>
 
        Reported by: Adam Heath <doogie@debian.org>
index 0a69c1aab07fcee27497183ff96a3e71eda33ab8..e5f6ba3a8a14c5feb4b023f88663bffb8d3ebecf 100644 (file)
@@ -573,7 +573,7 @@ public class InetAddress implements Serializable
    * Returns an InetAddress object representing the IP address of the given
    * hostname.  This name can be either a hostname such as "www.urbanophile.com"
    * or an IP address in dotted decimal format such as "127.0.0.1".  If the
-   * hostname is null, the hostname of the local machine is supplied by
+   * hostname is null or "", the hostname of the local machine is supplied by
    * default.  This method is equivalent to returning the first element in
    * the InetAddress array returned from GetAllByName.
    *
@@ -594,7 +594,7 @@ public class InetAddress implements Serializable
       s.checkConnect (hostname, -1);
    
     // Default to current host if necessary
-    if (hostname == null)
+    if (hostname == null || hostname.length() == 0)
       return getLocalHost();
 
     // Assume that the host string is an IP address