JDK-8253124 : JEP-380 : UnixDomainSocketAddress ::of���(Path path) spec amendment
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.net
  • Priority: P3
  • Status: Closed
  • Resolution: Withdrawn
  • Fix Versions: 16
  • Submitted: 2020-09-14
  • Updated: 2020-12-09
  • Resolved: 2020-12-09
Related Reports
CSR :  
Description
Summary
-------

Need to specify @throws NullPointerException for two methods in java.net.UnixDomainSocketAddress

Problem
-------

The static factory methods of java.net.UnixDomainSocketAddress throw NullPointerException if given null parameters, but this is not specified.

Solution
--------

Add @throws to both methods

Specification
-------------

      --- a/src/java.base/share/classes/java/net/UnixDomainSocketAddress.java
      +++ b/src/java.base/share/classes/java/net/UnixDomainSocketAddress.java
      @@ -144,6 +144,9 @@ public final class UnixDomainSocketAddress extends SocketAddress {
            *
            * @throws InvalidPathException
            *         If the path cannot be converted to a Path
      +     *
      +     * @throws NullPointerException
      +     *         If pathname is {@code null}
            */
           public static UnixDomainSocketAddress of(String pathname) {
               return of(Path.of(pathname));
      @@ -159,6 +162,9 @@ public final class UnixDomainSocketAddress extends SocketAddress {
            *
            * @throws IllegalArgumentException
            *         If the path is not associated with the default file system
      +     *
      +     * @throws NullPointerException
      +     *         If path is {@code null}
            */
           public static UnixDomainSocketAddress of(Path path) {
               return new UnixDomainSocketAddress(path);