Skip to content

Commit

Permalink
Always show plugin path when service provider is missing on plugin load
Browse files Browse the repository at this point in the history
  • Loading branch information
huw0 authored and wendigo committed Jul 13, 2024
1 parent 0d0e90e commit 392f0a2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,17 @@ private void loadPlugin(String plugin, Supplier<PluginClassLoader> createClassLo

handleResolver.registerClassLoader(pluginClassLoader);
try (ThreadContextClassLoader _ = new ThreadContextClassLoader(pluginClassLoader)) {
loadPlugin(pluginClassLoader);
loadPlugin(plugin, pluginClassLoader);
}

log.info("-- Finished loading plugin %s --", plugin);
}

private void loadPlugin(PluginClassLoader pluginClassLoader)
private void loadPlugin(String pluginPath, PluginClassLoader pluginClassLoader)
{
ServiceLoader<Plugin> serviceLoader = ServiceLoader.load(Plugin.class, pluginClassLoader);
List<Plugin> plugins = ImmutableList.copyOf(serviceLoader);
checkState(!plugins.isEmpty(), "No service providers of type %s in the classpath: %s", Plugin.class.getName(), asList(pluginClassLoader.getURLs()));
checkState(!plugins.isEmpty(), "%s - No service providers of type %s in the classpath: %s", pluginPath, Plugin.class.getName(), asList(pluginClassLoader.getURLs()));

for (Plugin plugin : plugins) {
log.info("Installing %s", plugin.getClass().getName());
Expand Down

0 comments on commit 392f0a2

Please # to comment.