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

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

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P3
    • Resolution: Fixed
    • 15
    • 15
    • core-libs
    • 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

              pconcannon Patrick Concannon (Inactive)
              dbessono Dmitry Bessonov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: