[java-identity-provider] branch main updated: IDP-1866 - Module handling does not work when idpHome is classpath

Rod Widdowson rdw at steadingsoftware.com
Wed Nov 3 13:32:27 UTC 2021


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=e130d12699fdeb8e81284b193787b0b05abe43cd

The following commit(s) were added to refs/heads/main by this push:
     new e130d1269 IDP-1866 - Module handling does not work when idpHome is classpath
e130d1269 is described below

commit e130d12699fdeb8e81284b193787b0b05abe43cd
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Nov 3 13:28:32 2021 +0000

    IDP-1866 - Module handling does not work when idpHome is classpath
    
    https://shibboleth.atlassian.net/browse/IDP-1866
    
    On Windows, the (String) parameter to Path#startsWith(String)
    must be something which Java things is a valid Path.
    
    Despite "classpath:foo" being a valid Windows file name, Java
    disagrees.  the netresult is that path.startWith("classpath:")
    throws an exception.
    
    Fix this by casting the Path to a string and doing
    String#StartsWith(String)
---
 .../src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java b/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java
index 35a4e4e63..5ba6d9516 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java
@@ -111,7 +111,7 @@ public abstract class AbstractIdPModule implements IdPModule {
 
             final Path resolved = moduleContext.getIdPHome().resolve(resource.getDestination());
             log.debug("Module {}: resolved resource destination {}", getId(), resolved);
-            if (resolved.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
+            if (resolved.toString().startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
                 final ClassPathResource cp = new ClassPathResource(
                         resolved.toString().substring(ResourceUtils.CLASSPATH_URL_PREFIX.length()));
                 if (!cp.exists()) {
@@ -134,7 +134,7 @@ public abstract class AbstractIdPModule implements IdPModule {
     @Nonnull @NonnullElements public Map<ModuleResource, ResourceResult> enable(
             @Nonnull final ModuleContext moduleContext) throws ModuleException {
         
-        if (moduleContext.getIdPHome().startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
+        if (moduleContext.getIdPHome().toString().startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
             throw new ModuleException("IdP location is a classpath");
         }
         
@@ -164,7 +164,7 @@ public abstract class AbstractIdPModule implements IdPModule {
     @Nonnull @NonnullElements public Map<ModuleResource, ResourceResult> disable(
             @Nonnull final ModuleContext moduleContext, final boolean clean) throws ModuleException {
 
-        if (moduleContext.getIdPHome().startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
+        if (moduleContext.getIdPHome().toString().startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
             throw new ModuleException("IdP location is a classpath");
         }
 

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


More information about the commits mailing list