aboutsummaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2003-12-09 15:39:23 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2003-12-09 15:39:23 +0000
commitdefd7921fd606f2f0b2c01e39c15c7d78da7cf2b (patch)
treeb86885d621ea31caac424b27216d3d544acfbf39 /libjava/java
parent25a23f3b2682634eb52eacf8842924ec84bbdcf9 (diff)
downloadgcc-defd7921fd606f2f0b2c01e39c15c7d78da7cf2b.zip
gcc-defd7921fd606f2f0b2c01e39c15c7d78da7cf2b.tar.gz
gcc-defd7921fd606f2f0b2c01e39c15c7d78da7cf2b.tar.bz2
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
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/net/DatagramSocket.java48
-rw-r--r--libjava/java/net/ServerSocket.java16
-rw-r--r--libjava/java/net/Socket.java2
3 files changed, 33 insertions, 33 deletions
diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java
index e3edfcd..c9c0f5d 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 4e7f58a..a691d20 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 a0f831c..9322e92 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;