From c3d416998cf912a7d9aff9b57b8fec38750efc4a Mon Sep 17 00:00:00 2001 From: Vigya Sharma Date: Sun, 26 Jul 2020 18:56:44 -0700 Subject: [PATCH] Throw exceptions if unable to instantiate plugin --- .../performanceanalyzer/plugins/PluginController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/plugins/PluginController.java b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/plugins/PluginController.java index 52e699de4..05d764523 100644 --- a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/plugins/PluginController.java +++ b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/plugins/PluginController.java @@ -58,7 +58,8 @@ private void loadFrameworkPlugins() { plugins.add((Plugin) constructors[0].newInstance()); LOG.info("loaded plugin: [{}]", plugins.get(plugins.size() - 1).name()); } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); + LOG.error("Failed to instantiate plugin", e); + throw new IllegalStateException("Failed to instantiate plugin: [" + pluginClass.getName() + "]", e); } } }