From 815028edd42f040789404c3f7c05e04f014b3184 Mon Sep 17 00:00:00 2001 From: Mauricio Carneiro Date: Mon, 18 Feb 2013 11:11:18 -0500 Subject: [PATCH] Added verbose error message to the PluginManager -- added a logger.error with a more descriptive message of what the most likely cause of the error is Typical error happens when a walker's global variable is not initialized properly (usually in test conditions). The old error message was very hard to understand "Could not create module because of an exception of type NullPointerException ocurred caused by exception null" --- .../sting/utils/classloader/PluginManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/java/src/org/broadinstitute/sting/utils/classloader/PluginManager.java b/public/java/src/org/broadinstitute/sting/utils/classloader/PluginManager.java index 410f1ccb2..38bd9bdcc 100644 --- a/public/java/src/org/broadinstitute/sting/utils/classloader/PluginManager.java +++ b/public/java/src/org/broadinstitute/sting/utils/classloader/PluginManager.java @@ -25,6 +25,8 @@ package org.broadinstitute.sting.utils.classloader; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; import org.broadinstitute.sting.gatk.WalkerManager; import org.broadinstitute.sting.gatk.filters.FilterManager; import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException; @@ -299,11 +301,14 @@ public class PluginManager { * @return The plugin object if created; null otherwise. */ public PluginType createByType(Class pluginType) { + Logger logger = Logger.getLogger(PluginManager.class); + logger.setLevel(Level.ERROR); try { Constructor noArgsConstructor = pluginType.getDeclaredConstructor((Class[])null); noArgsConstructor.setAccessible(true); return noArgsConstructor.newInstance(); } catch (Exception e) { + logger.error("Couldn't initialize the plugin. Typically this is because of wrong global class variable initializations."); throw new DynamicClassResolutionException(pluginType, e); } }