Hi Christian,

On Sun, 2006-01-01 at 15:46 +0100, Mark Wielaard wrote:
> On Thu, 2005-12-29 at 19:37 +0100, Christian Thalinger wrote:
> > While checking some FAILs in tgolem i stumbled across this common fail:
> > 
> > FAIL: gnu.testlet.java.net.InetSocketAddress.InetSocketAddressTest:
> > Error : test_Constructors failed - 1 No wildcard address returned
> > (number 1)
> > 
> > I searched a bit and i think toString() returns the wrong value.  Is
> > this correct?
> > 
> > 2005-12-29  Christian Thalinger  <[EMAIL PROTECTED]>
> > 
> >     * java/net/InetAddress.java (toString): Return 
> >     0.0.0.0 for null hostname.
> 
> I don't think this is correct. null as hostname just means the hostname
> has not yet been looked up, and toString() is explicitly lazy and
> doesn't do lookups itself.
> 
> I actually think the Mauve test is incorrect since it assumes 0.0.0.0 is
> always the INADDR_ANY used and that the hostName for such an address is
> automagically resolved.
> 
> I would propose to either change the Mauve test to be less strict in
> checking. Or if you feel IF_ANY should always have a resolved hostname
> to eagerly resolve it by adding something like this to
> InetAddress.getInaddrAny: inaddr_any.hostName = naddr_any.getHostName();

So what do you think of the following patch?

2006-01-08  Mark Wielaard  <[EMAIL PROTECTED]>

    * java/net/InetAddress.java (getInaddrAny): Explicitly set hostName.

It fixes the mauve test for me.

Cheers,

Mark
Index: java/net/InetAddress.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/InetAddress.java,v
retrieving revision 1.43
diff -u -r1.43 InetAddress.java
--- java/net/InetAddress.java	1 Jan 2006 13:52:48 -0000	1.43
+++ java/net/InetAddress.java	9 Jan 2006 14:28:03 -0000
@@ -760,6 +760,7 @@
       {
 	byte[] tmp = VMInetAddress.lookupInaddrAny();
 	inaddr_any = new Inet4Address(tmp, null);
+	inaddr_any.hostName = inaddr_any.getHostName();
       }
 
     return inaddr_any;

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to