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

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
This commit is contained in:
Michael Koch 2003-12-25 17:31:13 +00:00 committed by Michael Koch
parent ac2b322259
commit d9a81e87b6
2 changed files with 14 additions and 2 deletions

View 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> 2003-12-23 Guilhem Lavaux <guilhem@kaffe.org>
* java/io/ObjectInputStream.java * java/io/ObjectInputStream.java

View File

@ -221,14 +221,20 @@ public class ServerSocket
throw new IllegalArgumentException ("Address type not supported"); throw new IllegalArgumentException ("Address type not supported");
InetSocketAddress tmp = (InetSocketAddress) endpoint; InetSocketAddress tmp = (InetSocketAddress) endpoint;
SecurityManager s = System.getSecurityManager (); SecurityManager s = System.getSecurityManager ();
if (s != null) if (s != null)
s.checkListen (tmp.getPort ()); s.checkListen (tmp.getPort ());
InetAddress addr = tmp.getAddress();
// Initialize addr with 0.0.0.0.
if (addr == null)
addr = InetAddress.ANY_IF;
try try
{ {
impl.bind (tmp.getAddress (), tmp.getPort ()); impl.bind(addr, tmp.getPort());
impl.listen(backlog); impl.listen(backlog);
bound = true; bound = true;
} }