Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8344777

Remove calls to SecurityManager and doPrivileged in java.net.DatagramSocket and java.net.NetMulticastSocket after JEP 486 integration

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 24
    • core-libs
    • behavioral
    • minimal
    • API documentation clarification only
    • Java API
    • SE

      Summary

      DatagramSocket::connect API documentation is modified to remove allusions to security checks performed by the SecurityManager

      Problem

      The DatagramSocket::connect API documentation has a warning that a connected socket should not be shared with untrusted code since security checks on the connected address are only performed at connect time. With the SecurityManager removed by JEP 486 this is no longer relevant.

      Solution

      Update the API documentation of DatagramSocket::connect.

      Specification

      In src/java.base/share/classes/java/net/DatagramSocket.java:

      -     * <p> When a socket is connected, additional checks are performed
      -     * on a send operation: if the packet's address is set and the packet's address
      -     * and the socket's address do not match, an {@code IllegalArgumentException}
      -     * will be thrown. A socket connected to a multicast address may only
      +     * <p> When the socket is connected, the send method checks that the
      +     * packet's address matches the remote address that the socket is
      +     * connected to. A socket connected to a multicast address may only
            * be used to send packets. Datagrams in the socket's {@linkplain
            * java.net.StandardSocketOptions#SO_RCVBUF socket receive buffer}, which
            * have not been {@linkplain #receive(DatagramPacket) received} before invoking
            * this method, may be discarded.
            *
           [...]
            * @since 1.2
            */
           public void connect(InetAddress address, int port) {

            dfuchs Daniel Fuchs
            dfuchs Daniel Fuchs
            Alan Bateman, Jaikiran Pai, Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: