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);
- csr of
-
JDK-8251952 JEP-380 : UnixDomainSocketAddress ::of(Path path) spec amendment
-
- Closed
-