diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-09 15:39:23 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-09 15:39:23 +0000 |
commit | 310174583847367fcbd15f8a5486ba6cd04f5115 (patch) | |
tree | b86885d621ea31caac424b27216d3d544acfbf39 /libjava | |
parent | cb7ddec75270054db069bae4d2585be49c757d90 (diff) | |
download | ppe42-gcc-310174583847367fcbd15f8a5486ba6cd04f5115.tar.gz ppe42-gcc-310174583847367fcbd15f8a5486ba6cd04f5115.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74470 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 9 | ||||
-rw-r--r-- | libjava/java/net/DatagramSocket.java | 48 | ||||
-rw-r--r-- | libjava/java/net/ServerSocket.java | 16 | ||||
-rw-r--r-- | libjava/java/net/Socket.java | 2 |
4 files changed, 42 insertions, 33 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index ca99ae1cdbf..03afb656e10 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,14 @@ 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 (implSelect): Throws IOException. (select): Likewise. diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java index e3edfcd6c39..c9c0f5d0f03 100644 --- a/libjava/java/net/DatagramSocket.java +++ b/libjava/java/net/DatagramSocket.java @@ -216,32 +216,32 @@ public class DatagramSocket */ public void close() { - if (!isClosed()) + if (isClosed()) + return; + + try { - try - { - getImpl().close(); - } - catch (SocketException e) - { - // Ignore this case, just close the socket in finally clause. - } - finally - { - remoteAddress = null; - remotePort = -1; - impl = null; - } + getImpl().close(); + } + catch (SocketException e) + { + // Ignore this case, just close the socket in finally clause. + } + finally + { + remoteAddress = null; + remotePort = -1; + impl = null; + } - try - { - if (getChannel() != null) - getChannel().close(); - } - catch (IOException e) - { - // Do nothing. - } + try + { + if (getChannel() != null) + getChannel().close(); + } + catch (IOException e) + { + // Do nothing. } } diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java index 4e7f58a7cfc..a691d208498 100644 --- a/libjava/java/net/ServerSocket.java +++ b/libjava/java/net/ServerSocket.java @@ -353,15 +353,15 @@ public class ServerSocket */ public void close () throws IOException { - if (!isClosed()) - { - impl.close(); - impl = null; - bound = false; + if (isClosed()) + return; + + impl.close(); + impl = null; + bound = false; - if (getChannel() != null) - getChannel().close(); - } + if (getChannel() != null) + getChannel().close(); } /** diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java index a0f831c1701..9322e929ec3 100644 --- a/libjava/java/net/Socket.java +++ b/libjava/java/net/Socket.java @@ -1003,7 +1003,7 @@ public class Socket public synchronized void close () throws IOException { if (isClosed()) - throw new SocketException("socket is closed"); + return; getImpl().close(); impl = null; |