]> gcc.gnu.org Git - gcc.git/commitdiff
natInetAddress.cc (lookup): Preserve caller-supplied hostname in returned InetAddress...
authorBryce McKinlay <bryce@albatross.co.nz>
Fri, 18 Jun 1999 01:17:28 +0000 (01:17 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Fri, 18 Jun 1999 01:17:28 +0000 (02:17 +0100)
        * java/net/natInetAddress.cc (lookup): Preserve caller-supplied
        hostname in returned InetAddress objects.
        (getLocalHostname): Fix typo.
        * java/net/InetAddress.java (getByName): Set hostname on return
        object.
        (getLocalHost): Call lookup directly to ensure that a fully-qualified
        name is returned.

From-SVN: r27587

libjava/ChangeLog
libjava/java/net/InetAddress.java
libjava/java/net/natInetAddress.cc

index 64d7363a4c46cb8795bc6e6cc3ff27106e713606..274760d886f6cc3a9f96876a2bfde1d0095fa2d2 100644 (file)
@@ -1,3 +1,13 @@
+1999-06-18  Bryce McKinlay  <bryce@albatross.co.nz>
+
+       * java/net/natInetAddress.cc (lookup): Preserve caller-supplied
+       hostname in returned InetAddress objects.
+       (getLocalHostname): Fix typo.
+       * java/net/InetAddress.java (getByName): Set hostname on return
+       object.
+       (getLocalHost): Call lookup directly to ensure that a fully-qualified
+       name is returned.
+
 1999-06-17  Bryce McKinlay  <bryce@albatross.co.nz>
 
        * java/net/natPlainSocketImpl.cc (bind): Bind to any/all network
index baf5153e933007ad326e87808a0b6cb7659cdb00..6bd06993f761c7f70fd149971896e4eafd422018 100644 (file)
@@ -177,7 +177,7 @@ public final class InetAddress
     byte[] address = aton(host);
     if (address != null)
       return new InetAddress(address, null);
-    InetAddress iaddr = new InetAddress(null, null);
+    InetAddress iaddr = new InetAddress(null, host);
     lookup(host, iaddr, false);
     return iaddr;
   }
@@ -243,7 +243,8 @@ public final class InetAddress
       {
        try
          {
-           localhost = getByName(hostname);
+           localhost = new InetAddress(null, null);
+           lookup(hostname, localhost, false);
          }
        catch (Exception ex)
          {
index 8da9102815a0920e97196576c0b17fabc52f408a..feac469f3796646d4356a8bb0dc702a7b13b52cf 100644 (file)
@@ -199,8 +199,8 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
 #endif /* HAVE_GETHOSTBYADDR_R */
     }
   if (hptr != NULL)
-    { 
-      if (host == NULL)
+    {
+      if (!all)
         host = JvNewStringUTF (hptr->h_name);
       java::lang::SecurityException *ex = checkConnect (host);
       if (ex != NULL)
@@ -246,7 +246,8 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
     {
       if (iaddrs[i] == NULL)
        iaddrs[i] = new java::net::InetAddress (NULL, NULL);
-      iaddrs[i]->hostname = host;
+      if (iaddrs[i]->hostname == NULL)
+        iaddrs[i]->hostname = host;
       if (iaddrs[i]->address == NULL)
        {
          char *bytes = hptr->h_addr_list[i];
@@ -269,7 +270,7 @@ java::net::InetAddress::getLocalHostname ()
 #elif HAVE_UNAME
   struct utsname stuff;
   if (uname (&stuff) != 0)
-    return NULL:
+    return NULL;
   chars = stuff.nodename;
 #else
   return NULL;
This page took 0.074964 seconds and 5 git commands to generate.