< prev index next >
src/java.base/share/classes/sun/nio/ch/SocketAdaptor.java
Print this page
rev 52995 : 8223326: Regression introduced by CPU sync: java.security.AccessControlException: access denied ("java.net.NetPermission" "setSocketImpl")
Reviewed-by: dfuchs, alanb
Contributed-by: Alan Bateman <alan.bateman@oracle.com>
*** 41,50 ****
--- 41,51 ----
import java.nio.channels.Channels;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.IllegalBlockingModeException;
import java.nio.channels.SocketChannel;
import java.security.AccessController;
+ import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import static java.util.concurrent.TimeUnit.*;
// Make a socket channel look like a socket.
//
*** 65,78 ****
super((SocketImpl) null);
this.sc = sc;
}
public static Socket create(SocketChannelImpl sc) {
try {
! return new SocketAdaptor(sc);
! } catch (SocketException e) {
! throw new InternalError("Should not reach here");
}
}
public SocketChannel getChannel() {
return sc;
--- 66,80 ----
super((SocketImpl) null);
this.sc = sc;
}
public static Socket create(SocketChannelImpl sc) {
+ PrivilegedExceptionAction<Socket> pa = () -> new SocketAdaptor(sc);
try {
! return AccessController.doPrivileged(pa);
! } catch (PrivilegedActionException pae) {
! throw new InternalError("Should not reach here", pae);
}
}
public SocketChannel getChannel() {
return sc;
< prev index next >