/[classpath]/classpath/java/lang/ClassLoader.java
ViewVC logotype

Diff of /classpath/java/lang/ClassLoader.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by ericb, Fri Mar 22 21:25:20 2002 UTC revision 1.17 by ericb, Thu Mar 28 21:56:55 2002 UTC
# Line 40  package java.lang; Line 40  package java.lang;
40    
41  import java.io.InputStream;  import java.io.InputStream;
42  import java.io.IOException;  import java.io.IOException;
43    import java.lang.reflect.Constructor;
44  import java.net.URL;  import java.net.URL;
45  import java.security.CodeSource;  import java.security.CodeSource;
46  import java.security.PermissionCollection;  import java.security.PermissionCollection;
# Line 48  import java.security.ProtectionDomain; Line 49  import java.security.ProtectionDomain;
49  import java.util.Enumeration;  import java.util.Enumeration;
50  import java.util.HashMap;  import java.util.HashMap;
51  import java.util.Map;  import java.util.Map;
52    import gnu.java.lang.SystemClassLoader;
53  import gnu.java.util.DoubleEnumeration;  import gnu.java.util.DoubleEnumeration;
54  import gnu.java.util.EmptyEnumeration;  import gnu.java.util.EmptyEnumeration;
55    
# Line 685  public abstract class ClassLoader Line 687  public abstract class ClassLoader
687     * property <code>java.class.path</code>. This is set as the context     * property <code>java.class.path</code>. This is set as the context
688     * class loader for a thread. The system property     * class loader for a thread. The system property
689     * <code>java.system.class.loader</code>, if defined, is taken to be the     * <code>java.system.class.loader</code>, if defined, is taken to be the
690     * name of the class to use as the system class loader, otherwise this     * name of the class to use as the system class loader, which must have
691       * a public constructor which takes a ClassLoader as a parent; otherwise this
692     * uses gnu.java.lang.SystemClassLoader.     * uses gnu.java.lang.SystemClassLoader.
693     *     *
694     * <p>Note that this is different from the bootstrap classloader that     * <p>Note that this is different from the bootstrap classloader that
# Line 713  public abstract class ClassLoader Line 716  public abstract class ClassLoader
716                                             "gnu.java.lang.SystemClassLoader");                                             "gnu.java.lang.SystemClassLoader");
717          try          try
718            {            {
719              return (ClassLoader) Class.forName(loader).newInstance();              // Give the new system class loader a null parent.
720                Constructor c = Class.forName(loader).getConstructor
721                  ( new Class[] { ClassLoader.class } );
722                return (ClassLoader) c.newInstance(new Object[1]);
723            }            }
724          catch (Exception e)          catch (Exception e)
725            {            {
726              throw (Error) new InternalError              try
727                ("System class loader could not be found: " + e).initCause(e);                {
728                    System.err.println("Requested system classloader "
729                                       + loader + " failed, trying "
730                                       + "gnu.java.lang.SystemClassLoader");
731                    e.printStackTrace();
732                    // Fallback to gnu.java.lang.SystemClassLoader.
733                    return new SystemClassLoader(null);
734                  }
735                catch (Exception e1)
736                  {
737                    throw (Error) new InternalError
738                      ("System class loader could not be found: " + e1)
739                      .initCause(e1);
740                  }
741            }            }
742        }        }
743      // Check if we may return the system classloader      // Check if we may return the system classloader

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26