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

Print this page

        

*** 137,148 **** /* * An object used as a key when the ProtectionDomain is stored in a Map. */ final Key key = new Key(); - private static final Debug debug = Debug.getInstance("domain"); - /** * Creates a new ProtectionDomain with the given CodeSource and * Permissions. If the permissions object is not null, then * {@code setReadOnly())} will be called on the passed in * Permissions object. The only permissions granted to this domain --- 137,146 ----
*** 336,345 **** --- 334,350 ---- " "+classloader+"\n"+ " "+pals+"\n"+ " "+pc+"\n"; } + /* + * holder class for the static field "debug" to delay its initialization + */ + private static class DebugHolder { + private static final Debug debug = Debug.getInstance("domain"); + } + /** * Return true (merge policy permissions) in the following cases: * * . SecurityManager is null *
*** 357,367 **** SecurityManager sm = System.getSecurityManager(); if (sm == null) { return true; } else { ! if (debug != null) { if (sm.getClass().getClassLoader() == null && Policy.getPolicyNoCheck().getClass().getClassLoader() == null) { return true; } --- 362,372 ---- SecurityManager sm = System.getSecurityManager(); if (sm == null) { return true; } else { ! if (DebugHolder.debug != null) { if (sm.getClass().getClassLoader() == null && Policy.getPolicyNoCheck().getClass().getClassLoader() == null) { return true; }