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"
This commit is contained in:
parent
8eda0c50df
commit
815028edd4
|
|
@ -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<PluginType> {
|
|||
* @return The plugin object if created; null otherwise.
|
||||
*/
|
||||
public PluginType createByType(Class<? extends PluginType> pluginType) {
|
||||
Logger logger = Logger.getLogger(PluginManager.class);
|
||||
logger.setLevel(Level.ERROR);
|
||||
try {
|
||||
Constructor<? extends PluginType> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue