On Thu, 8 Oct 2026 08:59:52 GMT, Michael McMahon <[email protected]> wrote:
>> Hi, >> >> This is a small change to java.net.UnixDomainSocketAddress which specifies >> that an address with an empty path can be used to bind a ServerSocketChannel >> to a system chosen address. This is equivalent to InetSocketAddress with a >> zero valued port field, which requests the system to choose the port number. >> The behavior can currently be obtained by passing a null reference to >> ServerSocketChannel.bind() but certain use cases need a typed value to >> indicate the same information. >> >> There are some minor related doc changes to ServerSocketChannel. >> >> Thanks, >> Michael. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Michael McMahon has updated the pull request incrementally with one > additional commit since the last revision: > > net-properties.html update All files are missing copyright year bumps. src/java.base/share/classes/java/nio/channels/ServerSocketChannel.java line 261: > 259: * @param local > 260: * The address to bind the socket, or {@code null} to bind > to > 261: * an automatically assigned socket address Don't we need an update here too? src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java line 304: > 302: private SocketAddress unixBind(SocketAddress local, int backlog) > throws IOException { > 303: UnixDomainSocketAddress ulocal = (UnixDomainSocketAddress)local; > 304: if (local == null || (ulocal.getPath().toString().equals(""))) { Cast needs to be checked first: Suggestion: if (local == null || (local instanceof UnixDomainSocketAddress ulocal && ulocal.getPath().toString().equals(""))) { A test covering this negative path would also be nice. test/jdk/java/nio/channels/unixdomain/Bind.java line 214: > 212: ); > 213: > 214: // server bind to empty path: should bind to a local address *Nit:* Can we move this right after the `server bind to null` block, i.e., line 205. test/jdk/java/nio/channels/unixdomain/Bind.java line 224: > 222: if (usa.getPath().toString().isEmpty()) > 223: throw new RuntimeException("expected non zero > address length"); > 224: System.out.println("Null server address: " + > server.getLocalAddress()); Suggestion: System.out.println("Empty server address: " + server.getLocalAddress()); ------------- PR Review: https://git.openjdk.org/jdk/pull/33249#pullrequestreview-5455152149 PR Review Comment: https://git.openjdk.org/jdk/pull/33249#discussion_r4218794858 PR Review Comment: https://git.openjdk.org/jdk/pull/33249#discussion_r4218203394 PR Review Comment: https://git.openjdk.org/jdk/pull/33249#discussion_r4218416074 PR Review Comment: https://git.openjdk.org/jdk/pull/33249#discussion_r4218771487
