Code Review 6946673: DatagramSocket.connect() documentation contradicts the implementation

Chris Hegarty chris.hegarty at oracle.com
Fri May 7 02:06:43 PDT 2010


Hi Alan,

This is a formal review for source changes for 6946673. We already 
discussed the these spec changes off line.

Webrev:
   http://cr.openjdk.java.net/~chegar/6946673/webrev.00/webrev/

BlenderRev:
   http://cr.openjdk.java.net/~chegar/6946673/DatagramSocketBelnderRev.html

Problem Summary:

The specification for DatagramSocket.connect does not correctly describe 
the situation where a SecurityException can be thrown. In fact, it 
actually contradicts what the implementation does.

When connecting a DatagramSocket the security manager's checkConnect and 
checkAccept methods are invoked, with the given address and port, to 
verify that datagrams are permitted to be sent and received 
respectively. The spec currently says that a SecurityException is thrown 
if the caller is not allowed to send datagrams to and receive datagrams 
from the address and port. This is clearly wrong since permission is 
required for both sending and receiving.

Solution:
Clarify the spec by explicitly stating what permissions are required.

Thanks,
-Chris.



More information about the net-dev mailing list