diff options
Diffstat (limited to 'libjava/java/net/ServerSocket.java')
-rw-r--r-- | libjava/java/net/ServerSocket.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java index 62917b6a8a5..0285c128c77 100644 --- a/libjava/java/net/ServerSocket.java +++ b/libjava/java/net/ServerSocket.java @@ -77,6 +77,8 @@ public class ServerSocket */ private ServerSocketChannel ch; + private boolean closed = false; + /** * Constructor that simply sets the implementation. * @@ -200,6 +202,9 @@ public class ServerSocket */ public void bind (SocketAddress endpoint, int backlog) throws IOException { + if (closed) + throw new SocketException ("ServerSocket is closed"); + if (impl == null) throw new IOException ("Cannot initialize Socket implementation"); @@ -315,7 +320,13 @@ public class ServerSocket */ public void close () throws IOException { - impl.close(); + if (impl != null) + impl.close (); + + if (ch != null) + ch.close (); + + closed = true; } /** @@ -345,7 +356,7 @@ public class ServerSocket } catch (SocketException e) { - return false; + return false; } return true; @@ -358,8 +369,7 @@ public class ServerSocket */ public boolean isClosed() { - // FIXME: implement this - return false; + return closed; } /** |