This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi again,
InetAddress.lookup() returns its result in differently depending
upon how it is called. If the result might be several addresses
it returns an array, but if the result is a single address it
modifies an object it was passed as an argument and returns NULL.
In the latter mode it is invoked like this:
InetAddress result = new InetAddress(null, null);
lookup (hostname, result, false);
return result;
Aside from being slightly odd this approach means that several of
InetAddress's public methods return InetAddress objects when they
should in fact be returning Inet4Address or Inet6Address objects.
The attached patch (which needs to be applied after my patch with
subject "RFC: Untested Win32 InetAddress tweak") changes lookup to
always return an array, and to create address objects using
InetAddress.getByAddress() which makes Inet4Address or Inet6Address
objects accordingly.
The change is to a part of InetAddress.lookup() that is identical
in both Posix and Win32 versions, but as before I don't have the
ability to test the Win32 part of this patch. Could someone please
test it for me?
Cheers,
Gary
Attachment:
lookup-fixes.patch
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |