Patch: java.net.InetAddress

Jeff Sturm jsturm@one-point.com
Sat Nov 29 14:51:00 GMT 2003


On Sat, 29 Nov 2003, Michael Koch wrote:
> > I'm questioning though if you've found the root of the implementation
> > difference.
>
> my test is:
>
>
> import java.net.InetSocketAddress;
>
> public class T
> {
>   public static void main(String[] args) throws exception
>   {
>     InetSocketAddress addr = new InetSocketAddress(0);
>   }
> }

Ah yes... I wasn't looking at InetSocketAddress.

Your test relies on resolving ANY_IF, which happens at most once since
ANY_IF is a static member.  Doesn't the following simpler patch accomplish
the same thing?

Jeff

Index: InetAddress.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/InetAddress.java,v
retrieving revision 1.25
diff -u -p -r1.25 InetAddress.java
--- InetAddress.java    28 Nov 2003 22:01:29 -0000      1.25
+++ InetAddress.java    29 Nov 2003 14:44:57 -0000
@@ -82,7 +82,7 @@ public class InetAddress implements Seri
       }

     byte[] zeros = { 0, 0, 0, 0 };
-    ANY_IF = new InetAddress (zeros, null);
+    ANY_IF = new InetAddress (zeros, "0.0.0.0");
   }

   /**




More information about the Java-patches mailing list