[java-identity-provider] 01/03: IDP-1595 Plugin Handling improvements
Rod Widdowson
rdw at steadingsoftware.com
Wed Sep 30 12:00:09 UTC 2020
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=73b435c3caffa8725e17c297fd75d60b3164ff5e
commit 73b435c3caffa8725e17c297fd75d60b3164ff5e
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Sep 30 11:56:57 2020 +0100
IDP-1595 Plugin Handling improvements
https://issues.shibboleth.net/jira/browse/IDP-1595
Better logging when the bootstrap ID is mismatched.
---
.../idp/installer/plugin/impl/PluginInstaller.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
index b82479410..e0b6fb42f 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
@@ -35,6 +35,7 @@ import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Optional;
import java.util.Properties;
import java.util.ServiceLoader;
import java.util.ServiceLoader.Provider;
@@ -319,6 +320,11 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
try (final URLClassLoader loader = new URLClassLoader(urls.toArray(URL[]::new))){
final ServiceLoader<PluginDescription> plugins = ServiceLoader.load(PluginDescription.class, loader);
+ final Optional<PluginDescription> first = plugins.findFirst();
+ if (first.isEmpty()) {
+ LOG.error("No Plugin services found in plugin distribution");
+ throw new BuildException("No Plugin services found in plugin distribution");
+ }
for (final PluginDescription plugin:plugins) {
LOG.debug("Found Service announcing itself as {}", plugin.getPluginId() );
if (pluginId.equals(plugin.getPluginId())) {
@@ -327,8 +333,9 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
}
LOG.trace("Did not match {}", pluginId);
}
+ LOG.error("Looking in plugin distibution for a plugin called {}, but found a plugin called {}.",
+ pluginId, first.get().getPluginId());
}
- LOG.error("Could not locate description for {} in distribution {}", pluginId, libDir);
throw new BuildException("Could not locate PluginDescription");
} catch (final IOException e) {
LOG.error("Could not get description of {} from {}", pluginId, libDir, e);
@@ -546,7 +553,8 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
private void setupPluginId() throws BuildException {
final File propertyFile = distribution.resolve("bootstrap").resolve("id.property").toFile();
if (!propertyFile.exists()) {
- LOG.error("Could not locate identity of plugin at {}", propertyFile);
+ LOG.error("Could not locate identity of plugin. "
+ + "Identity file 'bootstrap/id.property' not present in plugin distribution.");
throw new BuildException("Could not locate identity of plugin");
}
try (final InputStream inStream = new BufferedInputStream(new FileInputStream(propertyFile))) {
@@ -554,7 +562,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
idProperties.load(inStream);
final String id = StringSupport.trimOrNull(idProperties.getProperty("pluginid"));
if (id == null) {
- LOG.error("identity property file {} did not contain 'pluginid' property", propertyFile);
+ LOG.error("Identity property file 'bootstrap/id.property' did not contain 'pluginid' property");
throw new BuildException("No property in ID file");
}
if (pluginId != null && !pluginId.equals(id)) {
@@ -563,7 +571,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
setPluginId(id);
}
} catch (final IOException e) {
- LOG.error("Could not load plugin identity at {}", propertyFile, e);
+ LOG.error("Could not load plugin identity file 'bootstrap/id.property'", e);
throw new BuildException(e);
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list