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

@ -118,6 +118,7 @@ final class NetMulticastSocket extends MulticastSocket {
checkAddress(address, "connect");
if (isClosed())
return;
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
if (address.isMulticastAddress()) {
@ -168,6 +169,7 @@ final class NetMulticastSocket extends MulticastSocket {
* Return true if the given DatagramSocketImpl is an "old" impl. An old impl
* is one that doesn't implement the abstract methods added in Java SE 1.4.
*/
@SuppressWarnings("removal")
private static boolean checkOldImpl(DatagramSocketImpl impl) {
// DatagramSocketImpl.peekData() is a protected method, therefore we need to use
// getDeclaredMethod, therefore we need permission to access the member
@ -223,6 +225,7 @@ final class NetMulticastSocket extends MulticastSocket {
InetAddress iaddr = epoint.getAddress();
int port = epoint.getPort();
checkAddress(iaddr, "bind");
@SuppressWarnings("removal")
SecurityManager sec = System.getSecurityManager();
if (sec != null) {
sec.checkListen(port);
@ -331,6 +334,7 @@ final class NetMulticastSocket extends MulticastSocket {
if (packetPort < 0 || packetPort > 0xFFFF)
throw new IllegalArgumentException("port out of range: " + packetPort);
// check the address is ok with the security manager on every send.
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
// The reason you want to synchronize on datagram packet
@ -375,6 +379,7 @@ final class NetMulticastSocket extends MulticastSocket {
bind(new InetSocketAddress(0));
if (connectState == ST_NOT_CONNECTED) {
// check the address is ok with the security manager before every recv.
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
while (true) {
@ -480,6 +485,7 @@ final class NetMulticastSocket extends MulticastSocket {
if (in.isAnyLocalAddress()) {
in = InetAddress.anyLocalAddress();
}
@SuppressWarnings("removal")
SecurityManager s = System.getSecurityManager();
if (s != null) {
s.checkConnect(in.getHostAddress(), -1);
@ -751,6 +757,7 @@ final class NetMulticastSocket extends MulticastSocket {
}
checkAddress(mcastaddr, "joinGroup");
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkMulticast(mcastaddr);
@ -781,6 +788,7 @@ final class NetMulticastSocket extends MulticastSocket {
}
checkAddress(mcastaddr, "leaveGroup");
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkMulticast(mcastaddr);
@ -806,6 +814,7 @@ final class NetMulticastSocket extends MulticastSocket {
throw new UnsupportedOperationException();
checkAddress(addr.getAddress(), "joinGroup");
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkMulticast(addr.getAddress());
@ -831,6 +840,7 @@ final class NetMulticastSocket extends MulticastSocket {
throw new UnsupportedOperationException();
checkAddress(addr.getAddress(), "leaveGroup");
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkMulticast(addr.getAddress());
@ -945,6 +955,7 @@ final class NetMulticastSocket extends MulticastSocket {
return ((Boolean)getImpl().getOption(SocketOptions.IP_MULTICAST_LOOP)).booleanValue();
}
@SuppressWarnings("removal")
@Deprecated
@Override
public void send(DatagramPacket p, byte ttl)