Loads a class from the current classloader
339151
@SuppressWarnings("unchecked")
    public static <T> Class<T> loadClass(String className) {
        return loadClass(className, ClassLoaderUtil.class.getClassLoader());
    }
427764
static ClassLoader getClassLoader ()
    {
        Method m = null;

        try {
            m = Thread.class.getMethod("getContextClassLoader");
        } catch (NoSuchMethodException e) {
            // Assume that we are running JDK 1.1, use the current ClassLoader
            return NewInstance.class.getClassLoader();
        }

        try {
            return (ClassLoader) m.invoke(Thread.currentThread());
        } catch (IllegalAccessException e) {
            // assert(false)
            throw new UnknownError(e.getMessage());
        } catch (InvocationTargetException e) {
            // assert(e.getTargetException() instanceof SecurityException)
            throw new UnknownError(e.getMessage());
        }
    }
112781
private static ClassLoader findClassLoader() throws ConfigurationError {
        // Figure out which ClassLoader to use for loading the provider
        // class.  If there is a Context ClassLoader then use it.

        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

        if (debug) debugPrintln(
            "Using context class loader: "
            + classLoader);

        if (classLoader == null) {
            // if we have no Context ClassLoader
            // so use the current ClassLoader
            classLoader = FactoryFinder.class.getClassLoader();
            if (debug) debugPrintln(
                "Using the class loader of FactoryFinder: "
                + classLoader);
        }

        return classLoader;
    }
114262
@FFDCIgnore(value = { ClassNotFoundException.class })
    public static Class<?> loadClass(ClassLoader cl, String className) {
        if (cl == null)
            return null;

        Class<?> c = null;
        try {
            c = cl.loadClass(className);
        } catch (ClassNotFoundException e) {

        }

        return c;
    }
1324677
@SuppressWarnings( "unchecked" )
    private <T> Class<T> loadClassIfVisible( String className, ClassLoader classLoader )
    {
        try
        {
            Class<T> klass = (Class<T>) classLoader.loadClass( className );
            return klass;
        }
        catch ( ClassNotFoundException e )
        {
            return null;
        }
    }
918763
@SuppressWarnings("unchecked")
    private Class<? extends T> loadClass(ClassLoader classLoader, String generatedName)
            throws ClassNotFoundException {
        return (Class<? extends T>) classLoader.loadClass(generatedName);
    }
1339492
def __load(self):
        
        parts = self.__class_name.split('.')
        module_name = ".".join(parts[:-1])
        module = __import__(module_name)
        modules = []
        for comp in parts[1:]:
            module = getattr(module, comp)
            modules.append(module)

        self.__module = modules[-2]
524500
@Nonnull
  public ClassLoader getClassLoader ()
  {
    return m_aBestCandidate == null ? Thread.currentThread ().getContextClassLoader ()
                                    : m_aBestCandidate.getClassLoader ();
  }
1188053
public static Class<?> loadClass(String classname, DataFormat<?> dataFormat) {

    // first try context classoader
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    if(cl != null) {
      LOG.tryLoadingClass(classname, cl);
      try {
        return cl.loadClass(classname);
      }
      catch(Exception e) {
        // ignore
      }
    }

    // else try the classloader which loaded the dataformat
    cl = dataFormat.getClass().getClassLoader();
    try {
      LOG.tryLoadingClass(classname, cl);
      return cl.loadClass(classname);
    }
    catch (ClassNotFoundException e) {
      throw LOG.classNotFound(classname, e);
    }

  }
19573
protected Class<?> loadClass(String clazz) throws ClassNotFoundException {
		if (this.classLoader == null){
			return Class.forName(clazz);
		}

		return Class.forName(clazz, true, this.classLoader);

	}
366066
public static ClassLoader getClassLoader() {
		ClassLoader classLoader = getContextClassLoader();
		if (classLoader == null) {
			classLoader = ClassLoaderUtil.class.getClassLoader();
			if (null == classLoader) {
				classLoader = ClassLoader.getSystemClassLoader();
			}
		}
		return classLoader;
	}
668261
public static ClassLoader getClassLoader(Class<?> clazz) {
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        if (loader != null) {
            return loader;
        }
        if (clazz != null) {
            loader = clazz.getClassLoader();
            if (loader != null) {
                return loader;
            }
        }
        return ClassLoader.getSystemClassLoader();
    }
