From defd7921fd606f2f0b2c01e39c15c7d78da7cf2b Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Tue, 9 Dec 2003 15:39:23 +0000 Subject: 2003-12-09 Michael Koch * 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 --- libjava/java/net/DatagramSocket.java | 48 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'libjava/java/net/DatagramSocket.java') 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. } } -- cgit v1.2.3