/[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.55 by jfrijters, Mon Aug 1 10:05:26 2005 UTC revision 1.56 by jfrijters, Mon Aug 1 10:23:16 2005 UTC
# Line 464  public abstract class ClassLoader Line 464  public abstract class ClassLoader
464                                                   ProtectionDomain domain)                                                   ProtectionDomain domain)
465      throws ClassFormatError      throws ClassFormatError
466    {    {
467        checkInitialized();
468      if (domain == null)      if (domain == null)
469        domain = StaticData.defaultProtectionDomain;        domain = StaticData.defaultProtectionDomain;
     if (! initialized)  
       throw new SecurityException("attempt to define class from uninitialized class loader");  
470            
471      return VMClassLoader.defineClass(this, name, data, offset, len, domain);      return VMClassLoader.defineClass(this, name, data, offset, len, domain);
472    }    }
# Line 482  public abstract class ClassLoader Line 481  public abstract class ClassLoader
481     */     */
482    protected final void resolveClass(Class c)    protected final void resolveClass(Class c)
483    {    {
484        checkInitialized();
485      VMClassLoader.resolveClass(c);      VMClassLoader.resolveClass(c);
486    }    }
487    
# Line 497  public abstract class ClassLoader Line 497  public abstract class ClassLoader
497    protected final Class findSystemClass(String name)    protected final Class findSystemClass(String name)
498      throws ClassNotFoundException      throws ClassNotFoundException
499    {    {
500        checkInitialized();
501      return Class.forName(name, false, StaticData.systemClassLoader);      return Class.forName(name, false, StaticData.systemClassLoader);
502    }    }
503    
# Line 533  public abstract class ClassLoader Line 534  public abstract class ClassLoader
534     */     */
535    protected final void setSigners(Class c, Object[] signers)    protected final void setSigners(Class c, Object[] signers)
536    {    {
537        checkInitialized();
538      c.setSigners(signers);      c.setSigners(signers);
539    }    }
540    
# Line 545  public abstract class ClassLoader Line 547  public abstract class ClassLoader
547     */     */
548    protected final synchronized Class findLoadedClass(String name)    protected final synchronized Class findLoadedClass(String name)
549    {    {
550        checkInitialized();
551      return VMClassLoader.findLoadedClass(this, name);      return VMClassLoader.findLoadedClass(this, name);
552    }    }
553    
# Line 1100  public abstract class ClassLoader Line 1103  public abstract class ClassLoader
1103                  .initCause(e);                  .initCause(e);
1104        }        }
1105    }    }
1106    
1107      /**
1108       * Before doing anything "dangerous" please call this method to make sure
1109       * this class loader instance was properly constructed (and not obtained
1110       * by exploiting the finalizer attack)
1111       * @see #initialized
1112       */
1113      private void checkInitialized()
1114      {
1115        if (! initialized)
1116          throw new SecurityException("attempt to use uninitialized class loader");
1117      }
1118  }  }

Legend:
Removed from v.1.55  
changed lines
  Added in v.1.56

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