natInetAddress.cc (lookup): Preserve caller-supplied hostname in returned InetAddress objects.
* 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
This commit is contained in:
parent
9ddab891df
commit
e0cb3930ca
@ -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>
|
1999-06-17 Bryce McKinlay <bryce@albatross.co.nz>
|
||||||
|
|
||||||
* java/net/natPlainSocketImpl.cc (bind): Bind to any/all network
|
* java/net/natPlainSocketImpl.cc (bind): Bind to any/all network
|
||||||
|
@ -177,7 +177,7 @@ public final class InetAddress
|
|||||||
byte[] address = aton(host);
|
byte[] address = aton(host);
|
||||||
if (address != null)
|
if (address != null)
|
||||||
return new InetAddress(address, null);
|
return new InetAddress(address, null);
|
||||||
InetAddress iaddr = new InetAddress(null, null);
|
InetAddress iaddr = new InetAddress(null, host);
|
||||||
lookup(host, iaddr, false);
|
lookup(host, iaddr, false);
|
||||||
return iaddr;
|
return iaddr;
|
||||||
}
|
}
|
||||||
@ -243,7 +243,8 @@ public final class InetAddress
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
localhost = getByName(hostname);
|
localhost = new InetAddress(null, null);
|
||||||
|
lookup(hostname, localhost, false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -200,7 +200,7 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
|
|||||||
}
|
}
|
||||||
if (hptr != NULL)
|
if (hptr != NULL)
|
||||||
{
|
{
|
||||||
if (host == NULL)
|
if (!all)
|
||||||
host = JvNewStringUTF (hptr->h_name);
|
host = JvNewStringUTF (hptr->h_name);
|
||||||
java::lang::SecurityException *ex = checkConnect (host);
|
java::lang::SecurityException *ex = checkConnect (host);
|
||||||
if (ex != NULL)
|
if (ex != NULL)
|
||||||
@ -246,6 +246,7 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
|
|||||||
{
|
{
|
||||||
if (iaddrs[i] == NULL)
|
if (iaddrs[i] == NULL)
|
||||||
iaddrs[i] = new java::net::InetAddress (NULL, NULL);
|
iaddrs[i] = new java::net::InetAddress (NULL, NULL);
|
||||||
|
if (iaddrs[i]->hostname == NULL)
|
||||||
iaddrs[i]->hostname = host;
|
iaddrs[i]->hostname = host;
|
||||||
if (iaddrs[i]->address == NULL)
|
if (iaddrs[i]->address == NULL)
|
||||||
{
|
{
|
||||||
@ -269,7 +270,7 @@ java::net::InetAddress::getLocalHostname ()
|
|||||||
#elif HAVE_UNAME
|
#elif HAVE_UNAME
|
||||||
struct utsname stuff;
|
struct utsname stuff;
|
||||||
if (uname (&stuff) != 0)
|
if (uname (&stuff) != 0)
|
||||||
return NULL:
|
return NULL;
|
||||||
chars = stuff.nodename;
|
chars = stuff.nodename;
|
||||||
#else
|
#else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user