Commit defd7921 by Michael Koch Committed by Michael Koch

2003-12-09 Michael Koch <konqueror@gmx.de>

	* java/net/DatagramSocket.java
	(close): Directly return if socket is closed.
	* java/net/ServerSocket.java
	(close): Directly return if socket is closed.
	* java/net/Socket.java
	(close): Directly return if socket is closed.

From-SVN: r74470
parent 25a23f3b
2003-12-09 Michael Koch <konqueror@gmx.de> 2003-12-09 Michael Koch <konqueror@gmx.de>
* java/net/DatagramSocket.java
(close): Directly return if socket is closed.
* java/net/ServerSocket.java
(close): Directly return if socket is closed.
* java/net/Socket.java
(close): Directly return if socket is closed.
2003-12-09 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/SelectorImpl.java * gnu/java/nio/SelectorImpl.java
(implSelect): Throws IOException. (implSelect): Throws IOException.
(select): Likewise. (select): Likewise.
......
...@@ -216,32 +216,32 @@ public class DatagramSocket ...@@ -216,32 +216,32 @@ public class DatagramSocket
*/ */
public void close() public void close()
{ {
if (!isClosed()) if (isClosed())
return;
try
{ {
try getImpl().close();
{ }
getImpl().close(); catch (SocketException e)
} {
catch (SocketException e) // Ignore this case, just close the socket in finally clause.
{ }
// Ignore this case, just close the socket in finally clause. finally
} {
finally remoteAddress = null;
{ remotePort = -1;
remoteAddress = null; impl = null;
remotePort = -1; }
impl = null;
}
try try
{ {
if (getChannel() != null) if (getChannel() != null)
getChannel().close(); getChannel().close();
} }
catch (IOException e) catch (IOException e)
{ {
// Do nothing. // Do nothing.
}
} }
} }
......
...@@ -353,15 +353,15 @@ public class ServerSocket ...@@ -353,15 +353,15 @@ public class ServerSocket
*/ */
public void close () throws IOException public void close () throws IOException
{ {
if (!isClosed()) if (isClosed())
{ return;
impl.close();
impl = null; impl.close();
bound = false; impl = null;
bound = false;
if (getChannel() != null) if (getChannel() != null)
getChannel().close(); getChannel().close();
}
} }
/** /**
......
...@@ -1003,7 +1003,7 @@ public class Socket ...@@ -1003,7 +1003,7 @@ public class Socket
public synchronized void close () throws IOException public synchronized void close () throws IOException
{ {
if (isClosed()) if (isClosed())
throw new SocketException("socket is closed"); return;
getImpl().close(); getImpl().close();
impl = null; impl = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment