Init: Catch NoClassDefFoundError when initializing plugins
The InitStep interface was moved to a different package in 2.11. If the plugins folder contains a plugin that was built against API version 2.10 or earlier, and implements the InitStep interface, this will cause NoClassDefFoundError to be raised when initializing the plugin. Catch the error and display a warning message, instead of failing with a stack trace. Add newlines on existing warning messages. Change-Id: I3b3839987d5f821beb085008fabbca4196860fd8
This commit is contained in:
@@ -85,13 +85,18 @@ public class InitPluginStepsLoader {
|
||||
return getPluginInjector(jar).getInstance(initStepClass);
|
||||
} catch (ClassCastException e) {
|
||||
ui.message(
|
||||
"WARN: InitStep from plugin %s does not implement %s (Exception: %s)",
|
||||
"WARN: InitStep from plugin %s does not implement %s (Exception: %s)\n",
|
||||
jar.getName(), InitStep.class.getName(), e.getMessage());
|
||||
return null;
|
||||
} catch (NoClassDefFoundError e) {
|
||||
ui.message(
|
||||
"WARN: Failed to run InitStep from plugin %s (Missing class: %s)\n",
|
||||
jar.getName(), e.getMessage());
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ui.message(
|
||||
"WARN: Cannot load and get plugin init step for %s (Exception: %s)",
|
||||
"WARN: Cannot load and get plugin init step for %s (Exception: %s)\n",
|
||||
jar, e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user