mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8223326: Regression introduced by CPU sync: java.security.AccessControlException: access denied ("java.net.NetPermission" "setSocketImpl")
Reviewed-by: dfuchs, alanb
This commit is contained in:
parent
566110929b
commit
e91c1ec7a6
2 changed files with 16 additions and 4 deletions
|
@ -37,6 +37,9 @@ import java.net.StandardSocketOptions;
|
|||
import java.nio.channels.IllegalBlockingModeException;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
@ -59,7 +62,12 @@ class ServerSocketAdaptor // package-private
|
|||
private volatile int timeout;
|
||||
|
||||
static ServerSocket create(ServerSocketChannelImpl ssc) {
|
||||
return new ServerSocketAdaptor(ssc);
|
||||
PrivilegedExceptionAction<ServerSocket> pa = () -> new ServerSocketAdaptor(ssc);
|
||||
try {
|
||||
return AccessController.doPrivileged(pa);
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw new InternalError("Should not reach here", pae);
|
||||
}
|
||||
}
|
||||
|
||||
private ServerSocketAdaptor(ServerSocketChannelImpl ssc) {
|
||||
|
|
|
@ -36,6 +36,9 @@ import java.net.SocketException;
|
|||
import java.net.SocketOption;
|
||||
import java.net.StandardSocketOptions;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
@ -61,10 +64,11 @@ class SocketAdaptor
|
|||
}
|
||||
|
||||
static Socket create(SocketChannelImpl sc) {
|
||||
PrivilegedExceptionAction<Socket> pa = () -> new SocketAdaptor(sc);
|
||||
try {
|
||||
return new SocketAdaptor(sc);
|
||||
} catch (SocketException e) {
|
||||
throw new InternalError("Should not reach here");
|
||||
return AccessController.doPrivileged(pa);
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw new InternalError("Should not reach here", pae);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue