mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8285263: Minor cleanup could be done in java.security
Reviewed-by: weijun
This commit is contained in:
parent
b97a4f6cdc
commit
17695962ac
94 changed files with 480 additions and 601 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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,12 +25,11 @@
|
|||
|
||||
package java.security;
|
||||
|
||||
import sun.security.util.Debug;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
|
||||
import sun.security.util.Debug;
|
||||
|
||||
/**
|
||||
* This class extends ClassLoader with additional support for defining
|
||||
|
@ -219,28 +218,20 @@ public class SecureClassLoader extends ClassLoader {
|
|||
// that no nameservice lookup is done on the hostname (String comparison
|
||||
// only), and the fragment is not considered.
|
||||
CodeSourceKey key = new CodeSourceKey(cs);
|
||||
return pdcache.computeIfAbsent(key, new Function<>() {
|
||||
@Override
|
||||
public ProtectionDomain apply(CodeSourceKey key /* not used */) {
|
||||
PermissionCollection perms
|
||||
= SecureClassLoader.this.getPermissions(cs);
|
||||
ProtectionDomain pd = new ProtectionDomain(
|
||||
cs, perms, SecureClassLoader.this, null);
|
||||
if (DebugHolder.debug != null) {
|
||||
DebugHolder.debug.println(" getPermissions " + pd);
|
||||
DebugHolder.debug.println("");
|
||||
}
|
||||
return pd;
|
||||
return pdcache.computeIfAbsent(key, unused -> {
|
||||
PermissionCollection perms
|
||||
= SecureClassLoader.this.getPermissions(cs);
|
||||
ProtectionDomain pd = new ProtectionDomain(
|
||||
cs, perms, SecureClassLoader.this, null);
|
||||
if (DebugHolder.debug != null) {
|
||||
DebugHolder.debug.println(" getPermissions " + pd);
|
||||
DebugHolder.debug.println("");
|
||||
}
|
||||
return pd;
|
||||
});
|
||||
}
|
||||
|
||||
private static class CodeSourceKey {
|
||||
private final CodeSource cs;
|
||||
|
||||
CodeSourceKey(CodeSource cs) {
|
||||
this.cs = cs;
|
||||
}
|
||||
private record CodeSourceKey(CodeSource cs) {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue