Resolve plugin installation conflict were the same plugin was tried to be installed multiple times for one single action. (#2138)

The pending queue is updated after all the plugins to be installed are collected, and then we already may have duplicate entries. Because of this we check right on the collecting step if the plugin was already added during this single action.
This commit is contained in:
Eduard Heimbuch
2022-10-20 20:38:58 +02:00
committed by GitHub
parent 976f71b33c
commit 8db2e76ecc
3 changed files with 27 additions and 1 deletions

View File

@@ -357,7 +357,13 @@ public class DefaultPluginManager implements PluginManager {
}
}
plugins.add(plugin);
if (pluginWasNotAddedYet(plugins, plugin)) {
plugins.add(plugin);
}
}
private static boolean pluginWasNotAddedYet(List<AvailablePlugin> plugins, AvailablePlugin plugin) {
return plugins.stream().noneMatch(p -> p.getDescriptor().getInformation().getName().equals(plugin.getDescriptor().getInformation().getName()));
}
private boolean isInstalledOrPending(String name) {