static { try { AccessController.doPrivileged( new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { setupJurisdictionPolicies(); return null; } }); isRestricted = defaultPolicy.implies(CryptoAllPermission.INSTANCE) ? false : true; } catch (Exception e) { throw new SecurityException("Can not initialize cryptographic mechanism", e); } }
/* * Retuns the CodeBase for the given class. */ static URL getCodeBase(final Class<?> clazz) { URL url = codeBaseCacheRef.get(clazz); if (url == null) { url = AccessController.doPrivileged( new PrivilegedAction<URL>() { public URL run() { ProtectionDomain pd = clazz.getProtectionDomain(); if (pd != null) { CodeSource cs = pd.getCodeSource(); if (cs != null) { return cs.getLocation(); } } return NULL_URL; } }); codeBaseCacheRef.put(clazz, url); } return (url == NULL_URL) ? null : url; }