JDK-6621689 : (dc spec) DatagramChannel.receive when channel is not bound is not specified
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-10-25
  • Updated: 2017-05-16
  • Resolved: 2009-04-11
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 Availability Release.

To download the current JDK release, click here.
7 b55Fixed
The DatagramChannel.receive method does not specify the behavior when the channel is not bound. Since 1.4, our implementation has returned null, even for the blocking case. Throw NotNotBoundException or explicitly binding the channel's socket might have been better choices but it cannot now be changed.

A related issue is that the adaptor emulation of DatagramSocket.receive is not correct. Legacy DatagramSocket binds the socket if not already bound so the adaptor should be updated to do the same.

EVALUATION Also, the receive and connect methods do not specify the required behavior for when the channel's socket is not bound. In both cases, the implementation will implicitly bind the socket and this is reasonable behavior to expect.