mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8217997: Better socket support
Reviewed-by: alanb, ahgross, chegar, igerasim
This commit is contained in:
parent
67a0aa7960
commit
e4553cb2fa
4 changed files with 45 additions and 1 deletions
|
@ -32,6 +32,7 @@ import java.util.Objects;
|
|||
import java.util.Set;
|
||||
import java.util.Collections;
|
||||
|
||||
import sun.security.util.SecurityConstants;
|
||||
import sun.net.PlatformSocketImpl;
|
||||
|
||||
/**
|
||||
|
@ -73,13 +74,25 @@ class ServerSocket implements java.io.Closeable {
|
|||
*
|
||||
* @throws NullPointerException if impl is {@code null}.
|
||||
*
|
||||
* @throws SecurityException if a security manager is set and
|
||||
* its {@code checkPermission} method doesn't allow
|
||||
* {@code NetPermission("setSocketImpl")}.
|
||||
* @since 12
|
||||
*/
|
||||
protected ServerSocket(SocketImpl impl) {
|
||||
Objects.requireNonNull(impl);
|
||||
checkPermission();
|
||||
this.impl = impl;
|
||||
}
|
||||
|
||||
private static Void checkPermission() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.SET_SOCKETIMPL_PERMISSION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an unbound server socket.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue