RFR JDK-8024832: (so) ServerSocketChannel.socket().accept() throws IllegalBlockingModeException if not bound

mark.reinhold at oracle.com mark.reinhold at oracle.com
Tue May 27 15:28:09 UTC 2014


2014/5/27 1:10 -0700, michael.x.mcmahon at oracle.com:
> On 27/05/14 15:56, mark.reinhold at oracle.com wrote:
>> 2014/5/26 20:01 -0700, michael.x.mcmahon at oracle.com:
>>> I think it should be throwing a SocketException rather than a
>>> NotYetBoundException to be consistent with ServerSocket.accept()
>> No, NotYetBoundException is the correct exception here.  The NIO
>> exception hierarchy was intentionally designed to be richer than
>> just "SocketException".  Consistency with the exceptions thrown
>> by the original java.net APIs is an anti-goal.
> 
> The point was clarified on a separate conversation on net-dev.
> The method in question refers to the channel's server socket adapter
> (ie an instance of java.net.ServerSocket) rather than the channel itself.

Ah, okay then -- I didn't realize that from the available context.

- Mark


More information about the nio-dev mailing list