[java-shib-profile] branch main updated: IDP-2241 Clean up error text in the plugin installer

Rod Widdowson rdw at steadingsoftware.com
Fri Feb 9 15:57:07 UTC 2024


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-shib-profile.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-profile.git;a=commit;h=bea67dea544dc5e0208f50d0d3f1a3af2ea788f2

The following commit(s) were added to refs/heads/main by this push:
     new bea67de  IDP-2241 Clean up error text in the plugin installer
bea67de is described below

commit bea67dea544dc5e0208f50d0d3f1a3af2ea788f2
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Feb 9 13:09:53 2024 +0000

    IDP-2241 Clean up error text in the plugin installer
    
    https://shibboleth.atlassian.net/browse/IDP-2241
    
    Don't log with the word "plugin" in InstallableComponentSupport because this
    can also be used for IdP version checking
    
    Try to disambiguate Installee (usually Plugin, sometime IdP) version
    from the Application (IdP) version
    
    Also some drive through null stomping.
---
 .../InstallableComponentInfo.java                  |  4 +++-
 .../InstallableComponentSupport.java               | 24 +++++++++++-----------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/shib-profile-api/src/main/java/net/shibboleth/profile/installablecomponent/InstallableComponentInfo.java b/shib-profile-api/src/main/java/net/shibboleth/profile/installablecomponent/InstallableComponentInfo.java
index 546a717..6f9e40b 100644
--- a/shib-profile-api/src/main/java/net/shibboleth/profile/installablecomponent/InstallableComponentInfo.java
+++ b/shib-profile-api/src/main/java/net/shibboleth/profile/installablecomponent/InstallableComponentInfo.java
@@ -28,6 +28,7 @@ import org.slf4j.Logger;
 
 import net.shibboleth.profile.installablecomponent.InstallableComponentSupport.SupportLevel;
 import net.shibboleth.shared.collection.Pair;
+import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.shared.primitive.StringSupport;
 
@@ -40,7 +41,7 @@ import net.shibboleth.shared.primitive.StringSupport;
 public abstract class InstallableComponentInfo {
 
     /** regexp for spaces. */
-    @Nonnull private static final Pattern SPACE_CONTAINING = Pattern.compile("\\s+");
+    @Nonnull private static final Pattern SPACE_CONTAINING = Constraint.isNotNull(Pattern.compile("\\s+"), "Pattern Compilation Failure");;
 
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(InstallableComponentInfo.class);
@@ -172,6 +173,7 @@ public abstract class InstallableComponentInfo {
         log.debug("Component {}: MaxIdP {}, MinIdP {}, Support Level {}",
                 componentId, maxVersionInfo, minVersionInfo, supportLevel);
         final InstallableComponentInfo.VersionInfo info;
+        assert supportLevel != null;
         info = new InstallableComponentInfo.VersionInfo(maxVersionInfo, minVersionInfo, supportLevel);
         versionInfo.put(theVersion, info);
         String downloadURL =  StringSupport.trimOrNull(
diff --git a/shib-profile-api/src/main/java/net/shibboleth/profile/installablecomponent/InstallableComponentSupport.java b/shib-profile-api/src/main/java/net/shibboleth/profile/installablecomponent/InstallableComponentSupport.java
index a9755f3..51eabd2 100644
--- a/shib-profile-api/src/main/java/net/shibboleth/profile/installablecomponent/InstallableComponentSupport.java
+++ b/shib-profile-api/src/main/java/net/shibboleth/profile/installablecomponent/InstallableComponentSupport.java
@@ -88,38 +88,38 @@ public final class InstallableComponentSupport {
     private InstallableComponentSupport() {
     }
 
-    /** Find the best update version  (plugin or IdP).
+    /** Find the best update version (plugin or IdP - call it the instalee).
      * @param installIntoVersion The IdP version to check.
-     * @param pluginVersion The Plugin version
-     * @param pluginInfo all about the plugin
+     * @param instaleeVersion The instalee version
+     * @param instaleeInfo all about the instalee
      * @return the best version (or null)
      */
     @Nullable static public InstallableComponentVersion getBestVersion(
             @Nonnull final InstallableComponentVersion installIntoVersion,
-            @Nonnull final InstallableComponentVersion pluginVersion,
-            @Nonnull final InstallableComponentInfo pluginInfo) {
-        final List<InstallableComponentVersion> availableVersions = new ArrayList<>(pluginInfo.getAvailableVersions().keySet());
+            @Nonnull final InstallableComponentVersion instaleeVersion,
+            @Nonnull final InstallableComponentInfo instaleeInfo) {
+        final List<InstallableComponentVersion> availableVersions = new ArrayList<>(instaleeInfo.getAvailableVersions().keySet());
         availableVersions.sort(null);
-        log.debug("Considering plugin versions: {}", availableVersions);
+        log.debug("Considering available versions: {}", availableVersions);
     
         for (int i = availableVersions.size()-1; i >= 0; i--) {
             final InstallableComponentVersion version = availableVersions.get(i);
-            if (version.compareTo(pluginVersion) <= 0) {
-                log.debug("Available version {} is less than or the same as {}. All done", version, pluginVersion);
+            if (version.compareTo(instaleeVersion) <= 0) {
+                log.debug("Available version {} is less than or the same as {}. All done", version, instaleeVersion);
                 return null;
             }
-            final VersionInfo versionInfo = pluginInfo.getAvailableVersions().get(version);
+            final VersionInfo versionInfo = instaleeInfo.getAvailableVersions().get(version);
             final SupportLevel supportLevel = versionInfo.getSupportLevel();
             if (supportLevel != SupportLevel.Current && supportLevel != SupportLevel.OutOfDate) {
                 log.debug("Available version {} has support level {}, ignoring", version, supportLevel);
                 continue;
             }
-            if (!pluginInfo.isSupportedWithIdPVersion(version, installIntoVersion)) {
+            if (!instaleeInfo.isSupportedWithIdPVersion(version, installIntoVersion)) {
                 log.debug("Available version {} is not supported with Application Version {}", version, installIntoVersion);
                 continue;
             }
             log.debug("Plugin version {} is supported with Application Version {}", version, installIntoVersion);
-            if (pluginInfo.getUpdateURL(version) == null || pluginInfo.getUpdateBaseName(version) == null) {
+            if (instaleeInfo.getUpdateURL(version) == null || instaleeInfo.getUpdateBaseName(version) == null) {
                 log.debug("Available version {} is does not have update information", version);
                 continue;
             }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list