Fix newly-introduced bug in the PluginManager/DynamicClassResolutionException

where, when the system can't find a plugin of the correct name, the system
prefers to crap all over itself and throw an unintelligible NullPointerException
rather than displaying an intelligent error.


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4393 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-09-30 19:07:05 +00:00
parent 14e19f4605
commit bf7fd08810
1 changed files with 3 additions and 2 deletions

View File

@ -27,6 +27,7 @@ package org.broadinstitute.sting.utils.classloader;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
import org.broadinstitute.sting.utils.exceptions.UserException;
import java.util.HashMap;
import java.util.List;
@ -85,9 +86,9 @@ public abstract class PluginManager<PluginType> {
*/
public PluginType createByName(String pluginName) {
Class<? extends PluginType> plugin = pluginsByName.get(pluginName);
if( plugin == null )
throw new UserException(String.format("Could not find %s with name: %s", pluginCategory,pluginName));
try {
if( plugin == null )
throw new ReviewedStingException(String.format("Could not find %s with name: %s", pluginCategory,pluginName));
return plugin.newInstance();
} catch (Exception e) {
throw new DynamicClassResolutionException(plugin, e);