src/java.base/share/classes/java/security/SecureClassLoader.java

Print this page

        

*** 60,71 **** * permissions. */ private final Map<CodeSourceKey, ProtectionDomain> pdcache = new ConcurrentHashMap<>(11); - private static final Debug debug = Debug.getInstance("scl"); - static { ClassLoader.registerAsParallelCapable(); } /** --- 60,69 ----
*** 201,210 **** --- 199,215 ---- check(); return new Permissions(); // ProtectionDomain defers the binding } /* + * holder class for the static field "debug" to delay its initialization + */ + private static class DebugHolder { + private static final Debug debug = Debug.getInstance("scl"); + } + + /* * Returned cached ProtectionDomain for the specified CodeSource. */ private ProtectionDomain getProtectionDomain(CodeSource cs) { if (cs == null) { return null;
*** 220,232 **** public ProtectionDomain apply(CodeSourceKey key /* not used */) { PermissionCollection perms = SecureClassLoader.this.getPermissions(cs); ProtectionDomain pd = new ProtectionDomain( cs, perms, SecureClassLoader.this, null); ! if (debug != null) { ! debug.println(" getPermissions " + pd); ! debug.println(""); } return pd; } }); } --- 225,237 ---- 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; } }); }