Skip to content

Commit

Permalink
Reject plugins if one fails to load
Browse files Browse the repository at this point in the history
  • Loading branch information
xxDark committed Apr 27, 2024
1 parent 4866e7a commit 2ffd5f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,18 @@ Collection<PluginContainer<?>> apply(List<PreparedPlugin> preparedPlugins) throw
enable(loadedPlugin);
} catch (PluginException ex) {
for (LoadedPlugin pl : temp.values()) {
Plugin maybeEnabled = pl.container.plugin;
if (maybeEnabled != null) {
PluginContainerImpl<?> container = pl.container;
try {
try {
maybeEnabled.onDisable();
} catch (Exception ex1) {
ex.addSuppressed(ex1);
Plugin maybeEnabled = container.plugin;
if (maybeEnabled != null) {
maybeEnabled.onDisable();
}
} finally {
container.preparedPlugin.reject();
}
} catch (Exception ex1) {
ex.addSuppressed(ex1);
}
}
throw ex;
Expand Down
2 changes: 1 addition & 1 deletion recaf-ui/src/main/java/software/coley/recaf/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private static void initPlugins() {
String split = "\n - ";
logger.info("Initialization: {} plugins found:" + split + "{}",
plugins.size(),
plugins.stream().map(PluginContainer::getInformation)
plugins.stream().map(PluginContainer::info)
.map(info -> info.name() + " - " + info.version())
.collect(Collectors.joining(split)));
}
Expand Down

0 comments on commit 2ffd5f8

Please sign in to comment.