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

DatagramSocket and MulticastSocket constructors don't specify how a null InetAddress is handled

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 15
    • Fix Version/s: 15
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b27

      Description

      The constructor:
          public DatagramSocket(int port, InetAddress laddr) throws SocketException {
              this(new InetSocketAddress(laddr, port));
          }

      relies on `InetSocketAddress(laddr, port)` whose specification states "A null address will assign the wildcard address". A similar assertion should be added to the specification of `DatagramSocket(int port, InetAddress laddr)` to clarify what occurs when a null address is passed as a parameter. This is also true for `MulticastSocket(SocketAddress bindaddr)`.

      The constructor:
          public DatagramSocket(int port) throws SocketException {
              this(port, null);
          }

      mentions "The socket will be bound to the wildcard address, an IP address chosen by the kernel". This is ambiguous and requires clarification.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pconcannon Patrick Concannon
                Reporter:
                dbessono Dmitry Bessonov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: