[java-identity-provider] branch main updated: Get rid of pre-V5 default methods on interface.

Scott Cantor cantor.2 at osu.edu
Mon Apr 24 16:42:11 UTC 2023


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

scantor 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=f92cb56fd7632e74694d0ce89e737ed070b4cf22

The following commit(s) were added to refs/heads/main by this push:
     new f92cb56fd Get rid of pre-V5 default methods on interface.
f92cb56fd is described below

commit f92cb56fd7632e74694d0ce89e737ed070b4cf22
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Apr 24 12:42:07 2023 -0400

    Get rid of pre-V5 default methods on interface.
---
 .../shibboleth/idp/installer/CurrentInstallState.java | 19 +++++++------------
 .../idp/installer/impl/CurrentInstallStateImpl.java   | 13 +++++++------
 2 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/CurrentInstallState.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/CurrentInstallState.java
index 4932d6545..a92af36ef 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/CurrentInstallState.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/CurrentInstallState.java
@@ -28,14 +28,14 @@ import javax.annotation.Nullable;
 import org.apache.tools.ant.BuildException;
 
 import net.shibboleth.idp.spring.IdPPropertiesApplicationContextInitializer;
-import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.component.InitializableComponent;
 
 /** Tells the installers about the current install state. */
 public interface CurrentInstallState extends InitializableComponent {
 
     /** What to return if this is V3. */
-    static final String V3_VERSION = "3";
+    @Nonnull @NotEmpty static final String V3_VERSION = "3";
 
     /** What is the installer version.
      * @return {@value #V3_VERSION} for a V3 install, null for a new install or the value we wrote during last install.
@@ -73,21 +73,16 @@ public interface CurrentInstallState extends InitializableComponent {
      * For new installs this is false
      * @return whether the old install has %{idp.home}\system
      */
-    default boolean isSystemPresent() {
-        return true;
-    }
+    boolean isSystemPresent();
 
     /** Which modules (by ID) are enabled for this release.
      * @return those modules enabled.
      */
-    @Nonnull default Collection<String> getEnabledModules() {
-        return CollectionSupport.emptySet();
-    }
+    @Nonnull Collection<String> getEnabledModules();
 
     /** Build a classpath loader which adds all the plugins in.
      * @return a classloader
      */
-    default ClassLoader getInstalledPluginsLoader() {
-        return this.getClass().getClassLoader();
-    }
-}
+    @Nullable ClassLoader getInstalledPluginsLoader();
+
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallStateImpl.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallStateImpl.java
index 2c78c1100..c2900fa89 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallStateImpl.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallStateImpl.java
@@ -69,10 +69,10 @@ public final class CurrentInstallStateImpl extends AbstractInitializableComponen
     @Nonnull private final Path targetDir;
     
     /** The files we will delete if they created on upgrade. */
-    private final String[][] deleteAfterUpgrades = { { "credentials", "secrets.properties", }, };
+    @Nonnull private final String[][] deleteAfterUpgrades = { { "credentials", "secrets.properties", }, };
 
     /** The module IDs which are enabled. */
-    private Set<String> enabledModules;
+    @Nonnull private Set<String> enabledModules;
 
     /** Whether the IdP properties file exists.*/
     private boolean idpPropertiesPresent;
@@ -179,7 +179,7 @@ public final class CurrentInstallStateImpl extends AbstractInitializableComponen
      * Populate {{@link #enabledModules} from the current classpath and the new IdP home.
      */
     private void findEnabledModules() {
-        if (getInstalledVersion()==null) {
+        if (getInstalledVersion() == null) {
             return;
         }
         final ModuleContext moduleContext = new ModuleContext(targetDir);
@@ -204,6 +204,7 @@ public final class CurrentInstallStateImpl extends AbstractInitializableComponen
     /** {@inheritDoc} */
     protected void doInitialize() throws ComponentInitializationException {
         super.doInitialize();
+        
         idpPropertiesPresent = Files.exists(targetDir.resolve("conf").resolve("idp.properties"));
         ldapPropertiesPresent = Files.exists(targetDir.resolve("conf").resolve("ldap.properties"));
         systemPresent = Files.exists(targetDir.resolve("system"));
@@ -263,16 +264,16 @@ public final class CurrentInstallStateImpl extends AbstractInitializableComponen
 
     /** {@inheritDoc} */
     @Nonnull public Collection<String> getEnabledModules() {
-        assert enabledModules != null;
         return enabledModules;
     }
 
     /** {@inheritDoc} */
-    public synchronized ClassLoader getInstalledPluginsLoader() {
+    @Nullable public synchronized ClassLoader getInstalledPluginsLoader() {
 
         if (installedPluginsLoader != null) {
             return installedPluginsLoader;
         }
+        
         final Path libs = targetDir.resolve("dist").resolve("plugin-webapp").resolve("WEB-INF").resolve("lib");
         final URL[] urls;
         if (Files.exists(libs)) {
@@ -302,7 +303,7 @@ public final class CurrentInstallStateImpl extends AbstractInitializableComponen
                         toArray(URL[]::new);
             } catch (final IOException e) {
                 log.error("Error finding Plugins' classpath", e);
-                installedPluginsLoader = this.getClass().getClassLoader();
+                installedPluginsLoader = getClass().getClassLoader();
                 return installedPluginsLoader;
             }
         } else {

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


More information about the commits mailing list