ServerSocket.java bind (): If InetSocketAddress.getAddress() returns "null" use ...
authorMichael Koch <konqueror@gmx.de>
Thu, 25 Dec 2003 17:31:13 +0000 (17:31 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Thu, 25 Dec 2003 17:31:13 +0000 (17:31 +0000)
2003-12-25  Michael Koch  <konqueror@gmx.de>

* java/net/ServerSocket.java bind():
If InetSocketAddress.getAddress() returns "null" use "0.0.0.0" as
address to bind to.

From-SVN: r75023

libjava/ChangeLog
libjava/java/net/ServerSocket.java

index 4c81138ee3c77e00278088e415fa8f96e6b1318f..ad2a81519fc966b051c9af33b01cbbb3a5de31f3 100644 (file)
@@ -1,3 +1,9 @@
+2003-12-25  Michael Koch  <konqueror@gmx.de>
+
+       * 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 <guilhem@kaffe.org>
 
        * java/io/ObjectInputStream.java
index a691d20849853744e4b560696ca0e50594aae87f..597e641a34647d5051415d806bee30bd4864555c 100644 (file)
@@ -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;
       }