8266459: Implement JEP 411: Deprecate the Security Manager for Removal

Co-authored-by: Sean Mullan <mullan@openjdk.org>
Co-authored-by: Lance Andersen <lancea@openjdk.org>
Co-authored-by: Weijun Wang <weijun@openjdk.org>
Reviewed-by: erikj, darcy, chegar, naoto, joehw, alanb, mchung, kcr, prr, lancea
This commit is contained in:
Weijun Wang 2021-06-02 11:57:31 +00:00
parent 19450b9951
commit 6765f90250
826 changed files with 2734 additions and 757 deletions

View file

@ -180,6 +180,7 @@ public class Socket implements java.io.Closeable {
: sun.net.ApplicationProxy.create(proxy);
Proxy.Type type = p.type();
if (type == Proxy.Type.SOCKS || type == Proxy.Type.HTTP) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
InetSocketAddress epoint = (InetSocketAddress) p.address();
if (epoint.getAddress() != null) {
@ -237,6 +238,7 @@ public class Socket implements java.io.Closeable {
if (impl == null) {
return null;
}
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(SecurityConstants.SET_SOCKETIMPL_PERMISSION);
@ -618,6 +620,7 @@ public class Socket implements java.io.Closeable {
int port = epoint.getPort();
checkAddress(addr, "connect");
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
if (epoint.isUnresolved())
@ -671,6 +674,7 @@ public class Socket implements java.io.Closeable {
InetAddress addr = epoint.getAddress();
int port = epoint.getPort();
checkAddress (addr, "bind");
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkListen(port);
@ -739,6 +743,7 @@ public class Socket implements java.io.Closeable {
InetAddress in = null;
try {
in = (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR);
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkConnect(in.getHostAddress(), -1);
@ -1763,6 +1768,7 @@ public class Socket implements java.io.Closeable {
if (factory != null) {
throw new SocketException("factory already defined");
}
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkSetFactory();