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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2011, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2013, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 61,76 **** /** * Creates a new SecureClassLoader using the specified parent * class loader for delegation. * * <p>If there is a security manager, this method first ! * calls the security manager's <code>checkCreateClassLoader</code> * method to ensure creation of a class loader is allowed. * <p> * @param parent the parent ClassLoader * @exception SecurityException if a security manager exists and its ! * <code>checkCreateClassLoader</code> method doesn't allow * creation of a class loader. * @see SecurityManager#checkCreateClassLoader */ protected SecureClassLoader(ClassLoader parent) { super(parent); --- 61,76 ---- /** * Creates a new SecureClassLoader using the specified parent * class loader for delegation. * * <p>If there is a security manager, this method first ! * calls the security manager's {@code checkCreateClassLoader} * method to ensure creation of a class loader is allowed. * <p> * @param parent the parent ClassLoader * @exception SecurityException if a security manager exists and its ! * {@code checkCreateClassLoader} method doesn't allow * creation of a class loader. * @see SecurityManager#checkCreateClassLoader */ protected SecureClassLoader(ClassLoader parent) { super(parent);
*** 85,99 **** /** * Creates a new SecureClassLoader using the default parent class * loader for delegation. * * <p>If there is a security manager, this method first ! * calls the security manager's <code>checkCreateClassLoader</code> * method to ensure creation of a class loader is allowed. * * @exception SecurityException if a security manager exists and its ! * <code>checkCreateClassLoader</code> method doesn't allow * creation of a class loader. * @see SecurityManager#checkCreateClassLoader */ protected SecureClassLoader() { super(); --- 85,99 ---- /** * Creates a new SecureClassLoader using the default parent class * loader for delegation. * * <p>If there is a security manager, this method first ! * calls the security manager's {@code checkCreateClassLoader} * method to ensure creation of a class loader is allowed. * * @exception SecurityException if a security manager exists and its ! * {@code checkCreateClassLoader} method doesn't allow * creation of a class loader. * @see SecurityManager#checkCreateClassLoader */ protected SecureClassLoader() { super();
*** 111,136 **** * class can be used it must be resolved. * <p> * If a non-null CodeSource is supplied a ProtectionDomain is * constructed and associated with the class being defined. * <p> ! * @param name the expected name of the class, or <code>null</code> * if not known, using '.' and not '/' as the separator * and without a trailing ".class" suffix. * @param b the bytes that make up the class data. The bytes in ! * positions <code>off</code> through <code>off+len-1</code> * should have the format of a valid class file as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. ! * @param off the start offset in <code>b</code> of the class data * @param len the length of the class data ! * @param cs the associated CodeSource, or <code>null</code> if none ! * @return the <code>Class</code> object created from the data, * and optional CodeSource. * @exception ClassFormatError if the data did not contain a valid class ! * @exception IndexOutOfBoundsException if either <code>off</code> or ! * <code>len</code> is negative, or if ! * <code>off+len</code> is greater than <code>b.length</code>. * * @exception SecurityException if an attempt is made to add this class * to a package that contains classes that were signed by * a different set of certificates than this class, or if * the class name begins with "java.". --- 111,136 ---- * class can be used it must be resolved. * <p> * If a non-null CodeSource is supplied a ProtectionDomain is * constructed and associated with the class being defined. * <p> ! * @param name the expected name of the class, or {@code null} * if not known, using '.' and not '/' as the separator * and without a trailing ".class" suffix. * @param b the bytes that make up the class data. The bytes in ! * positions {@code off} through {@code off+len-1} * should have the format of a valid class file as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. ! * @param off the start offset in {@code b} of the class data * @param len the length of the class data ! * @param cs the associated CodeSource, or {@code null} if none ! * @return the {@code Class} object created from the data, * and optional CodeSource. * @exception ClassFormatError if the data did not contain a valid class ! * @exception IndexOutOfBoundsException if either {@code off} or ! * {@code len} is negative, or if ! * {@code off+len} is greater than {@code b.length}. * * @exception SecurityException if an attempt is made to add this class * to a package that contains classes that were signed by * a different set of certificates than this class, or if * the class name begins with "java.".
*** 141,166 **** { return defineClass(name, b, off, len, getProtectionDomain(cs)); } /** ! * Converts a {@link java.nio.ByteBuffer <tt>ByteBuffer</tt>} ! * into an instance of class <tt>Class</tt>, with an optional CodeSource. * Before the class can be used it must be resolved. * <p> * If a non-null CodeSource is supplied a ProtectionDomain is * constructed and associated with the class being defined. * <p> ! * @param name the expected name of the class, or <code>null</code> * if not known, using '.' and not '/' as the separator * and without a trailing ".class" suffix. * @param b the bytes that make up the class data. The bytes from positions ! * <tt>b.position()</tt> through <tt>b.position() + b.limit() -1</tt> * should have the format of a valid class file as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. ! * @param cs the associated CodeSource, or <code>null</code> if none ! * @return the <code>Class</code> object created from the data, * and optional CodeSource. * @exception ClassFormatError if the data did not contain a valid class * @exception SecurityException if an attempt is made to add this class * to a package that contains classes that were signed by * a different set of certificates than this class, or if --- 141,166 ---- { return defineClass(name, b, off, len, getProtectionDomain(cs)); } /** ! * Converts a {@link java.nio.ByteBuffer ByteBuffer} ! * into an instance of class {@code Class}, with an optional CodeSource. * Before the class can be used it must be resolved. * <p> * If a non-null CodeSource is supplied a ProtectionDomain is * constructed and associated with the class being defined. * <p> ! * @param name the expected name of the class, or {@code null} * if not known, using '.' and not '/' as the separator * and without a trailing ".class" suffix. * @param b the bytes that make up the class data. The bytes from positions ! * {@code b.position()} through {@code b.position() + b.limit() -1} * should have the format of a valid class file as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. ! * @param cs the associated CodeSource, or {@code null} if none ! * @return the {@code Class} object created from the data, * and optional CodeSource. * @exception ClassFormatError if the data did not contain a valid class * @exception SecurityException if an attempt is made to add this class * to a package that contains classes that were signed by * a different set of certificates than this class, or if