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