I was browsing through the drools source code

 

I am not a fan of seeing catching Throwable in any java code …

 

I see this in class org.drools.util.ClassUtils:

 

    /**

     * This method will attempt to create an instance of the specified Class. It uses

     * a syncrhonized HashMap to cache the reflection Class lookup.

     * @param className

     * @return

     */

    public static Object instantiateObject(String className) {

        Class cls = (Class) ClassUtils.classes.get( className );

        if ( cls == null ) {

            try {

                cls = Class.forName( className );

                ClassUtils.classes.put(  className, cls );

            } catch ( Throwable e ) {

                throw new RuntimeException("Unable to load class '" + className + "'", e );

            }           

        }

       

        Object object = null;

        try {

            object = cls.newInstance();           

        } catch ( Throwable e ) {

            throw new RuntimeException("Unable to instantiate object for class '" + className + "'", e );

        } 

        return object;

    }

 

I believe this masks important errors where the application should not continue to run and it would be preferable to crash…

 

--zoly