* 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
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.
*/
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.
}
}
*/
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();
}
/**
public synchronized void close () throws IOException
{
if (isClosed())
- throw new SocketException("socket is closed");
+ return;
getImpl().close();
impl = null;