--- a/src/java.base/share/classes/sun/nio/ch/Net.java Fri Nov 15 16:30:39 2019 +0000
+++ b/src/java.base/share/classes/sun/nio/ch/Net.java Mon Nov 18 16:53:41 2019 +0000
@@ -722,7 +722,7 @@
return unixDomainSupported;
}
- private static UnixDomainSocketAddress UNNAMED = new UnixDomainSocketAddress("");
+ public static final UnixDomainSocketAddress UNNAMED = new UnixDomainSocketAddress("");
static UnixDomainSocketAddress getRevealedLocalAddress(UnixDomainSocketAddress addr) {
SecurityManager sm = System.getSecurityManager();
--- a/src/java.base/share/classes/sun/nio/ch/UnixDomainSocketChannelImpl.java Fri Nov 15 16:30:39 2019 +0000
+++ b/src/java.base/share/classes/sun/nio/ch/UnixDomainSocketChannelImpl.java Mon Nov 18 16:53:41 2019 +0000
@@ -173,7 +173,11 @@
throw new AlreadyBoundException();
UnixDomainSocketAddress usa = Net.checkUnixAddress(local);
Net.unixDomainBind(fd, usa);
- localAddress = Net.localUnixAddress(fd);
+ if (usa == null) {
+ localAddress = Net.UNNAMED;
+ } else {
+ localAddress = Net.localUnixAddress(fd);
+ }
}
} finally {
writeLock.unlock();