[java-identity-provider] branch main updated: IDP-1888 Add duplicate property detection to the context initializer

Rod Widdowson rdw at steadingsoftware.com
Sun Apr 3 13:21:31 UTC 2022


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=297c1d44a7f4d58a3422bc0a565f07ab577bc679

The following commit(s) were added to refs/heads/main by this push:
     new 297c1d44a IDP-1888 Add duplicate property detection to the context initializer
297c1d44a is described below

commit 297c1d44a7f4d58a3422bc0a565f07ab577bc679
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Apr 3 14:15:06 2022 +0100

    IDP-1888 Add duplicate property detection to the context initializer
    
    https://shibboleth.atlassian.net/browse/IDP-1888
    
    Even more complexity on path comparison to cope with DOS and
    Unix directory separators.
---
 .../spring/IdPPropertiesApplicationContextInitializer.java    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationContextInitializer.java b/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationContextInitializer.java
index 73c72a889..41bc3f4be 100644
--- a/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationContextInitializer.java
+++ b/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationContextInitializer.java
@@ -242,10 +242,13 @@ public class IdPPropertiesApplicationContextInitializer
            if (searchRoot.toFile().isDirectory()) {
                try (final Stream<Path> paths = Files.find(searchRoot, Integer.MAX_VALUE,
                        new BiPredicate<Path,BasicFileAttributes>() {
-                               public boolean test(final Path t, final BasicFileAttributes u) {
-                                   if (u.isRegularFile() && t.getFileName().toString().endsWith(".properties")
-                                           && !t.toString().endsWith(IDP_PROPERTIES)) {
-                                       LOG.info("Including auto-located properties in {}", t);
+                               public boolean test(final Path path, final BasicFileAttributes u) {
+                                   final String pathAsString = path.toString();
+                                   // convert back and forth to handle different dir separators
+                                   final String idpPropertiesNative = Path.of(IDP_PROPERTIES).toString();
+                                   if (u.isRegularFile() && path.getFileName().toString().endsWith(".properties")
+                                           && !pathAsString.endsWith(idpPropertiesNative)) {
+                                       LOG.info("Including auto-located properties in {}", path);
                                        return true;
                                    }
                                    return false;

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


More information about the commits mailing list