mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
Merge
This commit is contained in:
commit
0278846eaa
91 changed files with 1073 additions and 416 deletions
|
@ -166,13 +166,23 @@ public class DatagramSocketAdaptor
|
|||
|
||||
@Override
|
||||
public SocketAddress getLocalSocketAddress() {
|
||||
try {
|
||||
return dc.getLocalAddress();
|
||||
} catch (ClosedChannelException e) {
|
||||
InetSocketAddress local = dc.localAddress();
|
||||
if (local == null || isClosed())
|
||||
return null;
|
||||
} catch (Exception x) {
|
||||
throw new Error(x);
|
||||
|
||||
InetAddress addr = local.getAddress();
|
||||
if (addr.isAnyLocalAddress())
|
||||
return local;
|
||||
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
try {
|
||||
sm.checkConnect(addr.getHostAddress(), -1);
|
||||
} catch (SecurityException x) {
|
||||
return new InetSocketAddress(local.getPort());
|
||||
}
|
||||
}
|
||||
return local;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue