JDK-4776783 : (se) Closing a selector should make its key sets inaccessible
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 1.4.0,1.4.2,5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,solaris_2.6
  • CPU: generic,sparc
  • Submitted: 2002-11-11
  • Updated: 2017-05-16
  • Resolved: 2003-12-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
5.0 b32Fixed
Related Reports
Duplicate :  

Name: auR10023			Date: 11/11/2002

###@###.### 2002-11-11

There is some additional description from Submitter:
java.nio.channels.Selector.keys() doesn't throw ClosedSelectorException.

Here is the example:

public class test  {

    public static void main(String args[]) {
        DatagramChannel channel = null;
        Selector sel = null;
        SelectionKey key = null;
        try {
            channel = DatagramChannel.open();
            sel = Selector.open();
            key = channel.register(
            sel, SelectionKey.OP_WRITE);
        } catch (IOException e) {
            System.out.println("Unexpected IOException");
        try {
            System.out.println("ClosedSelectorException should be thrown");
        } catch (ClosedSelectorException e) {
Here is the result
#java -version    
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b05)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b05, mixed mode)

#java test
ClosedSelectorException should be thrown

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger tiger-beta FIXED IN: tiger-beta INTEGRATED IN: tiger-b32 tiger-beta VERIFIED IN: tiger-b63

EVALUATION Yes, both of these methods should throw ClosedSelectorException when invoked upon a closed Selector. -- ###@###.### 2002/11/15
181-10-11 0