Skip to content

Commit 7b85f87

Browse files
committed
Remove AccessController.doPrivileged uses from closed/src
Signed-off-by: Theresa Mammarella <[email protected]>
1 parent 5d34738 commit 7b85f87

File tree

3 files changed

+6
-32
lines changed

3 files changed

+6
-32
lines changed

closed/src/java.base/share/classes/java/io/ClassByNameCache.java

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
import java.lang.ref.ReferenceQueue;
2828
import java.lang.ref.WeakReference;
29-
import java.security.AccessController;
30-
import java.security.PrivilegedAction;
3129
import java.util.Objects;
3230
import java.util.concurrent.ConcurrentHashMap;
3331
/* ClassByNameCache is Primarily responsible for Caching the results of the className lookups and hence to avoid
@@ -63,8 +61,10 @@ public ClassByNameCache() {
6361
loader = loader.getParent();
6462
}
6563
setCanonicalSystemLoaderRef(null);
66-
AccessController.doPrivileged(
67-
new CreateReaperAction(this, staleLoaderRefs)).start();
64+
65+
Reaper reaper = new Reaper(this, staleLoaderRefs);
66+
Thread t = com.ibm.oti.vm.VM.getVMLangAccess().createThread(reaper, "ClassByNameCache Reaper", true, false, true, null);
67+
t.start();
6868
}
6969
/*
7070
* sets Canonical Loader reference for the loader
@@ -197,22 +197,6 @@ Class<?> get() throws ClassNotFoundException {
197197
}
198198
}
199199

200-
private static final class CreateReaperAction
201-
implements PrivilegedAction<Thread> {
202-
private final ClassByNameCache cache;
203-
private final ReferenceQueue<Object> queue;
204-
205-
CreateReaperAction(ClassByNameCache cache, ReferenceQueue<Object> queue) {
206-
this.cache = cache;
207-
this.queue = queue;
208-
}
209-
210-
public Thread run() {
211-
Reaper reaper = new Reaper(cache, queue);
212-
return com.ibm.oti.vm.VM.getVMLangAccess().createThread(reaper, "ClassByNameCache Reaper", true, false, true, null);
213-
}
214-
}
215-
216200
private static final class Reaper implements Runnable {
217201
private final WeakReference<ClassByNameCache> cacheRef;
218202
private final ReferenceQueue<Object> queue;

closed/src/java.base/share/classes/jdk/crypto/jniprovider/NativeCrypto.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ private static long loadCryptoLibraries() {
117117
return osslVersion;
118118
}
119119

120-
@SuppressWarnings("removal")
121120
private NativeCrypto() {
122-
ossl_ver = AccessController.doPrivileged((PrivilegedAction<Long>) () -> loadCryptoLibraries()).longValue();
121+
ossl_ver = loadCryptoLibraries();
123122
if (ossl_ver != -1) {
124123
isOpenSSLFIPS = isOpenSSLFIPS();
125124
} else {

closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
package openj9.internal.security;
2525

2626
import java.nio.charset.StandardCharsets;
27-
import java.security.AccessController;
2827
import java.security.MessageDigest;
2928
import java.security.NoSuchAlgorithmException;
30-
import java.security.PrivilegedAction;
3129
import java.security.Provider;
3230
import java.security.Provider.Service;
3331
import java.time.LocalDate;
@@ -93,18 +91,11 @@ public final class RestrictedSecurity {
9391
supportedPlatformsOpenJCEPlus.put("Arch", List.of("amd64", "ppc64", "s390x"));
9492
supportedPlatformsOpenJCEPlus.put("OS", List.of("Linux", "AIX", "Windows"));
9593

96-
@SuppressWarnings("removal")
97-
String[] props = AccessController.doPrivileged(
98-
new PrivilegedAction<>() {
99-
@Override
100-
public String[] run() {
101-
return new String[] { System.getProperty("semeru.fips"),
94+
String[] props = new String[] { System.getProperty("semeru.fips"),
10295
System.getProperty("semeru.customprofile"),
10396
System.getProperty("os.name"),
10497
System.getProperty("os.arch"),
10598
System.getProperty("semeru.fips.allowsetproperties") };
106-
}
107-
});
10899

109100
boolean isOsSupported, isArchSupported;
110101
// Check whether the NSS FIPS solution is supported.

0 commit comments

Comments
 (0)