protected synchronized Class loadClass()

in src/main/java/org/apache/sling/commons/classloader/impl/ClassLoaderFacade.java [131:159]


    protected synchronized Class<?> loadClass(String name, boolean resolve)
    throws ClassNotFoundException {
        if(!checkManagerActive()) {
            throw new ClassNotFoundException(name);
        }
        final ClassLoader[] loaders = manager.getDynamicClassLoaders();
        for(final ClassLoader cl : loaders) {
            if ( cl != null ) {
                try {
                    final Class<?> c = cl.loadClass(name);
                    return c;
                } catch (ClassNotFoundException cnfe) {
                    // we just ignore this and try the next class loader
                } catch (Throwable t) {
                    logger.error("Exception while trying to load class " + name + " from class loader " + cl, t);
                }
            }
        }
        if (name.startsWith("sun.reflect.") || name.startsWith("jdk.internal.reflect.")) {
            try {
                return ClassLoader.getSystemClassLoader().loadClass(name);
            } catch (ClassNotFoundException cnfe) {
                // we just ignore this and throw our own exception
            } catch (Throwable t) {
                logger.error("Exception while trying to load class " + name + " from class loader " + ClassLoader.getSystemClassLoader(), t);
            }
        }
        throw new ClassNotFoundException(name);
    }