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:
committed by
Bryce McKinlay
parent
9ddab891df
commit
e0cb3930ca
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user