classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] [Patch] java.net.InetAddress


From: Michael Koch
Subject: Re: [cp-patches] [Patch] java.net.InetAddress
Date: Wed, 13 Oct 2004 14:40:34 +0200
User-agent: KMail/1.6.2

On Wednesday 13 October 2004 13:42, Jeroen Frijters wrote:
> Michael Koch wrote:
> > On Wednesday 13 October 2004 13:19, Jeroen Frijters wrote:
> > > Michael Koch wrote:
> > > > I wrote the attached patch to add the missing method
> > > > java.net.InetAddress.getCanonicalHostName().
> > >
> > > I haven't tried the patch yet, but the following looks wrong:
> > >
> > > +    // Try to find the FDQN now
> > > +    InetAddress address = new Inet4Address(getAddress(),
> > > null); +    return address.getHostName();
> > >
> > > Shouldn't that be:
> > >
> > > +    // Try to find the FDQN now
> > > +    InetAddress address =
> > > InetAddress.getByAddress(getAddress()); +    return
> > > address.getHostName();
> >
> > In this case: it doesnt matter, the result is the same. If
> > hostname is null getHostName() does a lookup. Calling
> > getByAddress is IMHO too much not needed work like getting all
> > hostnames for an address instead of only one.
>
> I was thinking about IPv6 addresses, wouldn't they go wrong with
> your code?

Ah, you are right. Note that GNU classpath has nearly no IPv6 support. 
I want to look into this soon. The version in libgcj has some more 
IPv6 support. I dont know yet how complete/functional it is. This 
needs testing. I would vote to get IPv4 correct for now/first.

Note that your solution might work for IPv6 but does not have to.


Michael




reply via email to

[Prev in Thread] Current Thread [Next in Thread]