diff options
Diffstat (limited to 'libjava/java/net/ServerSocket.java')
-rw-r--r-- | libjava/java/net/ServerSocket.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java index 62917b6..e2f8e63 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; } /** @@ -358,8 +369,7 @@ public class ServerSocket */ public boolean isClosed() { - // FIXME: implement this - return false; + return closed; } /** |