
/*
 * Carrot2 project.
 *
 * Copyright (C) 2002-2009, Dawid Weiss, Stanisław Osiński.
 * All rights reserved.
 *
 * Refer to the full license file "carrot2.LICENSE"
 * in the root folder of the repository checkout or at:
 * http://www.carrot2.org/carrot2.LICENSE
 */

package org.carrot2.util;

/**
 * Utilities related to Java reflection.
 */
public final class ReflectionUtils
{
    private ReflectionUtils()
    {
        // No instances.
    }

    /**
     * Load and initialize (or return, if already defined) a given class using context
     * class loader.
     */
    public static Class<?> classForName(String clazzName) throws ClassNotFoundException
    {
        return Class.forName(clazzName, true, Thread.currentThread()
            .getContextClassLoader());
    }
}

@@ -288,16 +288,49 @@
 2.util;%0D
+%0A%0Aimport org.apache.log4j.Logger;
 %0A%0D%0A/**%0D%0A
@@ -706,26 +706,52 @@
 ption%0D%0A    %7B
+%0A        try%0A        %7B
 %0D%0A
+    
         retu
@@ -820,16 +820,20 @@
         
+    
 .getCont
@@ -850,16 +850,251 @@
 ader());
+%0A        %7D%0A        catch (ClassNotFoundException e)%0A        %7B%0A            Logger.getLogger(ReflectionUtils.class).warn(%22Could not load class: %22%0A                + clazzName + %22 (%22 + e.getMessage() + %22).%22);%0A            throw e;%0A        %7D
 %0D%0A    %7D%0D

Added a warning message when a given class cannot be loaded by reflection.