public static Class loadClass()

in lightning-core/src/main/java/org/apache/directmemory/lightning/internal/util/ClassUtil.java [89:146]


    public static Class<?> loadClass( String canonicalName, ClassLoader classLoader )
        throws ClassNotFoundException
    {
        Class<?> type = null;
        try
        {
            type = classLoader.loadClass( canonicalName );
        }
        catch ( ClassNotFoundException e )
        {
            // Intentionally left blank
        }

        if ( type == null )
        {
            try
            {
                type = Class.forName( canonicalName );
            }
            catch ( ClassNotFoundException e )
            {
                // Intentionally left blank
            }
        }

        if ( type == null )
        {
            try
            {
                ClassLoader tcl = Thread.currentThread().getContextClassLoader();
                type = tcl.loadClass( canonicalName );
            }
            catch ( ClassNotFoundException e )
            {
                // Intentionally left blank
            }
        }

        if ( type == null )
        {
            try
            {
                ClassLoader ccl = ClassUtil.class.getClassLoader();
                type = ccl.loadClass( canonicalName );
            }
            catch ( ClassNotFoundException e )
            {
                // Intentionally left blank
            }
        }

        if ( type != null )
        {
            return type;
        }

        throw new ClassNotFoundException( "Class " + canonicalName + " not found on classpath" );
    }