mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8344216: Remove calls to SecurityManager and and doPrivileged in java.net.Authenticator, java.net.CookieHandler, and java.net.ResponseCache after JEP 486 integration
Reviewed-by: dfuchs
This commit is contained in:
parent
f62e05ee96
commit
73fd8919f5
4 changed files with 1 additions and 86 deletions
|
@ -112,14 +112,6 @@ class Authenticator {
|
|||
* any previously set authenticator is removed.
|
||||
*/
|
||||
public static synchronized void setDefault(Authenticator a) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission setDefaultPermission
|
||||
= new NetPermission("setDefaultAuthenticator");
|
||||
sm.checkPermission(setDefaultPermission);
|
||||
}
|
||||
|
||||
theAuthenticator = a;
|
||||
}
|
||||
|
||||
|
@ -130,13 +122,6 @@ class Authenticator {
|
|||
* @since 9
|
||||
*/
|
||||
public static Authenticator getDefault() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission requestPermission
|
||||
= new NetPermission("requestPasswordAuthentication");
|
||||
sm.checkPermission(requestPermission);
|
||||
}
|
||||
return theAuthenticator;
|
||||
}
|
||||
|
||||
|
@ -161,14 +146,6 @@ class Authenticator {
|
|||
String prompt,
|
||||
String scheme) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission requestPermission
|
||||
= new NetPermission("requestPasswordAuthentication");
|
||||
sm.checkPermission(requestPermission);
|
||||
}
|
||||
|
||||
Authenticator a = theAuthenticator;
|
||||
if (a == null) {
|
||||
return null;
|
||||
|
@ -212,14 +189,6 @@ class Authenticator {
|
|||
String prompt,
|
||||
String scheme) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission requestPermission
|
||||
= new NetPermission("requestPasswordAuthentication");
|
||||
sm.checkPermission(requestPermission);
|
||||
}
|
||||
|
||||
Authenticator a = theAuthenticator;
|
||||
if (a == null) {
|
||||
return null;
|
||||
|
@ -267,14 +236,6 @@ class Authenticator {
|
|||
URL url,
|
||||
RequestorType reqType) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission requestPermission
|
||||
= new NetPermission("requestPasswordAuthentication");
|
||||
sm.checkPermission(requestPermission);
|
||||
}
|
||||
|
||||
Authenticator a = theAuthenticator;
|
||||
if (a == null) {
|
||||
return null;
|
||||
|
@ -328,14 +289,6 @@ class Authenticator {
|
|||
URL url,
|
||||
RequestorType reqType) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission requestPermission
|
||||
= new NetPermission("requestPasswordAuthentication");
|
||||
sm.checkPermission(requestPermission);
|
||||
}
|
||||
|
||||
Authenticator a = authenticator == null ? theAuthenticator : authenticator;
|
||||
if (a == null) {
|
||||
return null;
|
||||
|
|
|
@ -28,7 +28,6 @@ package java.net;
|
|||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import sun.security.util.SecurityConstants;
|
||||
|
||||
/**
|
||||
* A CookieHandler object provides a callback mechanism to hook up a
|
||||
|
@ -73,11 +72,6 @@ public abstract class CookieHandler {
|
|||
* @see #setDefault(CookieHandler)
|
||||
*/
|
||||
public static synchronized CookieHandler getDefault() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.GET_COOKIEHANDLER_PERMISSION);
|
||||
}
|
||||
return cookieHandler;
|
||||
}
|
||||
|
||||
|
@ -91,11 +85,6 @@ public abstract class CookieHandler {
|
|||
* @see #getDefault()
|
||||
*/
|
||||
public static synchronized void setDefault(CookieHandler cHandler) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.SET_COOKIEHANDLER_PERMISSION);
|
||||
}
|
||||
cookieHandler = cHandler;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ package java.net;
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import sun.security.util.SecurityConstants;
|
||||
|
||||
/**
|
||||
* Represents implementations of URLConnection caches. An instance of
|
||||
|
@ -84,11 +83,6 @@ public abstract class ResponseCache {
|
|||
* @since 1.5
|
||||
*/
|
||||
public static synchronized ResponseCache getDefault() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.GET_RESPONSECACHE_PERMISSION);
|
||||
}
|
||||
return theResponseCache;
|
||||
}
|
||||
|
||||
|
@ -104,11 +98,6 @@ public abstract class ResponseCache {
|
|||
* @since 1.5
|
||||
*/
|
||||
public static synchronized void setDefault(ResponseCache responseCache) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.SET_RESPONSECACHE_PERMISSION);
|
||||
}
|
||||
theResponseCache = responseCache;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue