United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4776783 : (se) Closing a selector should make its key sets inaccessible

Details
Type:
Bug
Submit Date:
2002-11-11
Status:
Closed
Updated Date:
2004-09-01
Project Name:
JDK
Resolved Date:
2003-12-19
Component:
core-libs
OS:
solaris_2.6,generic
Sub-Component:
java.nio
CPU:
sparc,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.0,1.4.2,5.0
Fixed Versions:
5.0 (b32)

Related Reports
Duplicate:

Sub Tasks

Description

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:

-------test.java---------
public class test  {

    public static void main(String args[]) {
    
        DatagramChannel channel = null;
        Selector sel = null;
        SelectionKey key = null;
        try {
            channel = DatagramChannel.open();
            channel.configureBlocking(false);
            sel = Selector.open();
            
            key = channel.register(
            sel, SelectionKey.OP_WRITE);
            sel.close();
        } catch (IOException e) {
            System.out.println("Unexpected IOException");
            return;
        }
         
        try {
            sel.keys();
            System.out.println("ClosedSelectorException should be thrown");
            return;
        } catch (ClosedSelectorException e) {
        } 
          
        System.out.println("OKAY");
    }
}
 
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


                                    

Comments
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


                                     
2004-09-13
EVALUATION

Yes, both of these methods should throw ClosedSelectorException when invoked
upon a closed Selector.

-- ###@###.### 2002/11/15
                                     
181-10-11 0



Hardware and Software, Engineered to Work Together