diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 4c81138ee3c..ad2a81519fc 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2003-12-25 Michael Koch + + * java/net/ServerSocket.java bind(): + If InetSocketAddress.getAddress() returns "null" use "0.0.0.0" as + address to bind to. + 2003-12-23 Guilhem Lavaux * java/io/ObjectInputStream.java diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java index a691d208498..597e641a346 100644 --- a/libjava/java/net/ServerSocket.java +++ b/libjava/java/net/ServerSocket.java @@ -221,14 +221,20 @@ public class ServerSocket throw new IllegalArgumentException ("Address type not supported"); InetSocketAddress tmp = (InetSocketAddress) endpoint; - + SecurityManager s = System.getSecurityManager (); if (s != null) s.checkListen (tmp.getPort ()); + InetAddress addr = tmp.getAddress(); + + // Initialize addr with 0.0.0.0. + if (addr == null) + addr = InetAddress.ANY_IF; + try { - impl.bind (tmp.getAddress (), tmp.getPort ()); + impl.bind(addr, tmp.getPort()); impl.listen(backlog); bound = true; }