< prev index next >

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

Print this page




 108         if (security != null) {
 109             security.checkCreateClassLoader();
 110         }
 111         initialized = true;
 112     }
 113 
 114     /**
 115      * Creates a new {@code SecureClassLoader} of the specified name and
 116      * using the specified parent class loader for delegation.
 117      *
 118      * @param name class loader name; or {@code null} if not named
 119      * @param parent the parent class loader
 120      *
 121      * @throws IllegalArgumentException if the given name is empty.
 122      *
 123      * @throws SecurityException  if a security manager exists and its
 124      *         {@link SecurityManager#checkCreateClassLoader()} method
 125      *         doesn't allow creation of a class loader.
 126      *
 127      * @since 9

 128      */
 129     protected SecureClassLoader(String name, ClassLoader parent) {
 130         super(name, parent);
 131         SecurityManager security = System.getSecurityManager();
 132         if (security != null) {
 133             security.checkCreateClassLoader();
 134         }
 135         initialized = true;
 136     }
 137 
 138     /**
 139      * Converts an array of bytes into an instance of class Class,
 140      * with an optional CodeSource. Before the
 141      * class can be used it must be resolved.
 142      * <p>
 143      * If a non-null CodeSource is supplied a ProtectionDomain is
 144      * constructed and associated with the class being defined.
 145      *
 146      * @param      name the expected name of the class, or {@code null}
 147      *                  if not known, using '.' and not '/' as the separator




 108         if (security != null) {
 109             security.checkCreateClassLoader();
 110         }
 111         initialized = true;
 112     }
 113 
 114     /**
 115      * Creates a new {@code SecureClassLoader} of the specified name and
 116      * using the specified parent class loader for delegation.
 117      *
 118      * @param name class loader name; or {@code null} if not named
 119      * @param parent the parent class loader
 120      *
 121      * @throws IllegalArgumentException if the given name is empty.
 122      *
 123      * @throws SecurityException  if a security manager exists and its
 124      *         {@link SecurityManager#checkCreateClassLoader()} method
 125      *         doesn't allow creation of a class loader.
 126      *
 127      * @since 9
 128      * @spec JPMS
 129      */
 130     protected SecureClassLoader(String name, ClassLoader parent) {
 131         super(name, parent);
 132         SecurityManager security = System.getSecurityManager();
 133         if (security != null) {
 134             security.checkCreateClassLoader();
 135         }
 136         initialized = true;
 137     }
 138 
 139     /**
 140      * Converts an array of bytes into an instance of class Class,
 141      * with an optional CodeSource. Before the
 142      * class can be used it must be resolved.
 143      * <p>
 144      * If a non-null CodeSource is supplied a ProtectionDomain is
 145      * constructed and associated with the class being defined.
 146      *
 147      * @param      name the expected name of the class, or {@code null}
 148      *                  if not known, using '.' and not '/' as the separator


< prev index next >