8343981: Remove usage of security manager from Thread and related classes

Reviewed-by: rriggs, yzheng
This commit is contained in:
Alan Bateman 2024-11-13 18:49:31 +00:00
parent dbf23466af
commit 5e01c40b19
10 changed files with 54 additions and 282 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2024, 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,8 +25,6 @@
package com.sun.jndi.ldap;
import jdk.internal.access.SharedSecrets;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
@ -109,14 +107,8 @@ public final class VersionHelper {
return Class.forName(className, true, getContextClassLoader());
}
@SuppressWarnings("removal")
Thread createThread(Runnable r) {
AccessControlContext acc = AccessController.getContext();
// 4290486: doPrivileged is needed to create a thread in
// an environment that restricts "modifyThreadGroup".
PrivilegedAction<Thread> act =
() -> SharedSecrets.getJavaLangAccess().newThreadWithAcc(r, acc);
return AccessController.doPrivileged(act);
return new Thread(r);
}
@SuppressWarnings("removal")