bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/36268] New: AbstractSelectableChannel registration: excep


From: wzzhu at cs dot hku dot hk
Subject: [Bug classpath/36268] New: AbstractSelectableChannel registration: exception thrown not according to NIO spec
Date: 20 May 2008 03:13:40 -0000

In the AbstractSelectableChannel specification,
http://java.sun.com/j2se/1.4.2/docs/api/java/nio/channels/spi/AbstractSelectableChannel.html#register(java.nio.channels.Selector,%20int,%20java.lang.Object)
It is said that
"If this channel is already registered with the given selector then the
selection key representing that registration is returned after setting its
interest set to the given value."

But the actual implementation in
classpath/gnu/java/nio/EpollSelectionKeyImpl.java, 
SelectionKey register(AbstractSelectableChannel ch, int ops, Object att)
throws IllegalArgumentException("channel already registered")

Please confirm if this is a bug. The following simple fix may resolve the
problem.

Diff for file: gnu/java/nio/EpollSelectionKeyImpl.java

265,267c265,266
<           if (keys.containsKey(Integer.valueOf(native_fd))){
<             return (SelectionKey)keys.get(Integer.valueOf(native_fd));
<         }
---
>           if (keys.containsKey(Integer.valueOf(native_fd)))
>             throw new IllegalArgumentException("channel already registered");


-- 
           Summary: AbstractSelectableChannel registration: exception thrown
                    not according to NIO spec
           Product: classpath
           Version: 0.97
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wzzhu at cs dot hku dot hk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36268





reply via email to

[Prev in Thread] Current Thread [Next in Thread]