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:
parent
19450b9951
commit
6765f90250
@ -767,7 +767,7 @@ define SetupRunJtregTestBody
|
||||
-vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE) \
|
||||
-vmoption:-Djava.io.tmpdir="$$($1_TEST_TMP_DIR)"
|
||||
|
||||
$1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet
|
||||
$1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet -Djavatest.security.noSecurityManager=true
|
||||
|
||||
# Make it possible to specify the JIB_DATA_DIR for tests using the
|
||||
# JIB Artifact resolver
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -406,7 +406,7 @@ public final class Tools extends JPanel implements ActionListener,
|
||||
if (pDialogState) {
|
||||
printJob.print(aset);
|
||||
}
|
||||
} catch (java.security.AccessControlException ace) {
|
||||
} catch (@SuppressWarnings("removal") java.security.AccessControlException ace) {
|
||||
String errmsg = "Applet access control exception; to allow "
|
||||
+ "access to printer, set\n"
|
||||
+ "permission for \"queuePrintJob\" in "
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,6 +32,7 @@ import java.security.PrivilegedAction;
|
||||
* Creates this platform's default SelectorProvider
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public class DefaultSelectorProvider {
|
||||
private static final SelectorProviderImpl INSTANCE;
|
||||
static {
|
||||
|
@ -39,6 +39,7 @@ import java.util.stream.Stream;
|
||||
|
||||
public final class CgroupUtil {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public static Stream<String> readFilePrivileged(Path path) throws IOException {
|
||||
try {
|
||||
PrivilegedExceptionAction<Stream<String>> pea = () -> Files.lines(path);
|
||||
@ -64,7 +65,7 @@ public final class CgroupUtil {
|
||||
static String readStringValue(CgroupSubsystemController controller, String param) throws IOException {
|
||||
PrivilegedExceptionAction<BufferedReader> pea = () ->
|
||||
Files.newBufferedReader(Paths.get(controller.path(), param));
|
||||
try (BufferedReader bufferedReader =
|
||||
try (@SuppressWarnings("removal") BufferedReader bufferedReader =
|
||||
AccessController.doPrivileged(pea)) {
|
||||
String line = bufferedReader.readLine();
|
||||
return line;
|
||||
@ -76,6 +77,7 @@ public final class CgroupUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public static List<String> readAllLinesPrivileged(Path path) throws IOException {
|
||||
try {
|
||||
PrivilegedExceptionAction<List<String>> pea = () -> Files.readAllLines(path);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,6 +32,7 @@ import java.security.PrivilegedAction;
|
||||
* Creates this platform's default SelectorProvider
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public class DefaultSelectorProvider {
|
||||
private static final SelectorProviderImpl INSTANCE;
|
||||
static {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -73,6 +73,7 @@ public final class AppleProvider extends Provider {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public AppleProvider() {
|
||||
/* We are the Apple provider */
|
||||
super("Apple", PROVIDER_VER, info);
|
||||
|
@ -110,6 +110,7 @@ public final class KeychainStore extends KeyStoreSpi {
|
||||
}
|
||||
|
||||
private static void permissionCheck() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sec = System.getSecurityManager();
|
||||
|
||||
if (sec != null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -106,6 +106,7 @@ class DefaultInterface {
|
||||
|
||||
boolean ip4 = false, ip6 = false, isNonLinkLocal = false;
|
||||
PrivilegedAction<Enumeration<InetAddress>> pa = ni::getInetAddresses;
|
||||
@SuppressWarnings("removal")
|
||||
Enumeration<InetAddress> addrs = AccessController.doPrivileged(pa);
|
||||
while (addrs.hasMoreElements()) {
|
||||
InetAddress addr = addrs.nextElement();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,6 +32,7 @@ import java.security.PrivilegedAction;
|
||||
* Creates this platform's default SelectorProvider
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public class DefaultSelectorProvider {
|
||||
private static final SelectorProviderImpl INSTANCE;
|
||||
static {
|
||||
|
@ -66,6 +66,7 @@ extends KeyAgreementSpi {
|
||||
|
||||
private static final boolean VALUE = getValue();
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static boolean getValue() {
|
||||
return AccessController.doPrivileged(
|
||||
(PrivilegedAction<Boolean>)
|
||||
|
@ -683,6 +683,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
* @exception CertificateException if any of the certificates in the
|
||||
* keystore could not be loaded
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public void engineLoad(InputStream stream, char[] password)
|
||||
throws IOException, NoSuchAlgorithmException, CertificateException
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -73,6 +73,7 @@ final class SealedObjectForKeyProtector extends SealedObject {
|
||||
return params;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
final Key getKey(Cipher c, int maxLength)
|
||||
throws IOException, ClassNotFoundException, IllegalBlockSizeException,
|
||||
BadPaddingException {
|
||||
@ -112,6 +113,7 @@ final class SealedObjectForKeyProtector extends SealedObject {
|
||||
private static final ObjectInputFilter OWN_FILTER;
|
||||
|
||||
static {
|
||||
@SuppressWarnings("removal")
|
||||
String prop = AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () -> {
|
||||
String tmp = System.getProperty(KEY_SERIAL_FILTER);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -117,6 +117,7 @@ public final class SunJCE extends Provider {
|
||||
attrs));
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public SunJCE() {
|
||||
/* We are the "SunJCE" provider */
|
||||
super("SunJCE", PROVIDER_VER, info);
|
||||
|
@ -770,6 +770,7 @@ public class File
|
||||
* method denies read access to the file
|
||||
*/
|
||||
public boolean canRead() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(path);
|
||||
@ -798,6 +799,7 @@ public class File
|
||||
* method denies write access to the file
|
||||
*/
|
||||
public boolean canWrite() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkWrite(path);
|
||||
@ -821,6 +823,7 @@ public class File
|
||||
* method denies read access to the file or directory
|
||||
*/
|
||||
public boolean exists() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(path);
|
||||
@ -851,6 +854,7 @@ public class File
|
||||
* method denies read access to the file
|
||||
*/
|
||||
public boolean isDirectory() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(path);
|
||||
@ -883,6 +887,7 @@ public class File
|
||||
* method denies read access to the file
|
||||
*/
|
||||
public boolean isFile() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(path);
|
||||
@ -912,6 +917,7 @@ public class File
|
||||
* @since 1.2
|
||||
*/
|
||||
public boolean isHidden() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(path);
|
||||
@ -955,6 +961,7 @@ public class File
|
||||
* method denies read access to the file
|
||||
*/
|
||||
public long lastModified() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(path);
|
||||
@ -986,6 +993,7 @@ public class File
|
||||
* method denies read access to the file
|
||||
*/
|
||||
public long length() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(path);
|
||||
@ -1026,6 +1034,7 @@ public class File
|
||||
* @since 1.2
|
||||
*/
|
||||
public boolean createNewFile() throws IOException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) security.checkWrite(path);
|
||||
if (isInvalid()) {
|
||||
@ -1053,6 +1062,7 @@ public class File
|
||||
* delete access to the file
|
||||
*/
|
||||
public boolean delete() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkDelete(path);
|
||||
@ -1091,6 +1101,7 @@ public class File
|
||||
* @since 1.2
|
||||
*/
|
||||
public void deleteOnExit() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkDelete(path);
|
||||
@ -1154,6 +1165,7 @@ public class File
|
||||
* the directory
|
||||
*/
|
||||
private final String[] normalizedList() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(path);
|
||||
@ -1356,6 +1368,7 @@ public class File
|
||||
* method does not permit the named directory to be created
|
||||
*/
|
||||
public boolean mkdir() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkWrite(path);
|
||||
@ -1438,6 +1451,7 @@ public class File
|
||||
if (dest == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkWrite(path);
|
||||
@ -1477,6 +1491,7 @@ public class File
|
||||
*/
|
||||
public boolean setLastModified(long time) {
|
||||
if (time < 0) throw new IllegalArgumentException("Negative time");
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkWrite(path);
|
||||
@ -1507,6 +1522,7 @@ public class File
|
||||
* @since 1.2
|
||||
*/
|
||||
public boolean setReadOnly() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkWrite(path);
|
||||
@ -1550,6 +1566,7 @@ public class File
|
||||
* @since 1.6
|
||||
*/
|
||||
public boolean setWritable(boolean writable, boolean ownerOnly) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkWrite(path);
|
||||
@ -1628,6 +1645,7 @@ public class File
|
||||
* @since 1.6
|
||||
*/
|
||||
public boolean setReadable(boolean readable, boolean ownerOnly) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkWrite(path);
|
||||
@ -1709,6 +1727,7 @@ public class File
|
||||
* @since 1.6
|
||||
*/
|
||||
public boolean setExecutable(boolean executable, boolean ownerOnly) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkWrite(path);
|
||||
@ -1772,6 +1791,7 @@ public class File
|
||||
* @since 1.6
|
||||
*/
|
||||
public boolean canExecute() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkExec(path);
|
||||
@ -1854,6 +1874,7 @@ public class File
|
||||
* @see FileStore#getTotalSpace
|
||||
*/
|
||||
public long getTotalSpace() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("getFileSystemAttributes"));
|
||||
@ -1897,6 +1918,7 @@ public class File
|
||||
* @see FileStore#getUnallocatedSpace
|
||||
*/
|
||||
public long getFreeSpace() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("getFileSystemAttributes"));
|
||||
@ -1943,6 +1965,7 @@ public class File
|
||||
* @see FileStore#getUsableSpace
|
||||
*/
|
||||
public long getUsableSpace() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("getFileSystemAttributes"));
|
||||
@ -1977,6 +2000,7 @@ public class File
|
||||
}
|
||||
return subNameLength;
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
static File generateFile(String prefix, String suffix, File dir)
|
||||
throws IOException
|
||||
{
|
||||
@ -2125,6 +2149,7 @@ public class File
|
||||
|
||||
File tmpdir = (directory != null) ? directory
|
||||
: TempDirectory.location();
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
File f;
|
||||
do {
|
||||
|
@ -140,6 +140,7 @@ public class FileInputStream extends InputStream
|
||||
*/
|
||||
public FileInputStream(File file) throws FileNotFoundException {
|
||||
String name = (file != null ? file.getPath() : null);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(name);
|
||||
@ -182,6 +183,7 @@ public class FileInputStream extends InputStream
|
||||
* @see SecurityManager#checkRead(java.io.FileDescriptor)
|
||||
*/
|
||||
public FileInputStream(FileDescriptor fdObj) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (fdObj == null) {
|
||||
throw new NullPointerException();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -217,6 +217,7 @@ public class FileOutputStream extends OutputStream
|
||||
throws FileNotFoundException
|
||||
{
|
||||
String name = (file != null ? file.getPath() : null);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkWrite(name);
|
||||
@ -259,6 +260,7 @@ public class FileOutputStream extends OutputStream
|
||||
* @see java.lang.SecurityManager#checkWrite(java.io.FileDescriptor)
|
||||
*/
|
||||
public FileOutputStream(FileDescriptor fdObj) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (fdObj == null) {
|
||||
throw new NullPointerException();
|
||||
|
@ -308,6 +308,7 @@ public final class FilePermission extends Permission implements Serializable {
|
||||
* @param mask the actions mask to use.
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private void init(int mask) {
|
||||
if ((mask & ALL) != mask)
|
||||
throw new IllegalArgumentException("invalid actions mask");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -219,6 +219,7 @@ public interface ObjectInputFilter {
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
final class Config {
|
||||
/* No instances. */
|
||||
private Config() {}
|
||||
|
@ -404,6 +404,7 @@ public class ObjectInputStream
|
||||
* @see java.io.SerializablePermission
|
||||
*/
|
||||
protected ObjectInputStream() throws IOException, SecurityException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
|
||||
@ -915,6 +916,7 @@ public class ObjectInputStream
|
||||
return enable;
|
||||
}
|
||||
if (enable) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SUBSTITUTION_PERMISSION);
|
||||
@ -1307,6 +1309,7 @@ public class ObjectInputStream
|
||||
* @since 9
|
||||
*/
|
||||
public final void setObjectInputFilter(ObjectInputFilter filter) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(ObjectStreamConstants.SERIAL_FILTER_PERMISSION);
|
||||
@ -1575,6 +1578,7 @@ public class ObjectInputStream
|
||||
if (cl == ObjectInputStream.class) {
|
||||
return;
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm == null) {
|
||||
return;
|
||||
@ -1596,6 +1600,7 @@ public class ObjectInputStream
|
||||
* override security-sensitive non-final methods. Returns TRUE if subclass
|
||||
* is "safe", FALSE otherwise.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static Boolean auditSubclass(Class<?> subcl) {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<Boolean>() {
|
||||
@ -2660,10 +2665,11 @@ public class ObjectInputStream
|
||||
final ObjectInputValidation obj;
|
||||
final int priority;
|
||||
Callback next;
|
||||
@SuppressWarnings("removal")
|
||||
final AccessControlContext acc;
|
||||
|
||||
Callback(ObjectInputValidation obj, int priority, Callback next,
|
||||
AccessControlContext acc)
|
||||
@SuppressWarnings("removal") AccessControlContext acc)
|
||||
{
|
||||
this.obj = obj;
|
||||
this.priority = priority;
|
||||
@ -2697,6 +2703,7 @@ public class ObjectInputStream
|
||||
prev = cur;
|
||||
cur = cur.next;
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext acc = AccessController.getContext();
|
||||
if (prev != null) {
|
||||
prev.next = new Callback(obj, priority, cur, acc);
|
||||
@ -2712,6 +2719,7 @@ public class ObjectInputStream
|
||||
* throws an InvalidObjectException, the callback process is terminated
|
||||
* and the exception propagated upwards.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
void doCallbacks() throws InvalidObjectException {
|
||||
try {
|
||||
while (list != null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -213,6 +213,7 @@ public class ObjectOutputStream
|
||||
* value of "sun.io.serialization.extendedDebugInfo" property,
|
||||
* as true or false for extended information about exception's place
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static final boolean extendedDebugInfo =
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetBooleanAction(
|
||||
@ -274,6 +275,7 @@ public class ObjectOutputStream
|
||||
* @see java.io.SerializablePermission
|
||||
*/
|
||||
protected ObjectOutputStream() throws IOException, SecurityException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
|
||||
@ -621,6 +623,7 @@ public class ObjectOutputStream
|
||||
return enable;
|
||||
}
|
||||
if (enable) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SUBSTITUTION_PERMISSION);
|
||||
@ -1052,6 +1055,7 @@ public class ObjectOutputStream
|
||||
if (cl == ObjectOutputStream.class) {
|
||||
return;
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm == null) {
|
||||
return;
|
||||
@ -1073,6 +1077,7 @@ public class ObjectOutputStream
|
||||
* override security-sensitive non-final methods. Returns TRUE if subclass
|
||||
* is "safe", FALSE otherwise.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static Boolean auditSubclass(Class<?> subcl) {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
|
@ -101,6 +101,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
NO_FIELDS;
|
||||
|
||||
/** reflection factory for obtaining serialization constructors */
|
||||
@SuppressWarnings("removal")
|
||||
private static final ReflectionFactory reflFactory =
|
||||
AccessController.doPrivileged(
|
||||
new ReflectionFactory.GetReflectionFactoryAction());
|
||||
@ -278,6 +279,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
*
|
||||
* @return the SUID of the class described by this descriptor
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public long getSerialVersionUID() {
|
||||
// REMIND: synchronize instead of relying on volatile?
|
||||
if (suid == null) {
|
||||
@ -301,6 +303,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
*
|
||||
* @return the {@code Class} instance that this descriptor represents
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@CallerSensitive
|
||||
public Class<?> forClass() {
|
||||
if (cl == null) {
|
||||
@ -460,6 +463,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
* Returns the value contained by this EntryFuture, blocking if
|
||||
* necessary until a value is set.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
synchronized Object get() {
|
||||
boolean interrupted = false;
|
||||
while (entry == unset) {
|
||||
@ -493,6 +497,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
/**
|
||||
* Creates local class descriptor representing given class.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private ObjectStreamClass(final Class<?> cl) {
|
||||
this.cl = cl;
|
||||
name = cl.getName();
|
||||
@ -620,6 +625,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
* ProtectionDomain that separate the concrete class {@code cl}
|
||||
* from its ancestor's declaring {@code cons}, or {@code null}.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private ProtectionDomain[] getProtectionDomains(Constructor<?> cons,
|
||||
Class<?> cl) {
|
||||
ProtectionDomain[] domains = null;
|
||||
@ -1130,6 +1136,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
* class is non-serializable or if the appropriate no-arg constructor is
|
||||
* inaccessible/unavailable.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
Object newInstance()
|
||||
throws InstantiationException, InvocationTargetException,
|
||||
UnsupportedOperationException
|
||||
@ -1572,6 +1579,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
* the not found ( which should never happen for correctly generated record
|
||||
* classes ).
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static MethodHandle canonicalRecordCtr(Class<?> cls) {
|
||||
assert cls.isRecord() : "Expected record, got: " + cls;
|
||||
PrivilegedAction<MethodHandle> pa = () -> {
|
||||
@ -2584,6 +2592,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
* and return
|
||||
* {@code Object}
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
static MethodHandle deserializationCtr(ObjectStreamClass desc) {
|
||||
// check the cached value 1st
|
||||
MethodHandle mh = desc.deserializationCtr;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -213,6 +213,7 @@ public class ObjectStreamField
|
||||
* @return a {@code Class} object representing the type of the
|
||||
* serializable field
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@CallerSensitive
|
||||
public Class<?> getType() {
|
||||
if (System.getSecurityManager() != null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -239,6 +239,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
||||
+ "\" must be one of "
|
||||
+ "\"r\", \"rw\", \"rws\","
|
||||
+ " or \"rwd\"");
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(name);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,7 +48,7 @@ class CharacterName {
|
||||
private final int[] hsIndices; // chain heads, hash indices into "cps"
|
||||
|
||||
private CharacterName() {
|
||||
try (DataInputStream dis = new DataInputStream(new InflaterInputStream(
|
||||
try (@SuppressWarnings("removal") DataInputStream dis = new DataInputStream(new InflaterInputStream(
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public InputStream run() {
|
||||
return getClass().getResourceAsStream("uniName.dat");
|
||||
|
@ -450,6 +450,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
throws ClassNotFoundException
|
||||
{
|
||||
Class<?> caller = null;
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
// Reflective call to get caller class is only needed if a security manager
|
||||
@ -519,6 +520,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
* @jls 12.3 Linking of Classes and Interfaces
|
||||
* @since 9
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@CallerSensitive
|
||||
public static Class<?> forName(Module module, String name) {
|
||||
Objects.requireNonNull(module);
|
||||
@ -599,6 +601,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
* s.checkPackageAccess()} denies access to the package
|
||||
* of this class.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@CallerSensitive
|
||||
@Deprecated(since="9")
|
||||
public T newInstance()
|
||||
@ -892,6 +895,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
ClassLoader cl = getClassLoader0();
|
||||
if (cl == null)
|
||||
return null;
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
ClassLoader.checkClassLoaderPermission(cl, Reflection.getCallerClass());
|
||||
@ -1357,6 +1361,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
|
||||
// Perform access check
|
||||
final Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
enclosingCandidate.checkMemberAccess(sm, Member.DECLARED,
|
||||
@ -1513,6 +1518,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
|
||||
// Perform access check
|
||||
final Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
enclosingCandidate.checkMemberAccess(sm, Member.DECLARED,
|
||||
@ -1560,6 +1566,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
final Class<?> candidate = getDeclaringClass0();
|
||||
|
||||
if (candidate != null) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
candidate.checkPackageAccess(sm,
|
||||
@ -1614,6 +1621,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
}
|
||||
|
||||
if (enclosingCandidate != null) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
enclosingCandidate.checkPackageAccess(sm,
|
||||
@ -1840,6 +1848,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@CallerSensitive
|
||||
public Class<?>[] getClasses() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
@ -1911,6 +1920,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*/
|
||||
@CallerSensitive
|
||||
public Field[] getFields() throws SecurityException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true);
|
||||
@ -2001,6 +2011,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*/
|
||||
@CallerSensitive
|
||||
public Method[] getMethods() throws SecurityException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true);
|
||||
@ -2041,6 +2052,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*/
|
||||
@CallerSensitive
|
||||
public Constructor<?>[] getConstructors() throws SecurityException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true);
|
||||
@ -2095,6 +2107,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
public Field getField(String name)
|
||||
throws NoSuchFieldException, SecurityException {
|
||||
Objects.requireNonNull(name);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true);
|
||||
@ -2204,6 +2217,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
public Method getMethod(String name, Class<?>... parameterTypes)
|
||||
throws NoSuchMethodException, SecurityException {
|
||||
Objects.requireNonNull(name);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true);
|
||||
@ -2248,6 +2262,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
public Constructor<T> getConstructor(Class<?>... parameterTypes)
|
||||
throws NoSuchMethodException, SecurityException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true);
|
||||
@ -2295,6 +2310,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*/
|
||||
@CallerSensitive
|
||||
public Class<?>[] getDeclaredClasses() throws SecurityException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), false);
|
||||
@ -2347,6 +2363,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*/
|
||||
@CallerSensitive
|
||||
public Field[] getDeclaredFields() throws SecurityException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true);
|
||||
@ -2408,6 +2425,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*/
|
||||
@CallerSensitive
|
||||
public RecordComponent[] getRecordComponents() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true);
|
||||
@ -2478,6 +2496,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*/
|
||||
@CallerSensitive
|
||||
public Method[] getDeclaredMethods() throws SecurityException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true);
|
||||
@ -2528,6 +2547,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*/
|
||||
@CallerSensitive
|
||||
public Constructor<?>[] getDeclaredConstructors() throws SecurityException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true);
|
||||
@ -2580,6 +2600,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
public Field getDeclaredField(String name)
|
||||
throws NoSuchFieldException, SecurityException {
|
||||
Objects.requireNonNull(name);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true);
|
||||
@ -2644,6 +2665,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
public Method getDeclaredMethod(String name, Class<?>... parameterTypes)
|
||||
throws NoSuchMethodException, SecurityException {
|
||||
Objects.requireNonNull(name);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true);
|
||||
@ -2722,6 +2744,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
public Constructor<T> getDeclaredConstructor(Class<?>... parameterTypes)
|
||||
throws NoSuchMethodException, SecurityException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true);
|
||||
@ -2968,6 +2991,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
* @since 1.2
|
||||
*/
|
||||
public java.security.ProtectionDomain getProtectionDomain() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.GET_PD_PERMISSION);
|
||||
@ -3013,7 +3037,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*
|
||||
* <p> NOTE: should only be called if a SecurityManager is installed
|
||||
*/
|
||||
private void checkMemberAccess(SecurityManager sm, int which,
|
||||
private void checkMemberAccess(@SuppressWarnings("removal") SecurityManager sm, int which,
|
||||
Class<?> caller, boolean checkProxyInterfaces) {
|
||||
/* Default policy allows access to all {@link Member#PUBLIC} members,
|
||||
* as well as access to classes that have the same class loader as the caller.
|
||||
@ -3037,7 +3061,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*
|
||||
* NOTE: this method should only be called if a SecurityManager is active
|
||||
*/
|
||||
private void checkPackageAccess(SecurityManager sm, final ClassLoader ccl,
|
||||
private void checkPackageAccess(@SuppressWarnings("removal") SecurityManager sm, final ClassLoader ccl,
|
||||
boolean checkProxyInterfaces) {
|
||||
final ClassLoader cl = getClassLoader0();
|
||||
|
||||
@ -3066,7 +3090,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
* all classes provided must be loaded by the same ClassLoader
|
||||
* NOTE: this method does not support Proxy classes
|
||||
*/
|
||||
private static void checkPackageAccessForPermittedSubclasses(SecurityManager sm,
|
||||
private static void checkPackageAccessForPermittedSubclasses(@SuppressWarnings("removal") SecurityManager sm,
|
||||
final ClassLoader ccl, Class<?>[] subClasses) {
|
||||
final ClassLoader cl = subClasses[0].getClassLoader0();
|
||||
|
||||
@ -3762,6 +3786,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
}
|
||||
|
||||
// Fetches the factory for reflective objects
|
||||
@SuppressWarnings("removal")
|
||||
private static ReflectionFactory getReflectionFactory() {
|
||||
if (reflectionFactory == null) {
|
||||
reflectionFactory =
|
||||
@ -3794,6 +3819,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
* identical to getEnumConstants except that the result is
|
||||
* uncloned, cached, and shared by all callers.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
T[] getEnumConstantsShared() {
|
||||
T[] constants = enumConstants;
|
||||
if (constants == null) {
|
||||
@ -4204,6 +4230,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
return this;
|
||||
}
|
||||
// returning a different class requires a security check
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkPackageAccess(sm,
|
||||
@ -4296,6 +4323,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
if (members.length > 1) {
|
||||
// If we return anything other than the current class we need
|
||||
// a security check
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkPackageAccess(sm,
|
||||
@ -4492,6 +4520,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
}
|
||||
if (subClasses.length > 0) {
|
||||
// If we return some classes we need a security check:
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkPackageAccessForPermittedSubclasses(sm,
|
||||
|
@ -365,6 +365,7 @@ public abstract class ClassLoader {
|
||||
throw new IllegalArgumentException("name must be non-empty or null");
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkCreateClassLoader();
|
||||
@ -671,6 +672,7 @@ public abstract class ClassLoader {
|
||||
}
|
||||
|
||||
// Invoked by the VM after loading class with this loader.
|
||||
@SuppressWarnings("removal")
|
||||
private void checkPackageAccess(Class<?> cls, ProtectionDomain pd) {
|
||||
final SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
@ -1791,6 +1793,7 @@ public abstract class ClassLoader {
|
||||
public final ClassLoader getParent() {
|
||||
if (parent == null)
|
||||
return null;
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
// Check access to the parent class loader
|
||||
@ -1834,6 +1837,7 @@ public abstract class ClassLoader {
|
||||
*/
|
||||
@CallerSensitive
|
||||
public static ClassLoader getPlatformClassLoader() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
ClassLoader loader = getBuiltinPlatformClassLoader();
|
||||
if (sm != null) {
|
||||
@ -1933,6 +1937,7 @@ public abstract class ClassLoader {
|
||||
default:
|
||||
// system fully initialized
|
||||
assert VM.isBooted() && scl != null;
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkClassLoaderPermission(scl, Reflection.getCallerClass());
|
||||
@ -2041,6 +2046,7 @@ public abstract class ClassLoader {
|
||||
* is not the same as or an ancestor of the given cl argument.
|
||||
*/
|
||||
static void checkClassLoaderPermission(ClassLoader cl, Class<?> caller) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
// caller can be null if the VM is requesting it
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -177,6 +177,7 @@ interface LiveStackFrame extends StackFrame {
|
||||
* and it denies access to {@code RuntimePermission("getStackWalkerWithClassReference")}.
|
||||
*/
|
||||
public static StackWalker getStackWalker(Set<StackWalker.Option> options) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("liveStackFrames"));
|
||||
|
@ -204,6 +204,7 @@ public final class Module implements AnnotatedElement {
|
||||
* If denied by the security manager
|
||||
*/
|
||||
public ClassLoader getClassLoader() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
|
||||
@ -1471,6 +1472,7 @@ public final class Module implements AnnotatedElement {
|
||||
// cached class file with annotations
|
||||
private volatile Class<?> moduleInfoClass;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private Class<?> moduleInfoClass() {
|
||||
Class<?> clazz = this.moduleInfoClass;
|
||||
if (clazz != null)
|
||||
|
@ -699,12 +699,14 @@ public final class ModuleLayer {
|
||||
}
|
||||
|
||||
private static void checkCreateClassLoaderPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(SecurityConstants.CREATE_CLASSLOADER_PERMISSION);
|
||||
}
|
||||
|
||||
private static void checkGetClassLoaderPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -425,6 +425,7 @@ public class Package extends NamedPackage implements java.lang.reflect.Annotated
|
||||
String cn = packageName() + ".package-info";
|
||||
Module module = module();
|
||||
PrivilegedAction<ClassLoader> pa = module::getClassLoader;
|
||||
@SuppressWarnings("removal")
|
||||
ClassLoader loader = AccessController.doPrivileged(pa);
|
||||
Class<?> c;
|
||||
if (loader != null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -348,6 +348,7 @@ public final class ProcessBuilder
|
||||
* @see System#getenv()
|
||||
*/
|
||||
public Map<String,String> environment() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null)
|
||||
security.checkPermission(new RuntimePermission("getenv.*"));
|
||||
@ -1092,6 +1093,7 @@ public final class ProcessBuilder
|
||||
// Throws IndexOutOfBoundsException if command is empty
|
||||
String prog = cmdarray[0];
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null)
|
||||
security.checkExec(prog);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,6 +25,7 @@
|
||||
package java.lang;
|
||||
|
||||
import java.lang.annotation.Native;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
@ -40,8 +41,6 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.security.AccessController.doPrivileged;
|
||||
|
||||
/**
|
||||
* ProcessHandleImpl is the implementation of ProcessHandle.
|
||||
*
|
||||
@ -83,8 +82,9 @@ final class ProcessHandleImpl implements ProcessHandle {
|
||||
/**
|
||||
* The thread pool of "process reaper" daemon threads.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static final Executor processReaperExecutor =
|
||||
doPrivileged((PrivilegedAction<Executor>) () -> {
|
||||
AccessController.doPrivileged((PrivilegedAction<Executor>) () -> {
|
||||
// Initialize ThreadLocalRandom now to avoid using the smaller stack
|
||||
// of the processReaper threads.
|
||||
ThreadLocalRandom.current();
|
||||
@ -238,6 +238,7 @@ final class ProcessHandleImpl implements ProcessHandle {
|
||||
* @throws SecurityException if RuntimePermission("manageProcess") is not granted
|
||||
*/
|
||||
static Optional<ProcessHandle> get(long pid) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("manageProcess"));
|
||||
@ -278,6 +279,7 @@ final class ProcessHandleImpl implements ProcessHandle {
|
||||
* @throws SecurityException if RuntimePermission("manageProcess") is not granted
|
||||
*/
|
||||
public static ProcessHandleImpl current() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("manageProcess"));
|
||||
@ -301,6 +303,7 @@ final class ProcessHandleImpl implements ProcessHandle {
|
||||
* security policy
|
||||
*/
|
||||
public Optional<ProcessHandle> parent() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("manageProcess"));
|
||||
@ -419,6 +422,7 @@ final class ProcessHandleImpl implements ProcessHandle {
|
||||
* @return a stream of ProcessHandles
|
||||
*/
|
||||
static Stream<ProcessHandle> children(long pid) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("manageProcess"));
|
||||
@ -439,6 +443,7 @@ final class ProcessHandleImpl implements ProcessHandle {
|
||||
|
||||
@Override
|
||||
public Stream<ProcessHandle> descendants() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("manageProcess"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -88,6 +88,7 @@ final class PublicMethods {
|
||||
* Method (name, parameter types) tuple.
|
||||
*/
|
||||
private static final class Key {
|
||||
@SuppressWarnings("removal")
|
||||
private static final ReflectionFactory reflectionFactory =
|
||||
AccessController.doPrivileged(
|
||||
new ReflectionFactory.GetReflectionFactoryAction());
|
||||
|
@ -107,6 +107,7 @@ public class Runtime {
|
||||
* @see #halt(int)
|
||||
*/
|
||||
public void exit(int status) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkExit(status);
|
||||
@ -207,6 +208,7 @@ public class Runtime {
|
||||
* @since 1.3
|
||||
*/
|
||||
public void addShutdownHook(Thread hook) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("shutdownHooks"));
|
||||
@ -235,6 +237,7 @@ public class Runtime {
|
||||
* @since 1.3
|
||||
*/
|
||||
public boolean removeShutdownHook(Thread hook) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("shutdownHooks"));
|
||||
@ -270,6 +273,7 @@ public class Runtime {
|
||||
* @since 1.3
|
||||
*/
|
||||
public void halt(int status) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkExit(status);
|
||||
@ -734,6 +738,7 @@ public class Runtime {
|
||||
}
|
||||
|
||||
void load0(Class<?> fromClass, String filename) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkLink(filename);
|
||||
@ -797,6 +802,7 @@ public class Runtime {
|
||||
}
|
||||
|
||||
void loadLibrary0(Class<?> fromClass, String libname) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkLink(libname);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -79,9 +79,9 @@ import sun.security.util.SecurityConstants;
|
||||
* permitted.
|
||||
* <p>
|
||||
* Environments using a security manager will typically set the security
|
||||
* manager at startup. In the JDK implementation, this is done by setting
|
||||
* the system property {@code java.security.manager} on the command line to
|
||||
* the class name of the security manager. It can also be set to the empty
|
||||
* manager at startup. In the JDK implementation, this is done by setting the
|
||||
* system property {@systemProperty java.security.manager} on the command line
|
||||
* to the class name of the security manager. It can also be set to the empty
|
||||
* String ("") or the special token "{@code default}" to use the
|
||||
* default {@code java.lang.SecurityManager}. If a class name is specified,
|
||||
* it must be {@code java.lang.SecurityManager} or a public subclass and have
|
||||
@ -313,7 +313,12 @@ import sun.security.util.SecurityConstants;
|
||||
* @see java.security.ProtectionDomain
|
||||
*
|
||||
* @since 1.0
|
||||
* @deprecated The Security Manager is deprecated and subject to removal in a
|
||||
* future release. There is no replacement for the Security Manager.
|
||||
* See <a href="https://openjdk.java.net/jeps/411">JEP 411</a> for
|
||||
* discussion and alternatives.
|
||||
*/
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public class SecurityManager {
|
||||
|
||||
/*
|
||||
@ -340,6 +345,7 @@ public class SecurityManager {
|
||||
*/
|
||||
public SecurityManager() {
|
||||
synchronized(SecurityManager.class) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
// ask the currently installed security manager if we
|
||||
@ -385,6 +391,7 @@ public class SecurityManager {
|
||||
* java.lang.Object) checkRead
|
||||
* @see java.security.AccessControlContext AccessControlContext
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public Object getSecurityContext() {
|
||||
return AccessController.getContext();
|
||||
}
|
||||
@ -404,6 +411,7 @@ public class SecurityManager {
|
||||
* {@code null}.
|
||||
* @since 1.2
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public void checkPermission(Permission perm) {
|
||||
java.security.AccessController.checkPermission(perm);
|
||||
}
|
||||
@ -439,6 +447,7 @@ public class SecurityManager {
|
||||
* @see java.security.AccessControlContext#checkPermission(java.security.Permission)
|
||||
* @since 1.2
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public void checkPermission(Permission perm, Object context) {
|
||||
if (context instanceof AccessControlContext) {
|
||||
((AccessControlContext)context).checkPermission(perm);
|
||||
@ -1081,10 +1090,9 @@ public class SecurityManager {
|
||||
* @throws NullPointerException if the address argument is
|
||||
* {@code null}.
|
||||
* @since 1.1
|
||||
* @deprecated Use #checkPermission(java.security.Permission) instead
|
||||
* @see #checkPermission(java.security.Permission) checkPermission
|
||||
*/
|
||||
@Deprecated(since="1.4")
|
||||
@Deprecated(since="1.4", forRemoval=true)
|
||||
public void checkMulticast(InetAddress maddr, byte ttl) {
|
||||
String host = maddr.getHostAddress();
|
||||
if (!host.startsWith("[") && host.indexOf(':') != -1) {
|
||||
@ -1332,6 +1340,7 @@ public class SecurityManager {
|
||||
* Do we need to update our property array?
|
||||
*/
|
||||
if (!packageAccessValid) {
|
||||
@SuppressWarnings("removal")
|
||||
String tmpPropertyStr =
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
@ -1431,6 +1440,7 @@ public class SecurityManager {
|
||||
* Do we need to update our property array?
|
||||
*/
|
||||
if (!packageDefinitionValid) {
|
||||
@SuppressWarnings("removal")
|
||||
String tmpPropertyStr =
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -418,6 +418,7 @@ public final class StackWalker {
|
||||
|
||||
private static void checkPermission(Set<Option> options) {
|
||||
Objects.requireNonNull(options);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
if (options.contains(Option.RETAIN_CLASS_REFERENCE)) {
|
||||
|
@ -517,6 +517,7 @@ public final class String
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public String(byte[] bytes, int offset, int length, Charset charset) {
|
||||
Objects.requireNonNull(charset);
|
||||
checkBoundsOffCount(offset, length, bytes.length);
|
||||
@ -745,6 +746,7 @@ public final class String
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static String newStringNoRepl1(byte[] src, Charset cs) {
|
||||
int len = src.length;
|
||||
if (len == 0) {
|
||||
@ -794,6 +796,7 @@ public final class String
|
||||
private static final char REPL = '\ufffd';
|
||||
|
||||
// Trim the given byte array to the given length
|
||||
@SuppressWarnings("removal")
|
||||
private static byte[] safeTrim(byte[] ba, int len, boolean isTrusted) {
|
||||
if (len == ba.length && (isTrusted || System.getSecurityManager() == null)) {
|
||||
return ba;
|
||||
|
@ -181,6 +181,7 @@ public final class System {
|
||||
private static @Stable int allowSecurityManager;
|
||||
|
||||
// current security manager
|
||||
@SuppressWarnings("removal")
|
||||
private static volatile SecurityManager security; // read by VM
|
||||
|
||||
// return true if a security manager is allowed
|
||||
@ -312,6 +313,7 @@ public final class System {
|
||||
}
|
||||
|
||||
private static void checkIO() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("setIO"));
|
||||
@ -352,26 +354,19 @@ public final class System {
|
||||
* @see #getSecurityManager
|
||||
* @see SecurityManager#checkPermission
|
||||
* @see java.lang.RuntimePermission
|
||||
* @deprecated This method is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is
|
||||
* deprecated and subject to removal in a future release.
|
||||
* Consequently, this method is also deprecated and subject to
|
||||
* removal. There is no replacement for the Security Manager or this
|
||||
* method.
|
||||
*/
|
||||
public static void setSecurityManager(SecurityManager sm) {
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public static void setSecurityManager(@SuppressWarnings("removal") SecurityManager sm) {
|
||||
if (allowSecurityManager()) {
|
||||
if (security == null) {
|
||||
// ensure image reader is initialized
|
||||
Object.class.getResource("java/lang/ANY");
|
||||
// ensure the default file system is initialized
|
||||
DefaultFileSystemProvider.theFileSystem();
|
||||
}
|
||||
if (sm != null) {
|
||||
try {
|
||||
// pre-populates the SecurityManager.packageAccess cache
|
||||
// to avoid recursive permission checking issues with custom
|
||||
// SecurityManager implementations
|
||||
sm.checkPackageAccess("java.lang");
|
||||
} catch (Exception e) {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
setSecurityManager0(sm);
|
||||
System.err.println("WARNING: java.lang.System::setSecurityManager" +
|
||||
" is deprecated and will be removed in a future release.");
|
||||
implSetSecurityManager(sm);
|
||||
} else {
|
||||
// security manager not allowed
|
||||
if (sm != null) {
|
||||
@ -381,6 +376,27 @@ public final class System {
|
||||
}
|
||||
}
|
||||
|
||||
private static void implSetSecurityManager(@SuppressWarnings("removal") SecurityManager sm) {
|
||||
if (security == null) {
|
||||
// ensure image reader is initialized
|
||||
Object.class.getResource("java/lang/ANY");
|
||||
// ensure the default file system is initialized
|
||||
DefaultFileSystemProvider.theFileSystem();
|
||||
}
|
||||
if (sm != null) {
|
||||
try {
|
||||
// pre-populates the SecurityManager.packageAccess cache
|
||||
// to avoid recursive permission checking issues with custom
|
||||
// SecurityManager implementations
|
||||
sm.checkPackageAccess("java.lang");
|
||||
} catch (Exception e) {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
setSecurityManager0(sm);
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static synchronized
|
||||
void setSecurityManager0(final SecurityManager s) {
|
||||
SecurityManager sm = getSecurityManager();
|
||||
@ -418,7 +434,15 @@ public final class System {
|
||||
* current application, then that security manager is returned;
|
||||
* otherwise, {@code null} is returned.
|
||||
* @see #setSecurityManager
|
||||
* @deprecated This method is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is
|
||||
* deprecated and subject to removal in a future release.
|
||||
* Consequently, this method is also deprecated and subject to
|
||||
* removal. There is no replacement for the Security Manager or this
|
||||
* method.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public static SecurityManager getSecurityManager() {
|
||||
if (allowSecurityManager()) {
|
||||
return security;
|
||||
@ -750,6 +774,7 @@ public final class System {
|
||||
* @see java.util.Properties
|
||||
*/
|
||||
public static Properties getProperties() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPropertiesAccess();
|
||||
@ -802,6 +827,7 @@ public final class System {
|
||||
* @see java.lang.SecurityManager#checkPropertiesAccess()
|
||||
*/
|
||||
public static void setProperties(Properties props) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPropertiesAccess();
|
||||
@ -847,6 +873,7 @@ public final class System {
|
||||
*/
|
||||
public static String getProperty(String key) {
|
||||
checkKey(key);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPropertyAccess(key);
|
||||
@ -882,6 +909,7 @@ public final class System {
|
||||
*/
|
||||
public static String getProperty(String key, String def) {
|
||||
checkKey(key);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPropertyAccess(key);
|
||||
@ -925,6 +953,7 @@ public final class System {
|
||||
*/
|
||||
public static String setProperty(String key, String value) {
|
||||
checkKey(key);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new PropertyPermission(key,
|
||||
@ -966,6 +995,7 @@ public final class System {
|
||||
*/
|
||||
public static String clearProperty(String key) {
|
||||
checkKey(key);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new PropertyPermission(key, "write"));
|
||||
@ -1030,6 +1060,7 @@ public final class System {
|
||||
* @see ProcessBuilder#environment()
|
||||
*/
|
||||
public static String getenv(String name) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("getenv."+name));
|
||||
@ -1079,6 +1110,7 @@ public final class System {
|
||||
* @since 1.5
|
||||
*/
|
||||
public static java.util.Map<String,String> getenv() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("getenv.*"));
|
||||
@ -1546,6 +1578,7 @@ public final class System {
|
||||
}
|
||||
|
||||
private static Void checkPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
final SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(LOGGERFINDER_PERMISSION);
|
||||
@ -1629,6 +1662,7 @@ public final class System {
|
||||
* {@code RuntimePermission("loggerFinder")}.
|
||||
*/
|
||||
public static LoggerFinder getLoggerFinder() {
|
||||
@SuppressWarnings("removal")
|
||||
final SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(LOGGERFINDER_PERMISSION);
|
||||
@ -1638,6 +1672,7 @@ public final class System {
|
||||
|
||||
|
||||
private static volatile LoggerFinder service;
|
||||
@SuppressWarnings("removal")
|
||||
static LoggerFinder accessProvider() {
|
||||
// We do not need to synchronize: LoggerFinderLoader will
|
||||
// always return the same instance, so if we don't have it,
|
||||
@ -1741,6 +1776,7 @@ public final class System {
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@CallerSensitive
|
||||
public static Logger getLogger(String name, ResourceBundle bundle) {
|
||||
final ResourceBundle rb = Objects.requireNonNull(bundle);
|
||||
@ -2103,6 +2139,7 @@ public final class System {
|
||||
* The security manager and system class loader may be a custom class from
|
||||
* the application classpath or modulepath.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static void initPhase3() {
|
||||
|
||||
// Initialize the StringConcatFactory eagerly to avoid potential
|
||||
@ -2111,6 +2148,7 @@ public final class System {
|
||||
Unsafe.getUnsafe().ensureClassInitialized(StringConcatFactory.class);
|
||||
|
||||
String smProp = System.getProperty("java.security.manager");
|
||||
boolean needWarning = false;
|
||||
if (smProp != null) {
|
||||
switch (smProp) {
|
||||
case "disallow":
|
||||
@ -2121,8 +2159,9 @@ public final class System {
|
||||
break;
|
||||
case "":
|
||||
case "default":
|
||||
setSecurityManager(new SecurityManager());
|
||||
implSetSecurityManager(new SecurityManager());
|
||||
allowSecurityManager = MAYBE;
|
||||
needWarning = true;
|
||||
break;
|
||||
default:
|
||||
try {
|
||||
@ -2140,7 +2179,8 @@ public final class System {
|
||||
// custom security manager may be in non-exported package
|
||||
ctor.setAccessible(true);
|
||||
SecurityManager sm = (SecurityManager) ctor.newInstance();
|
||||
setSecurityManager(sm);
|
||||
implSetSecurityManager(sm);
|
||||
needWarning = true;
|
||||
} catch (Exception e) {
|
||||
throw new InternalError("Could not create SecurityManager", e);
|
||||
}
|
||||
@ -2150,6 +2190,11 @@ public final class System {
|
||||
allowSecurityManager = MAYBE;
|
||||
}
|
||||
|
||||
if (needWarning) {
|
||||
System.err.println("WARNING: The Security Manager is deprecated" +
|
||||
" and will be removed in a future release.");
|
||||
}
|
||||
|
||||
// initializing the system class loader
|
||||
VM.initLevel(3);
|
||||
|
||||
@ -2200,7 +2245,7 @@ public final class System {
|
||||
public void registerShutdownHook(int slot, boolean registerShutdownInProgress, Runnable hook) {
|
||||
Shutdown.add(slot, registerShutdownInProgress, hook);
|
||||
}
|
||||
public Thread newThreadWithAcc(Runnable target, AccessControlContext acc) {
|
||||
public Thread newThreadWithAcc(Runnable target, @SuppressWarnings("removal") AccessControlContext acc) {
|
||||
return new Thread(target, acc);
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -2226,9 +2271,11 @@ public final class System {
|
||||
public String fastUUID(long lsb, long msb) {
|
||||
return Long.fastUUID(lsb, msb);
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
public void addNonExportedPackages(ModuleLayer layer) {
|
||||
SecurityManager.addNonExportedPackages(layer);
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
public void invalidatePackageAccessCache() {
|
||||
SecurityManager.invalidatePackageAccessCache();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -169,6 +169,7 @@ public class Thread implements Runnable {
|
||||
private ClassLoader contextClassLoader;
|
||||
|
||||
/* The inherited AccessControlContext of this thread */
|
||||
@SuppressWarnings("removal")
|
||||
private AccessControlContext inheritedAccessControlContext;
|
||||
|
||||
/* For autonumbering anonymous threads. */
|
||||
@ -388,6 +389,7 @@ public class Thread implements Runnable {
|
||||
* @param inheritThreadLocals if {@code true}, inherit initial values for
|
||||
* inheritable thread-locals from the constructing thread
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private Thread(ThreadGroup g, Runnable target, String name,
|
||||
long stackSize, AccessControlContext acc,
|
||||
boolean inheritThreadLocals) {
|
||||
@ -496,7 +498,7 @@ public class Thread implements Runnable {
|
||||
* but thread-local variables are not inherited.
|
||||
* This is not a public constructor.
|
||||
*/
|
||||
Thread(Runnable target, AccessControlContext acc) {
|
||||
Thread(Runnable target, @SuppressWarnings("removal") AccessControlContext acc) {
|
||||
this(null, target, "Thread-" + nextThreadNum(), 0, acc, false);
|
||||
}
|
||||
|
||||
@ -922,6 +924,7 @@ public class Thread implements Runnable {
|
||||
*/
|
||||
@Deprecated(since="1.2")
|
||||
public final void stop() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
checkAccess();
|
||||
@ -1424,8 +1427,16 @@ public class Thread implements Runnable {
|
||||
* @throws SecurityException if the current thread is not allowed to
|
||||
* access this thread.
|
||||
* @see SecurityManager#checkAccess(Thread)
|
||||
* @deprecated This method is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is
|
||||
* deprecated and subject to removal in a future release.
|
||||
* Consequently, this method is also deprecated and subject to
|
||||
* removal. There is no replacement for the Security Manager or this
|
||||
* method.
|
||||
*/
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public final void checkAccess() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkAccess(this);
|
||||
@ -1476,6 +1487,7 @@ public class Thread implements Runnable {
|
||||
public ClassLoader getContextClassLoader() {
|
||||
if (contextClassLoader == null)
|
||||
return null;
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
ClassLoader.checkClassLoaderPermission(contextClassLoader,
|
||||
@ -1507,6 +1519,7 @@ public class Thread implements Runnable {
|
||||
* @since 1.2
|
||||
*/
|
||||
public void setContextClassLoader(ClassLoader cl) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("setContextClassLoader"));
|
||||
@ -1574,6 +1587,7 @@ public class Thread implements Runnable {
|
||||
public StackTraceElement[] getStackTrace() {
|
||||
if (this != Thread.currentThread()) {
|
||||
// check for getStackTrace permission
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkPermission(
|
||||
@ -1634,6 +1648,7 @@ public class Thread implements Runnable {
|
||||
*/
|
||||
public static Map<Thread, StackTraceElement[]> getAllStackTraces() {
|
||||
// check for getStackTrace permission
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkPermission(
|
||||
@ -1696,6 +1711,7 @@ public class Thread implements Runnable {
|
||||
* subclass overrides any of the methods, false otherwise.
|
||||
*/
|
||||
private static boolean auditSubclass(final Class<?> subcl) {
|
||||
@SuppressWarnings("removal")
|
||||
Boolean result = AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
public Boolean run() {
|
||||
@ -1927,6 +1943,7 @@ public class Thread implements Runnable {
|
||||
* @since 1.5
|
||||
*/
|
||||
public static void setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler eh) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -320,8 +320,16 @@ public class ThreadGroup implements Thread.UncaughtExceptionHandler {
|
||||
* access this thread group.
|
||||
* @see java.lang.SecurityManager#checkAccess(java.lang.ThreadGroup)
|
||||
* @since 1.0
|
||||
* @deprecated This method is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is
|
||||
* deprecated and subject to removal in a future release.
|
||||
* Consequently, this method is also deprecated and subject to
|
||||
* removal. There is no replacement for the Security Manager or this
|
||||
* method.
|
||||
*/
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public final void checkAccess() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkAccess(this);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -134,6 +134,7 @@ final class MethodTypeDescImpl implements MethodTypeDesc {
|
||||
|
||||
@Override
|
||||
public MethodType resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException {
|
||||
@SuppressWarnings("removal")
|
||||
MethodType mtype = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public MethodType run() {
|
||||
|
@ -566,6 +566,7 @@ abstract class ClassSpecializer<T,K,S extends ClassSpecializer<T,K,S>.SpeciesDat
|
||||
* @param speciesData what species we are generating
|
||||
* @return the generated concrete TopClass class
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
Class<? extends T> generateConcreteSpeciesCode(String className, ClassSpecializer<T,K,S>.SpeciesData speciesData) {
|
||||
byte[] classFile = generateConcreteSpeciesCodeFile(className, speciesData);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -87,6 +87,7 @@ final class InfoFromMemberName implements MethodHandleInfo {
|
||||
// For more information see comments on {@link MethodHandleNatives#linkMethod}.
|
||||
throw new IllegalArgumentException("cannot reflect signature polymorphic method");
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
Member mem = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public Member run() {
|
||||
try {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -228,6 +228,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
"Exception finding " + LAMBDA_INSTANCE_FIELD + " static field", e);
|
||||
}
|
||||
} else {
|
||||
@SuppressWarnings("removal")
|
||||
final Constructor<?>[] ctrs = AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
@Override
|
||||
@ -319,6 +320,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
* @throws LambdaConversionException If properly formed functional interface
|
||||
* is not found
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private Class<?> generateInnerClass() throws LambdaConversionException {
|
||||
String[] interfaces;
|
||||
String samIntf = samBase.getName().replace('.', '/');
|
||||
|
@ -202,6 +202,7 @@ class InvokerBytecodeGenerator {
|
||||
}
|
||||
|
||||
// Also used from BoundMethodHandle
|
||||
@SuppressWarnings("removal")
|
||||
static void maybeDump(final String className, final byte[] classFile) {
|
||||
if (DUMP_CLASS_FILES) {
|
||||
java.security.AccessController.doPrivileged(
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -151,6 +151,7 @@ public class MethodHandleProxies {
|
||||
// entry points, must be covered by hand-written or automatically
|
||||
// generated adapter classes.
|
||||
//
|
||||
@SuppressWarnings("removal")
|
||||
@CallerSensitive
|
||||
public static <T> T asInterfaceInstance(final Class<T> intfc, final MethodHandle target) {
|
||||
if (!intfc.isInterface() || !Modifier.isPublic(intfc.getModifiers()))
|
||||
|
@ -228,6 +228,7 @@ public class MethodHandles {
|
||||
return new Lookup(targetClass);
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) sm.checkPermission(ACCESS_PERMISSION);
|
||||
if (targetClass.isPrimitive())
|
||||
@ -440,6 +441,7 @@ public class MethodHandles {
|
||||
* @since 1.8
|
||||
*/
|
||||
public static <T extends Member> T reflectAs(Class<T> expected, MethodHandle target) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager smgr = System.getSecurityManager();
|
||||
if (smgr != null) smgr.checkPermission(ACCESS_PERMISSION);
|
||||
Lookup lookup = Lookup.IMPL_LOOKUP; // use maximally privileged lookup
|
||||
@ -1845,6 +1847,7 @@ public class MethodHandles {
|
||||
if (allowedModes == TRUSTED) return;
|
||||
|
||||
if (!hasFullPrivilegeAccess()) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("defineClass"));
|
||||
@ -3740,6 +3743,7 @@ return mh1;
|
||||
void checkSecurityManager(Class<?> refc) {
|
||||
if (allowedModes == TRUSTED) return;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager smgr = System.getSecurityManager();
|
||||
if (smgr == null) return;
|
||||
|
||||
@ -3771,6 +3775,7 @@ return mh1;
|
||||
|
||||
if (allowedModes == TRUSTED) return;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager smgr = System.getSecurityManager();
|
||||
if (smgr == null) return;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1134,6 +1134,7 @@ class MethodType
|
||||
throws IllegalArgumentException, TypeNotPresentException
|
||||
{
|
||||
if (loader == null) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -56,6 +56,7 @@ final class ProxyClassesDumper {
|
||||
|
||||
private final Path dumpDir;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public static ProxyClassesDumper getInstance(String path) {
|
||||
if (null == path) {
|
||||
return null;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -265,6 +265,7 @@ public final class SerializedLambda implements Serializable {
|
||||
@java.io.Serial
|
||||
private Object readResolve() throws ObjectStreamException {
|
||||
try {
|
||||
@SuppressWarnings("removal")
|
||||
Method deserialize = AccessController.doPrivileged(new PrivilegedExceptionAction<>() {
|
||||
@Override
|
||||
public Method run() throws Exception {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -148,6 +148,7 @@ public interface ModuleFinder {
|
||||
* @throws SecurityException
|
||||
* If denied by the security manager
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
static ModuleFinder ofSystem() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -105,6 +105,7 @@ final class Finalizer extends FinalReference<Object> { /* Package-private; must
|
||||
* The advantage of creating a fresh thread, however, is that it insulates
|
||||
* invokers of that method from a stalled or deadlocked finalizer thread.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static void forkSecondaryFinalizer(final Runnable proc) {
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
|
@ -82,6 +82,7 @@ public class AccessibleObject implements AnnotatedElement {
|
||||
}
|
||||
|
||||
static void checkPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
// SecurityConstants.ACCESS_PERMISSION is used to check
|
||||
@ -483,6 +484,7 @@ public class AccessibleObject implements AnnotatedElement {
|
||||
// Reflection factory used by subclasses for creating field,
|
||||
// method, and constructor accessors. Note that this is called
|
||||
// very early in the bootstrapping process.
|
||||
@SuppressWarnings("removal")
|
||||
static final ReflectionFactory reflectionFactory =
|
||||
AccessController.doPrivileged(
|
||||
new ReflectionFactory.GetReflectionFactoryAction());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -390,6 +390,7 @@ public class Proxy implements java.io.Serializable {
|
||||
Class<?>... interfaces)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
Class<?> caller = System.getSecurityManager() == null
|
||||
? null
|
||||
: Reflection.getCallerClass();
|
||||
@ -463,6 +464,7 @@ public class Proxy implements java.io.Serializable {
|
||||
ClassLoader loader,
|
||||
Class<?> ... interfaces)
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
ClassLoader ccl = caller.getClassLoader();
|
||||
@ -663,6 +665,7 @@ public class Proxy implements java.io.Serializable {
|
||||
* Must call the checkProxyAccess method to perform permission checks
|
||||
* before calling this.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
Constructor<?> build() {
|
||||
Class<?> proxyClass = defineProxyClass(module, interfaces);
|
||||
assert !module.isNamed() || module.isOpen(proxyClass.getPackageName(), Proxy.class.getModule());
|
||||
@ -1018,6 +1021,7 @@ public class Proxy implements java.io.Serializable {
|
||||
InvocationHandler h) {
|
||||
Objects.requireNonNull(h);
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
final Class<?> caller = System.getSecurityManager() == null
|
||||
? null
|
||||
: Reflection.getCallerClass();
|
||||
@ -1055,6 +1059,7 @@ public class Proxy implements java.io.Serializable {
|
||||
}
|
||||
|
||||
private static void checkNewProxyPermission(Class<?> caller, Class<?> proxyClass) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
if (ReflectUtil.isNonPublicProxyClass(proxyClass)) {
|
||||
@ -1076,6 +1081,7 @@ public class Proxy implements java.io.Serializable {
|
||||
/**
|
||||
* Returns the class loader for the given module.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static ClassLoader getLoader(Module m) {
|
||||
PrivilegedAction<ClassLoader> pa = m::getClassLoader;
|
||||
return AccessController.doPrivileged(pa);
|
||||
@ -1113,6 +1119,7 @@ public class Proxy implements java.io.Serializable {
|
||||
* s.checkPackageAccess()} denies access to the invocation
|
||||
* handler's class.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@CallerSensitive
|
||||
public static InvocationHandler getInvocationHandler(Object proxy)
|
||||
throws IllegalArgumentException
|
||||
@ -1286,6 +1293,7 @@ public class Proxy implements java.io.Serializable {
|
||||
*
|
||||
* @return a lookup for proxy class of this proxy instance
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static MethodHandles.Lookup proxyClassLookup(MethodHandles.Lookup caller, Class<?> proxyClass) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -92,6 +92,7 @@ final class ProxyGenerator extends ClassWriter {
|
||||
/**
|
||||
* debugging flag for saving generated class files
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static final boolean saveGeneratedFiles =
|
||||
java.security.AccessController.doPrivileged(
|
||||
new GetBooleanAction(
|
||||
@ -168,6 +169,7 @@ final class ProxyGenerator extends ClassWriter {
|
||||
* @param interfaces proxy interfaces
|
||||
* @param accessFlags access flags of the proxy class
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
static byte[] generateProxyClass(ClassLoader loader,
|
||||
final String name,
|
||||
List<Class<?>> interfaces,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -76,6 +76,7 @@ public class ObjectMethods {
|
||||
MethodHandles.Lookup publicLookup = MethodHandles.publicLookup();
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
|
||||
@Override public ClassLoader run() { return ClassLoader.getPlatformClassLoader(); }
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -585,6 +585,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
||||
/**
|
||||
* Gets an InputStream for this socket.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected synchronized InputStream getInputStream() throws IOException {
|
||||
synchronized (fdLock) {
|
||||
if (isClosedOrPending())
|
||||
@ -610,6 +611,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
||||
/**
|
||||
* Gets an OutputStream for this socket.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected synchronized OutputStream getOutputStream() throws IOException {
|
||||
synchronized (fdLock) {
|
||||
if (isClosedOrPending())
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -128,6 +128,7 @@ class Authenticator {
|
||||
* @see java.net.NetPermission
|
||||
*/
|
||||
public static synchronized void setDefault(Authenticator a) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission setDefaultPermission
|
||||
@ -158,6 +159,7 @@ class Authenticator {
|
||||
* @see java.net.NetPermission
|
||||
*/
|
||||
public static Authenticator getDefault() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission requestPermission
|
||||
@ -201,6 +203,7 @@ class Authenticator {
|
||||
String prompt,
|
||||
String scheme) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission requestPermission
|
||||
@ -263,6 +266,7 @@ class Authenticator {
|
||||
String prompt,
|
||||
String scheme) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission requestPermission
|
||||
@ -330,6 +334,7 @@ class Authenticator {
|
||||
URL url,
|
||||
RequestorType reqType) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission requestPermission
|
||||
@ -403,6 +408,7 @@ class Authenticator {
|
||||
URL url,
|
||||
RequestorType reqType) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
NetPermission requestPermission
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -75,6 +75,7 @@ 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);
|
||||
@ -95,6 +96,7 @@ 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);
|
||||
|
@ -1151,6 +1151,7 @@ public class DatagramSocket implements java.io.Closeable {
|
||||
if (factory != null) {
|
||||
throw new SocketException("factory already defined");
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkSetFactory();
|
||||
@ -1341,6 +1342,7 @@ public class DatagramSocket implements java.io.Closeable {
|
||||
|
||||
private static boolean usePlainDatagramSocketImpl() {
|
||||
PrivilegedAction<String> pa = () -> NetProperties.get("jdk.net.usePlainDatagramSocketImpl");
|
||||
@SuppressWarnings("removal")
|
||||
String s = AccessController.doPrivileged(pa);
|
||||
return (s != null) && (s.isEmpty() || s.equalsIgnoreCase("true"));
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ import java.util.Set;
|
||||
* @since 1.8
|
||||
*/
|
||||
|
||||
/*package*/ class HttpConnectSocketImpl extends DelegatingSocketImpl {
|
||||
/*package*/ @SuppressWarnings("removal") class HttpConnectSocketImpl extends DelegatingSocketImpl {
|
||||
|
||||
private static final String httpURLClazzStr =
|
||||
"sun.net.www.protocol.http.HttpURLConnection";
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -388,6 +388,7 @@ public abstract class HttpURLConnection extends URLConnection {
|
||||
* @see #getFollowRedirects()
|
||||
*/
|
||||
public static void setFollowRedirects(boolean set) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sec = System.getSecurityManager();
|
||||
if (sec != null) {
|
||||
// seems to be the best check here...
|
||||
@ -475,6 +476,7 @@ public abstract class HttpURLConnection extends URLConnection {
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (methods[i].equals(method)) {
|
||||
if (method.equals("TRACE")) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null) {
|
||||
s.checkPermission(new NetPermission("allowHttpTrace"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -72,6 +72,7 @@ import jdk.internal.icu.text.UCharacterIterator;
|
||||
* @since 1.6
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public final class IDN {
|
||||
/**
|
||||
* Flag to allow processing of unassigned code points
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -665,6 +665,7 @@ public class InetAddress implements java.io.Serializable {
|
||||
* the hostname for this IP address, ie, connect to the host
|
||||
*/
|
||||
if (check) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sec = System.getSecurityManager();
|
||||
if (sec != null) {
|
||||
sec.checkConnect(host, -1);
|
||||
@ -1450,6 +1451,7 @@ public class InetAddress implements java.io.Serializable {
|
||||
* give out a hostname
|
||||
*/
|
||||
if (check) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkConnect(host, -1);
|
||||
@ -1611,6 +1613,7 @@ public class InetAddress implements java.io.Serializable {
|
||||
*/
|
||||
public static InetAddress getLocalHost() throws UnknownHostException {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
try {
|
||||
// is cached data still valid?
|
||||
|
@ -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)
|
||||
|
@ -133,6 +133,7 @@ public final class NetworkInterface {
|
||||
InetAddress[] local_addrs = new InetAddress[addrs.length];
|
||||
boolean trusted = true;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sec = System.getSecurityManager();
|
||||
if (sec != null) {
|
||||
try {
|
||||
@ -169,6 +170,7 @@ public final class NetworkInterface {
|
||||
public java.util.List<InterfaceAddress> getInterfaceAddresses() {
|
||||
java.util.List<InterfaceAddress> lst = new java.util.ArrayList<>(1);
|
||||
if (bindings != null) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sec = System.getSecurityManager();
|
||||
for (int j=0; j<bindings.length; j++) {
|
||||
try {
|
||||
@ -512,6 +514,7 @@ public final class NetworkInterface {
|
||||
* @since 1.6
|
||||
*/
|
||||
public byte[] getHardwareAddress() throws SocketException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sec = System.getSecurityManager();
|
||||
if (sec != null) {
|
||||
try {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -96,6 +96,7 @@ public abstract class ProxySelector {
|
||||
* @since 1.5
|
||||
*/
|
||||
public static ProxySelector getDefault() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.GET_PROXYSELECTOR_PERMISSION);
|
||||
@ -119,6 +120,7 @@ public abstract class ProxySelector {
|
||||
* @since 1.5
|
||||
*/
|
||||
public static void setDefault(ProxySelector ps) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.SET_PROXYSELECTOR_PERMISSION);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -86,6 +86,7 @@ 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);
|
||||
@ -109,6 +110,7 @@ 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);
|
||||
|
@ -109,6 +109,7 @@ public class ServerSocket implements java.io.Closeable {
|
||||
}
|
||||
|
||||
private static Void checkPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.SET_SOCKETIMPL_PERMISSION);
|
||||
@ -380,6 +381,7 @@ public class ServerSocket implements java.io.Closeable {
|
||||
if (backlog < 1)
|
||||
backlog = 50;
|
||||
try {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null)
|
||||
security.checkListen(epoint.getPort());
|
||||
@ -418,6 +420,7 @@ public class ServerSocket implements java.io.Closeable {
|
||||
return null;
|
||||
try {
|
||||
InetAddress in = getImpl().getInetAddress();
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkConnect(in.getHostAddress(), -1);
|
||||
@ -672,6 +675,7 @@ public class ServerSocket implements java.io.Closeable {
|
||||
impl.accept(si);
|
||||
|
||||
// check permission, close SocketImpl/connection if denied
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
try {
|
||||
@ -879,6 +883,7 @@ public class ServerSocket implements java.io.Closeable {
|
||||
*
|
||||
* @return a string representation of this socket.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public String toString() {
|
||||
if (!isBound())
|
||||
return "ServerSocket[unbound]";
|
||||
@ -935,6 +940,7 @@ public class ServerSocket implements java.io.Closeable {
|
||||
if (factory != null) {
|
||||
throw new SocketException("factory already defined");
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkSetFactory();
|
||||
|
@ -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();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -67,6 +67,7 @@ public abstract class SocketImpl implements SocketOptions {
|
||||
|
||||
private static boolean usePlainSocketImpl() {
|
||||
PrivilegedAction<String> pa = () -> NetProperties.get("jdk.net.usePlainSocketImpl");
|
||||
@SuppressWarnings("removal")
|
||||
String s = AccessController.doPrivileged(pa);
|
||||
return (s != null) && !s.equalsIgnoreCase("false");
|
||||
}
|
||||
|
@ -245,6 +245,7 @@ public final class SocketPermission extends Permission
|
||||
};
|
||||
|
||||
static {
|
||||
@SuppressWarnings("removal")
|
||||
Boolean tmp = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetBooleanAction("sun.net.trustNameService"));
|
||||
trustNameService = tmp.booleanValue();
|
||||
@ -1224,6 +1225,7 @@ public final class SocketPermission extends Permission
|
||||
* Check the system/security property for the ephemeral port range
|
||||
* for this system. The suffix is either "high" or "low"
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static int initEphemeralPorts(String suffix, int defval) {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<>(){
|
||||
|
@ -73,6 +73,7 @@ class SocksSocketImpl extends DelegatingSocketImpl implements SocksConsts {
|
||||
return DefaultProxySelector.socksProxyVersion() == 4;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private synchronized void privilegedConnect(final String host,
|
||||
final int port,
|
||||
final int timeout)
|
||||
@ -148,6 +149,7 @@ class SocksSocketImpl extends DelegatingSocketImpl implements SocksConsts {
|
||||
String userName;
|
||||
String password = null;
|
||||
final InetAddress addr = InetAddress.getByName(server);
|
||||
@SuppressWarnings("removal")
|
||||
PasswordAuthentication pw =
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<>() {
|
||||
@ -270,6 +272,7 @@ class SocksSocketImpl extends DelegatingSocketImpl implements SocksConsts {
|
||||
deadlineMillis = finish < 0 ? Long.MAX_VALUE : finish;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (!(endpoint instanceof InetSocketAddress epoint))
|
||||
throw new IllegalArgumentException("Unsupported address type");
|
||||
@ -285,6 +288,7 @@ class SocksSocketImpl extends DelegatingSocketImpl implements SocksConsts {
|
||||
// This is the general case
|
||||
// server is not null only when the socket was created with a
|
||||
// specified proxy in which case it does bypass the ProxySelector
|
||||
@SuppressWarnings("removal")
|
||||
ProxySelector sel = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<>() {
|
||||
public ProxySelector run() {
|
||||
|
@ -431,6 +431,7 @@ public final class URL implements java.io.Serializable {
|
||||
public URL(String protocol, String host, int port, String file,
|
||||
URLStreamHandler handler) throws MalformedURLException {
|
||||
if (handler != null) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
// check for permission to specify a handler
|
||||
@ -602,6 +603,7 @@ public final class URL implements java.io.Serializable {
|
||||
|
||||
// Check for permission to specify a handler
|
||||
if (handler != null) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
checkSpecifyHandler(sm);
|
||||
@ -770,7 +772,7 @@ public final class URL implements java.io.Serializable {
|
||||
/*
|
||||
* Checks for permission to specify a stream handler.
|
||||
*/
|
||||
private void checkSpecifyHandler(SecurityManager sm) {
|
||||
private void checkSpecifyHandler(@SuppressWarnings("removal") SecurityManager sm) {
|
||||
sm.checkPermission(SecurityConstants.SPECIFY_HANDLER_PERMISSION);
|
||||
}
|
||||
|
||||
@ -1129,6 +1131,7 @@ public final class URL implements java.io.Serializable {
|
||||
|
||||
// Create a copy of Proxy as a security measure
|
||||
Proxy p = proxy == Proxy.NO_PROXY ? Proxy.NO_PROXY : sun.net.ApplicationProxy.create(proxy);
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (p.type() != Proxy.Type.DIRECT && sm != null) {
|
||||
InetSocketAddress epoint = (InetSocketAddress) p.address();
|
||||
@ -1224,6 +1227,7 @@ public final class URL implements java.io.Serializable {
|
||||
if (factory != null) {
|
||||
throw new Error("factory already defined");
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkSetFactory();
|
||||
@ -1341,6 +1345,7 @@ public final class URL implements java.io.Serializable {
|
||||
// Thread-local gate to prevent recursive provider lookups
|
||||
private static ThreadLocal<Object> gate = new ThreadLocal<>();
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static URLStreamHandler lookupViaProviders(final String protocol) {
|
||||
if (gate.get() != null)
|
||||
throw new Error("Circular loading of URL stream handler providers detected");
|
||||
|
@ -84,6 +84,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
private final URLClassPath ucp;
|
||||
|
||||
/* The context to be used when loading classes and resources */
|
||||
@SuppressWarnings("removal")
|
||||
private final AccessControlContext acc;
|
||||
|
||||
/**
|
||||
@ -108,6 +109,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
* elements is {@code null}.
|
||||
* @see SecurityManager#checkCreateClassLoader
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public URLClassLoader(URL[] urls, ClassLoader parent) {
|
||||
super(parent);
|
||||
this.acc = AccessController.getContext();
|
||||
@ -115,7 +117,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
}
|
||||
|
||||
URLClassLoader(String name, URL[] urls, ClassLoader parent,
|
||||
AccessControlContext acc) {
|
||||
@SuppressWarnings("removal") AccessControlContext acc) {
|
||||
super(name, parent);
|
||||
this.acc = acc;
|
||||
this.ucp = new URLClassPath(urls, acc);
|
||||
@ -143,13 +145,14 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
* elements is {@code null}.
|
||||
* @see SecurityManager#checkCreateClassLoader
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public URLClassLoader(URL[] urls) {
|
||||
super();
|
||||
this.acc = AccessController.getContext();
|
||||
this.ucp = new URLClassPath(urls, acc);
|
||||
}
|
||||
|
||||
URLClassLoader(URL[] urls, AccessControlContext acc) {
|
||||
URLClassLoader(URL[] urls, @SuppressWarnings("removal") AccessControlContext acc) {
|
||||
super();
|
||||
this.acc = acc;
|
||||
this.ucp = new URLClassPath(urls, acc);
|
||||
@ -177,6 +180,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
* elements is {@code null}.
|
||||
* @see SecurityManager#checkCreateClassLoader
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public URLClassLoader(URL[] urls, ClassLoader parent,
|
||||
URLStreamHandlerFactory factory) {
|
||||
super(parent);
|
||||
@ -207,6 +211,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public URLClassLoader(String name,
|
||||
URL[] urls,
|
||||
ClassLoader parent) {
|
||||
@ -237,6 +242,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public URLClassLoader(String name, URL[] urls, ClassLoader parent,
|
||||
URLStreamHandlerFactory factory) {
|
||||
super(name, parent);
|
||||
@ -335,6 +341,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
* @since 1.7
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkPermission(new RuntimePermission("closeClassLoader"));
|
||||
@ -404,6 +411,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
* or if the loader is closed.
|
||||
* @throws NullPointerException if {@code name} is {@code null}.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected Class<?> findClass(final String name)
|
||||
throws ClassNotFoundException
|
||||
{
|
||||
@ -609,6 +617,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
/*
|
||||
* The same restriction to finding classes applies to resources
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
URL url = AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
public URL run() {
|
||||
@ -641,6 +650,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
return true;
|
||||
}
|
||||
do {
|
||||
@SuppressWarnings("removal")
|
||||
URL u = AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
public URL run() {
|
||||
@ -695,6 +705,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
* @throws NullPointerException if {@code codesource} is {@code null}.
|
||||
* @return the permissions granted to the codesource
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected PermissionCollection getPermissions(CodeSource codesource)
|
||||
{
|
||||
PermissionCollection perms = super.getPermissions(codesource);
|
||||
@ -779,8 +790,10 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
public static URLClassLoader newInstance(final URL[] urls,
|
||||
final ClassLoader parent) {
|
||||
// Save the caller's context
|
||||
@SuppressWarnings("removal")
|
||||
final AccessControlContext acc = AccessController.getContext();
|
||||
// Need a privileged block to create the class loader
|
||||
@SuppressWarnings("removal")
|
||||
URLClassLoader ucl = AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
public URLClassLoader run() {
|
||||
@ -805,8 +818,10 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
*/
|
||||
public static URLClassLoader newInstance(final URL[] urls) {
|
||||
// Save the caller's context
|
||||
@SuppressWarnings("removal")
|
||||
final AccessControlContext acc = AccessController.getContext();
|
||||
// Need a privileged block to create the class loader
|
||||
@SuppressWarnings("removal")
|
||||
URLClassLoader ucl = AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
public URLClassLoader run() {
|
||||
@ -828,11 +843,11 @@ final class FactoryURLClassLoader extends URLClassLoader {
|
||||
}
|
||||
|
||||
FactoryURLClassLoader(String name, URL[] urls, ClassLoader parent,
|
||||
AccessControlContext acc) {
|
||||
@SuppressWarnings("removal") AccessControlContext acc) {
|
||||
super(name, urls, parent, acc);
|
||||
}
|
||||
|
||||
FactoryURLClassLoader(URL[] urls, AccessControlContext acc) {
|
||||
FactoryURLClassLoader(URL[] urls, @SuppressWarnings("removal") AccessControlContext acc) {
|
||||
super(urls, acc);
|
||||
}
|
||||
|
||||
@ -841,6 +856,7 @@ final class FactoryURLClassLoader extends URLClassLoader {
|
||||
{
|
||||
// First check if we have permission to access the package. This
|
||||
// should go away once we've added support for exported packages.
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
int i = name.lastIndexOf('.');
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -334,6 +334,7 @@ public abstract class URLConnection {
|
||||
* @since 1.2
|
||||
*/
|
||||
public static void setFileNameMap(FileNameMap map) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) sm.checkSetFactory();
|
||||
fileNameMap = map;
|
||||
@ -1264,6 +1265,7 @@ public abstract class URLConnection {
|
||||
if (factory != null) {
|
||||
throw new Error("factory already defined");
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkSetFactory();
|
||||
@ -1377,6 +1379,7 @@ public abstract class URLConnection {
|
||||
return UnknownContentHandler.INSTANCE;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private ContentHandler lookupContentHandlerViaProvider(String contentType) {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,6 +50,7 @@ public abstract class URLStreamHandlerProvider
|
||||
implements URLStreamHandlerFactory
|
||||
{
|
||||
private static Void checkPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("setFactory"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -52,6 +52,7 @@ import java.security.PrivilegedAction;
|
||||
|
||||
public abstract class AsynchronousChannelProvider {
|
||||
private static Void checkPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("asynchronousChannelProvider"));
|
||||
@ -74,6 +75,7 @@ public abstract class AsynchronousChannelProvider {
|
||||
private static class ProviderHolder {
|
||||
static final AsynchronousChannelProvider provider = load();
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static AsynchronousChannelProvider load() {
|
||||
return AccessController
|
||||
.doPrivileged(new PrivilegedAction<>() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -73,6 +73,7 @@ import java.util.ServiceConfigurationError;
|
||||
public abstract class SelectorProvider {
|
||||
|
||||
private static Void checkPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("selectorProvider"));
|
||||
@ -94,6 +95,7 @@ public abstract class SelectorProvider {
|
||||
private static class Holder {
|
||||
static final SelectorProvider INSTANCE = provider();
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static SelectorProvider provider() {
|
||||
PrivilegedAction<SelectorProvider> pa = () -> {
|
||||
SelectorProvider sp;
|
||||
|
@ -375,6 +375,7 @@ public abstract class Charset
|
||||
private static ThreadLocal<ThreadLocal<?>> gate =
|
||||
new ThreadLocal<ThreadLocal<?>>();
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static Charset lookupViaProviders(final String charsetName) {
|
||||
|
||||
// The runtime startup sequence looks up standard charsets as a
|
||||
@ -417,6 +418,7 @@ public abstract class Charset
|
||||
private static class ExtendedProviderHolder {
|
||||
static final CharsetProvider[] extendedProviders = extendedProviders();
|
||||
// returns ExtendedProvider, if installed
|
||||
@SuppressWarnings("removal")
|
||||
private static CharsetProvider[] extendedProviders() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public CharsetProvider[] run() {
|
||||
@ -563,6 +565,7 @@ public abstract class Charset
|
||||
* @return An immutable, case-insensitive map from canonical charset names
|
||||
* to charset objects
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static SortedMap<String,Charset> availableCharsets() {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -71,6 +71,7 @@ import java.util.Iterator;
|
||||
public abstract class CharsetProvider {
|
||||
|
||||
private static Void checkPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("charsetProvider"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -96,6 +96,7 @@ public final class FileSystems {
|
||||
// returns default file system
|
||||
private static FileSystem defaultFileSystem() {
|
||||
// load default provider
|
||||
@SuppressWarnings("removal")
|
||||
FileSystemProvider provider = AccessController
|
||||
.doPrivileged(new PrivilegedAction<>() {
|
||||
public FileSystemProvider run() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -198,6 +198,7 @@ class FileTreeWalker implements Closeable {
|
||||
* the walk is following sym links is not. The {@code canUseCached}
|
||||
* argument determines whether this method can use cached attributes.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private BasicFileAttributes getAttributes(Path file, boolean canUseCached)
|
||||
throws IOException
|
||||
{
|
||||
|
@ -1651,6 +1651,7 @@ public final class Files {
|
||||
loadInstalledDetectors();
|
||||
|
||||
// creates the default file type detector
|
||||
@SuppressWarnings("removal")
|
||||
private static FileTypeDetector createDefaultFileTypeDetector() {
|
||||
return AccessController
|
||||
.doPrivileged(new PrivilegedAction<>() {
|
||||
@ -1660,6 +1661,7 @@ public final class Files {
|
||||
}
|
||||
|
||||
// loads all installed file type detectors
|
||||
@SuppressWarnings("removal")
|
||||
private static List<FileTypeDetector> loadInstalledDetectors() {
|
||||
return AccessController
|
||||
.doPrivileged(new PrivilegedAction<>() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -117,6 +117,7 @@ class TempFileHelper {
|
||||
}
|
||||
|
||||
// loop generating random names until file or directory can be created
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
for (;;) {
|
||||
Path f;
|
||||
|
@ -121,6 +121,7 @@ public abstract class FileSystemProvider {
|
||||
private static boolean loadingProviders = false;
|
||||
|
||||
private static Void checkPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("fileSystemProvider"));
|
||||
@ -198,6 +199,7 @@ public abstract class FileSystemProvider {
|
||||
}
|
||||
loadingProviders = true;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
List<FileSystemProvider> list = AccessController
|
||||
.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,6 +50,7 @@ import java.io.IOException;
|
||||
public abstract class FileTypeDetector {
|
||||
|
||||
private static Void checkPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("fileTypeDetector"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -75,8 +75,14 @@ import sun.security.util.SecurityConstants;
|
||||
*
|
||||
* @author Roland Schemers
|
||||
* @since 1.2
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public final class AccessControlContext {
|
||||
|
||||
private ProtectionDomain[] context;
|
||||
@ -89,6 +95,7 @@ public final class AccessControlContext {
|
||||
// native codes. Don't touch it.
|
||||
private AccessControlContext privilegedContext;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private DomainCombiner combiner = null;
|
||||
|
||||
// limited privilege scope
|
||||
@ -103,6 +110,7 @@ public final class AccessControlContext {
|
||||
private static boolean debugInit = false;
|
||||
private static Debug debug = null;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static Debug getDebug()
|
||||
{
|
||||
if (debugInit)
|
||||
@ -171,7 +179,7 @@ public final class AccessControlContext {
|
||||
* @since 1.3
|
||||
*/
|
||||
public AccessControlContext(AccessControlContext acc,
|
||||
DomainCombiner combiner) {
|
||||
@SuppressWarnings("removal") DomainCombiner combiner) {
|
||||
|
||||
this(acc, combiner, false);
|
||||
}
|
||||
@ -182,9 +190,10 @@ public final class AccessControlContext {
|
||||
* permission
|
||||
*/
|
||||
AccessControlContext(AccessControlContext acc,
|
||||
DomainCombiner combiner,
|
||||
@SuppressWarnings("removal") DomainCombiner combiner,
|
||||
boolean preauthorized) {
|
||||
if (!preauthorized) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.CREATE_ACC_PERMISSION);
|
||||
@ -211,7 +220,7 @@ public final class AccessControlContext {
|
||||
* This "argument wrapper" context will be passed as the actual context
|
||||
* parameter on an internal doPrivileged() call used in the implementation.
|
||||
*/
|
||||
AccessControlContext(ProtectionDomain caller, DomainCombiner combiner,
|
||||
AccessControlContext(ProtectionDomain caller, @SuppressWarnings("removal") DomainCombiner combiner,
|
||||
AccessControlContext parent, AccessControlContext context,
|
||||
Permission[] perms)
|
||||
{
|
||||
@ -323,6 +332,7 @@ public final class AccessControlContext {
|
||||
/**
|
||||
* get the assigned combiner from the privileged or inherited context
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner getAssignedCombiner() {
|
||||
AccessControlContext acc;
|
||||
if (isPrivileged) {
|
||||
@ -349,6 +359,7 @@ public final class AccessControlContext {
|
||||
* {@link SecurityPermission}
|
||||
* @since 1.3
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public DomainCombiner getDomainCombiner() {
|
||||
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
@ -361,6 +372,7 @@ public final class AccessControlContext {
|
||||
/**
|
||||
* package private for AccessController
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner getCombiner() {
|
||||
return combiner;
|
||||
}
|
||||
@ -388,6 +400,7 @@ public final class AccessControlContext {
|
||||
* context encapsulated by this object.
|
||||
* @throws NullPointerException if the permission to check for is null.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public void checkPermission(Permission perm)
|
||||
throws AccessControlException
|
||||
{
|
||||
@ -548,6 +561,7 @@ public final class AccessControlContext {
|
||||
* The limited privilege scope can indirectly flow from the inherited
|
||||
* parent thread or an assigned context previously captured by getContext().
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext optimize() {
|
||||
// the assigned (privileged or inherited) context
|
||||
AccessControlContext acc;
|
||||
|
@ -39,8 +39,14 @@ package java.security;
|
||||
* @author Li Gong
|
||||
* @author Roland Schemers
|
||||
* @since 1.2
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public class AccessControlException extends SecurityException {
|
||||
|
||||
@java.io.Serial
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -271,8 +271,14 @@ import jdk.internal.vm.annotation.ReservedStackAccess;
|
||||
* @author Li Gong
|
||||
* @author Roland Schemers
|
||||
* @since 1.2
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public final class AccessController {
|
||||
|
||||
/**
|
||||
@ -339,10 +345,12 @@ public final class AccessController {
|
||||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action) {
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext acc = getStackAccessControlContext();
|
||||
if (acc == null) {
|
||||
return AccessController.doPrivileged(action);
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = acc.getAssignedCombiner();
|
||||
return AccessController.doPrivileged(action,
|
||||
preserveCombiner(dc, Reflection.getCallerClass()));
|
||||
@ -384,7 +392,7 @@ public final class AccessController {
|
||||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivileged(PrivilegedAction<T> action,
|
||||
AccessControlContext context)
|
||||
@SuppressWarnings("removal") AccessControlContext context)
|
||||
{
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
context = checkContext(context, caller);
|
||||
@ -438,13 +446,16 @@ public final class AccessController {
|
||||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivileged(PrivilegedAction<T> action,
|
||||
AccessControlContext context, Permission... perms) {
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Permission... perms) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext parent = getContext();
|
||||
if (perms == null) {
|
||||
throw new NullPointerException("null permissions parameter");
|
||||
}
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = (context == null) ? null : context.getCombiner();
|
||||
return AccessController.doPrivileged(action, createWrapper(dc,
|
||||
caller, parent, context, perms));
|
||||
@ -501,9 +512,12 @@ public final class AccessController {
|
||||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action,
|
||||
AccessControlContext context, Permission... perms) {
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Permission... perms) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext parent = getContext();
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = parent.getCombiner();
|
||||
if (dc == null && context != null) {
|
||||
dc = context.getCombiner();
|
||||
@ -548,6 +562,7 @@ public final class AccessController {
|
||||
doPrivileged(PrivilegedExceptionAction<T> action)
|
||||
throws PrivilegedActionException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext context = null;
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
try {
|
||||
@ -591,10 +606,12 @@ public final class AccessController {
|
||||
public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action)
|
||||
throws PrivilegedActionException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext acc = getStackAccessControlContext();
|
||||
if (acc == null) {
|
||||
return AccessController.doPrivileged(action);
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = acc.getAssignedCombiner();
|
||||
return AccessController.doPrivileged(action,
|
||||
preserveCombiner(dc, Reflection.getCallerClass()));
|
||||
@ -603,6 +620,7 @@ public final class AccessController {
|
||||
/**
|
||||
* preserve the combiner across the doPrivileged call
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static AccessControlContext preserveCombiner(DomainCombiner combiner,
|
||||
Class<?> caller)
|
||||
{
|
||||
@ -612,6 +630,7 @@ public final class AccessController {
|
||||
/**
|
||||
* Create a wrapper to contain the limited privilege scope data.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static AccessControlContext
|
||||
createWrapper(DomainCombiner combiner, Class<?> caller,
|
||||
AccessControlContext parent, AccessControlContext context,
|
||||
@ -633,10 +652,12 @@ public final class AccessController {
|
||||
private static class AccHolder {
|
||||
// An AccessControlContext with no granted permissions.
|
||||
// Only initialized on demand when getInnocuousAcc() is called.
|
||||
@SuppressWarnings("removal")
|
||||
static final AccessControlContext innocuousAcc =
|
||||
new AccessControlContext(new ProtectionDomain[] {
|
||||
new ProtectionDomain(null, null) });
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
private static AccessControlContext getInnocuousAcc() {
|
||||
return AccHolder.innocuousAcc;
|
||||
}
|
||||
@ -682,7 +703,7 @@ public final class AccessController {
|
||||
@CallerSensitive
|
||||
public static <T> T
|
||||
doPrivileged(PrivilegedExceptionAction<T> action,
|
||||
AccessControlContext context)
|
||||
@SuppressWarnings("removal") AccessControlContext context)
|
||||
throws PrivilegedActionException
|
||||
{
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
@ -696,6 +717,7 @@ public final class AccessController {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static AccessControlContext checkContext(AccessControlContext context,
|
||||
Class<?> caller)
|
||||
{
|
||||
@ -726,6 +748,7 @@ public final class AccessController {
|
||||
* recognized by the VM.
|
||||
*/
|
||||
private static boolean isPrivileged() {
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext ctx = getStackAccessControlContext();
|
||||
return ctx == null || ctx.isPrivileged();
|
||||
}
|
||||
@ -741,7 +764,7 @@ public final class AccessController {
|
||||
@ForceInline
|
||||
private static <T> T
|
||||
executePrivileged(PrivilegedAction<T> action,
|
||||
AccessControlContext context,
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Class<?> caller)
|
||||
{
|
||||
// Ensure context has a physical value in the frame
|
||||
@ -771,7 +794,7 @@ public final class AccessController {
|
||||
@ForceInline
|
||||
private static <T> T
|
||||
executePrivileged(PrivilegedExceptionAction<T> action,
|
||||
AccessControlContext context,
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Class<?> caller)
|
||||
throws Exception
|
||||
{
|
||||
@ -853,14 +876,17 @@ public final class AccessController {
|
||||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action,
|
||||
AccessControlContext context, Permission... perms)
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Permission... perms)
|
||||
throws PrivilegedActionException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext parent = getContext();
|
||||
if (perms == null) {
|
||||
throw new NullPointerException("null permissions parameter");
|
||||
}
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = (context == null) ? null : context.getCombiner();
|
||||
return AccessController.doPrivileged(action, createWrapper(dc, caller, parent, context, perms));
|
||||
}
|
||||
@ -918,11 +944,13 @@ public final class AccessController {
|
||||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action,
|
||||
AccessControlContext context,
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Permission... perms)
|
||||
throws PrivilegedActionException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext parent = getContext();
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = parent.getCombiner();
|
||||
if (dc == null && context != null) {
|
||||
dc = context.getCombiner();
|
||||
@ -945,6 +973,7 @@ public final class AccessController {
|
||||
* null if there was only privileged system code.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static native AccessControlContext getStackAccessControlContext();
|
||||
|
||||
|
||||
@ -954,6 +983,7 @@ public final class AccessController {
|
||||
* AccessControlContext can use it.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static native AccessControlContext getInheritedAccessControlContext();
|
||||
|
||||
/**
|
||||
@ -967,6 +997,7 @@ public final class AccessController {
|
||||
* @return the AccessControlContext based on the current context.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public static AccessControlContext getContext()
|
||||
{
|
||||
AccessControlContext acc = getStackAccessControlContext();
|
||||
@ -997,6 +1028,7 @@ public final class AccessController {
|
||||
* security policy currently in effect.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public static void checkPermission(Permission perm)
|
||||
throws AccessControlException
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -77,7 +77,13 @@ package java.security;
|
||||
* @see AccessController
|
||||
* @see AccessControlContext
|
||||
* @since 1.3
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public interface DomainCombiner {
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -987,6 +987,7 @@ public class KeyStore {
|
||||
* if no such property exists.
|
||||
* @see java.security.Security security properties
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static final String getDefaultType() {
|
||||
String kstype;
|
||||
kstype = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@ -1956,6 +1957,7 @@ public class KeyStore {
|
||||
* of either PasswordProtection or CallbackHandlerProtection; or
|
||||
* if file does not exist or does not refer to a normal file
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static Builder newInstance(String type, Provider provider,
|
||||
File file, ProtectionParameter protection) {
|
||||
if ((type == null) || (file == null) || (protection == null)) {
|
||||
@ -2027,6 +2029,7 @@ public class KeyStore {
|
||||
private final File file;
|
||||
private ProtectionParameter protection;
|
||||
private ProtectionParameter keyProtection;
|
||||
@SuppressWarnings("removal")
|
||||
private final AccessControlContext context;
|
||||
|
||||
private KeyStore keyStore;
|
||||
@ -2035,7 +2038,7 @@ public class KeyStore {
|
||||
|
||||
FileBuilder(String type, Provider provider, File file,
|
||||
ProtectionParameter protection,
|
||||
AccessControlContext context) {
|
||||
@SuppressWarnings("removal") AccessControlContext context) {
|
||||
this.type = type;
|
||||
this.provider = provider;
|
||||
this.file = file;
|
||||
@ -2043,6 +2046,7 @@ public class KeyStore {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public synchronized KeyStore getKeyStore() throws KeyStoreException
|
||||
{
|
||||
if (keyStore != null) {
|
||||
@ -2174,6 +2178,7 @@ public class KeyStore {
|
||||
if ((type == null) || (protection == null)) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
final AccessControlContext context = AccessController.getContext();
|
||||
return new Builder() {
|
||||
private volatile boolean getCalled;
|
||||
@ -2218,6 +2223,7 @@ public class KeyStore {
|
||||
}
|
||||
};
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public synchronized KeyStore getKeyStore()
|
||||
throws KeyStoreException {
|
||||
if (oldException != null) {
|
||||
|
@ -103,6 +103,7 @@ public abstract class Permission implements Guard, java.io.Serializable {
|
||||
*
|
||||
*/
|
||||
public void checkGuard(Object object) throws SecurityException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) sm.checkPermission(this);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -83,8 +83,14 @@ import sun.security.util.SecurityConstants;
|
||||
* @see java.security.ProtectionDomain
|
||||
* @see java.security.Permission
|
||||
* @see java.security.Security security properties
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public abstract class Policy {
|
||||
|
||||
/**
|
||||
@ -133,6 +139,7 @@ public abstract class Policy {
|
||||
}
|
||||
|
||||
private static void checkPermission(String type) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new SecurityPermission("createPolicy." + type));
|
||||
@ -159,6 +166,7 @@ public abstract class Policy {
|
||||
*/
|
||||
public static Policy getPolicy()
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(SecurityConstants.GET_POLICY_PERMISSION);
|
||||
@ -194,6 +202,7 @@ public abstract class Policy {
|
||||
* an intrinsic lock on the Policy.class.
|
||||
*/
|
||||
private static Policy loadPolicyProvider() {
|
||||
@SuppressWarnings("removal")
|
||||
String policyProvider =
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
@ -222,6 +231,7 @@ public abstract class Policy {
|
||||
Policy polFile = new sun.security.provider.PolicyFile();
|
||||
policyInfo = new PolicyInfo(polFile, false);
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
Policy pol = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public Policy run() {
|
||||
@ -271,6 +281,7 @@ public abstract class Policy {
|
||||
*/
|
||||
public static void setPolicy(Policy p)
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) sm.checkPermission(
|
||||
new SecurityPermission("setPolicy"));
|
||||
@ -310,6 +321,7 @@ public abstract class Policy {
|
||||
* implementations will continue to function.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
ProtectionDomain policyDomain =
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public ProtectionDomain run() {
|
||||
@ -394,6 +406,7 @@ public abstract class Policy {
|
||||
* @see Provider
|
||||
* @since 1.6
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static Policy getInstance(String type, Policy.Parameters params)
|
||||
throws NoSuchAlgorithmException {
|
||||
Objects.requireNonNull(type, "null type name");
|
||||
@ -455,6 +468,7 @@ public abstract class Policy {
|
||||
* @see Provider
|
||||
* @since 1.6
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static Policy getInstance(String type,
|
||||
Policy.Parameters params,
|
||||
String provider)
|
||||
@ -518,6 +532,7 @@ public abstract class Policy {
|
||||
* @see Provider
|
||||
* @since 1.6
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static Policy getInstance(String type,
|
||||
Policy.Parameters params,
|
||||
Provider provider)
|
||||
@ -769,12 +784,13 @@ public abstract class Policy {
|
||||
*/
|
||||
private static class PolicyDelegate extends Policy {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private PolicySpi spi;
|
||||
private Provider p;
|
||||
private String type;
|
||||
private Policy.Parameters params;
|
||||
|
||||
private PolicyDelegate(PolicySpi spi, Provider p,
|
||||
private PolicyDelegate(@SuppressWarnings("removal") PolicySpi spi, Provider p,
|
||||
String type, Policy.Parameters params) {
|
||||
this.spi = spi;
|
||||
this.p = p;
|
||||
@ -810,7 +826,13 @@ public abstract class Policy {
|
||||
* This represents a marker interface for Policy parameters.
|
||||
*
|
||||
* @since 1.6
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is
|
||||
* deprecated and subject to removal in a future release.
|
||||
* Consequently, this class is also deprecated and subject to removal.
|
||||
* There is no replacement for the Security Manager or this class.
|
||||
*/
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public static interface Parameters { }
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,8 +40,14 @@ package java.security;
|
||||
*
|
||||
*
|
||||
* @since 1.6
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public abstract class PolicySpi {
|
||||
|
||||
/**
|
||||
@ -92,6 +98,7 @@ public abstract class PolicySpi {
|
||||
* If this operation is not supported,
|
||||
* Policy.UNSUPPORTED_EMPTY_COLLECTION is returned.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected PermissionCollection engineGetPermissions
|
||||
(CodeSource codesource) {
|
||||
return Policy.UNSUPPORTED_EMPTY_COLLECTION;
|
||||
@ -116,6 +123,7 @@ public abstract class PolicySpi {
|
||||
* If this operation is not supported,
|
||||
* Policy.UNSUPPORTED_EMPTY_COLLECTION is returned.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected PermissionCollection engineGetPermissions
|
||||
(ProtectionDomain domain) {
|
||||
return Policy.UNSUPPORTED_EMPTY_COLLECTION;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -73,6 +73,7 @@ public class ProtectionDomain {
|
||||
private JavaSecurityAccessImpl() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public <T> T doIntersectionPrivilege(
|
||||
PrivilegedAction<T> action,
|
||||
@ -88,6 +89,7 @@ public class ProtectionDomain {
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public <T> T doIntersectionPrivilege(
|
||||
PrivilegedAction<T> action,
|
||||
@ -97,10 +99,11 @@ public class ProtectionDomain {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtectionDomain[] getProtectDomains(AccessControlContext context) {
|
||||
public ProtectionDomain[] getProtectDomains(@SuppressWarnings("removal") AccessControlContext context) {
|
||||
return context.getContext();
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static AccessControlContext getCombinedACC(
|
||||
AccessControlContext context, AccessControlContext stack) {
|
||||
AccessControlContext acc =
|
||||
@ -309,6 +312,7 @@ public class ProtectionDomain {
|
||||
*
|
||||
* @return true if {@code perm} is implied by this ProtectionDomain.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public boolean implies(Permission perm) {
|
||||
|
||||
if (hasAllPerm) {
|
||||
@ -363,6 +367,7 @@ public class ProtectionDomain {
|
||||
boolean p2Calculated = false;
|
||||
|
||||
if (!staticPermissions) {
|
||||
@SuppressWarnings("removal")
|
||||
Policy policy = Policy.getPolicyNoCheck();
|
||||
if (policy instanceof PolicyFile) {
|
||||
// The PolicyFile implementation supports compatibility
|
||||
@ -416,6 +421,7 @@ public class ProtectionDomain {
|
||||
|
||||
// Check if policy is set; we don't want to load
|
||||
// the policy prematurely here
|
||||
@SuppressWarnings("removal")
|
||||
PermissionCollection pc = Policy.isSet() && seeAllp() ?
|
||||
mergePermissions():
|
||||
getPermissions();
|
||||
@ -449,6 +455,7 @@ public class ProtectionDomain {
|
||||
* debug is null,
|
||||
* caller has Policy.getPolicy permission
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static boolean seeAllp() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
|
||||
@ -478,6 +485,7 @@ public class ProtectionDomain {
|
||||
if (staticPermissions)
|
||||
return permissions;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
PermissionCollection perms =
|
||||
java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction<>() {
|
||||
|
@ -810,6 +810,7 @@ public abstract class Provider extends Properties {
|
||||
|
||||
private void check(String directive) {
|
||||
checkInitialized();
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkSecurityAccess(directive);
|
||||
|
@ -933,6 +933,7 @@ public class SecureRandom extends java.util.Random {
|
||||
public static SecureRandom getInstanceStrong()
|
||||
throws NoSuchAlgorithmException {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
String property = AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
@Override
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -51,6 +51,7 @@ import sun.security.jca.*;
|
||||
* @since 1.1
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public final class Security {
|
||||
|
||||
/* Are we debugging? -- for developers */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,6 +32,7 @@ package java.security;
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public class URIParameter implements
|
||||
Policy.Parameters, javax.security.auth.login.Configuration.Parameters {
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user