[spring-extensions] branch main updated: IDP-1806 - Deal with trailing spaces

Scott Cantor cantor.2 at osu.edu
Tue May 11 14:40:50 UTC 2021


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

scantor pushed a commit to branch main
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=8160de08e5e66c182805fcefc3b29e1ea1662ed8

The following commit(s) were added to refs/heads/main by this push:
       new  8160de0   IDP-1806 - Deal with trailing spaces
8160de0 is described below

commit 8160de08e5e66c182805fcefc3b29e1ea1662ed8
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue May 11 10:40:47 2021 -0400

    IDP-1806 - Deal with trailing spaces
    
    https://issues.shibboleth.net/jira/browse/IDP-1806
    
    Add a bit more logic to the warning behavior.
---
 .../ext/spring/config/StringToResourceConverter.java      | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/main/java/net/shibboleth/ext/spring/config/StringToResourceConverter.java b/src/main/java/net/shibboleth/ext/spring/config/StringToResourceConverter.java
index 8cc7b1f..324d2b5 100644
--- a/src/main/java/net/shibboleth/ext/spring/config/StringToResourceConverter.java
+++ b/src/main/java/net/shibboleth/ext/spring/config/StringToResourceConverter.java
@@ -48,12 +48,17 @@ public class StringToResourceConverter implements Converter<String, Resource>, A
     public Resource convert(final String source) {
         final ResourceLoader loader =
                 applicationContext == null ? new PreferFileSystemResourceLoader() : applicationContext;
-        if (source.endsWith(" ")) {
-            log.warn("Path '{}' ends with a space", source);
-        }
         final Resource result = ResourceHelper.of(loader.getResource(source));
-        if (log.isDebugEnabled() && !result.exists()) {
-            log.debug("Resource at '{}' does not exist", source);
+        
+        if (source.endsWith(" ") || log.isDebugEnabled()) {
+            if (!result.exists()) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Resource at '{}' does not exist", source);
+                }
+                if (source.endsWith(" ")) {
+                    log.warn("Missing path '{}' ends with a space, check for stray characters", source);
+                }
+            }
         }
         return result;
     }

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


More information about the commits mailing list