318958
private static Class getByClass(String name) {
        try {
            return Thread.currentThread().getContextClassLoader().loadClass(name);
        } catch (Throwable e) {
        }
        return null;
    }
76861
@Nonnull
  public Class <?> loadClass (final String sClassName) throws ClassNotFoundException
  {
    if (m_aBestCandidate != null)
    {
      try
      {
        return m_aBestCandidate.loadClass (sClassName);
      }
      catch (final Throwable t)
      {
        m_aBestCandidate = null;
      }
    }

    Throwable aThrowable = null;
    Class <?> ret = null;
    IClassLoadHelper aLoadHelper = null;

    final Iterator <IClassLoadHelper> iter = m_aLoadHelpers.iterator ();
    while (iter.hasNext ())
    {
      aLoadHelper = iter.next ();
      try
      {
        ret = aLoadHelper.loadClass (sClassName);
        break;
      }
      catch (final Throwable t)
      {
        aThrowable = t;
      }
    }

    if (ret == null)
    {
      if (aThrowable instanceof ClassNotFoundException)
        throw (ClassNotFoundException) aThrowable;
      throw new ClassNotFoundException ("Unable to load class " + sClassName + " by any known loaders.", aThrowable);
    }

    // Remember
    m_aBestCandidate = aLoadHelper;
    return ret;
  }
1190964
@SuppressWarnings("unchecked")
    public static <T> Class<T> loadClass(String className) {
        return (Class<T>) loadClass(className, getDefaultClassLoader());
    }
73351
private final void init(boolean useClassLoader) {
		final CYaHPConverter converter = this;
		System.out.println("Initializing...");
		long time = System.currentTimeMillis();
		
		if (!useClassLoader) {
			System.out.println("init time: "+(System.currentTimeMillis()-time));
			return;
		}

		// if classloader is init return.
		if (CClassLoader.getRootLoader().isInit()) {
			return;
		} // end if
		// ensure the temporary files are delete on exit.
		Runtime.getRuntime().addShutdownHook(new Thread() {
				public void run() {
					try {
						converter.finalize();
					} // end try
					catch (final Throwable e) {}
				} // end run()
			} // end new
		);

		ClassLoader loader = this.getClass().getClassLoader();
		CClassLoaderConfig config = new CClassLoaderConfig();
		config.addLoaderInfo("/main",
			new CClassLoaderConfig.CLoaderInfo(true, true, false, false));
		config.addFile("/main", loader.getResource("itext-yahp.jar"));
		config.addFile("/main", loader.getResource("tidy-yahp.jar"));
		config.addFile("/main", loader.getResource("log4j-yahp.jar"));
		config.addFile("/main", loader.getResource("shanijar-yahp.jar"));
		config.addFile("/main", loader.getResource("xmlapi-yahp.jar"));
		config.addFile("/main", loader.getResource("yahp-internal.jar"));
		config.addFile("/main", loader.getResource("commonio-yahp.jar"));
		config.addFile("/main", loader.getResource("commonlog-yahp.jar"));
		config.addFile("/main", loader.getResource("core-renderer-yahp.jar"));
		config.addFile("/main", loader.getResource("jaxen-yahp.jar"));
		CClassLoader.init(config);
		try {
			URL url = CClassLoader.getRootLoader().getResource("log4j.properties");
			if (url != null) {
				ClassLoader cx = Thread.currentThread().getContextClassLoader();
				try {
					Thread.currentThread().setContextClassLoader(CClassLoader.getRootLoader());
					Class pc = CClassLoader.getRootLoader().loadClass("org.apache.log4j.PropertyConfigurator");
					Method configure = pc.getDeclaredMethod("configure", new Class[]{URL.class});
					configure.invoke(null, new Object[]{url});
				}
				finally {
					Thread.currentThread().setContextClassLoader(cx);
				}
			}
		}
		catch(Exception ignore){}
		System.out.println("init time: "+(System.currentTimeMillis()-time));
	}
54114
private static Object loadExtension(Extension extension, ClassLoaderPlugin classLoaderPlugin)
   {
      try
      {
         Class<?> c = classLoaderPlugin.loadClass(extension.getClassName(),
               extension.getModuleName(), extension.getModuleSlot());
         return c.newInstance();
      }
      catch (Throwable t)
      {
         log.tracef("Throwable while loading %s using own classloader: %s", extension.getClassName(), t.getMessage());
      }

      return null;
   }