[spring-extensions] 03/05: Guard deprecation warning if value is negative.

Ian Young ian at iay.org.uk
Fri Jan 26 13:07:03 EST 2018


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

iay pushed a commit to branch master
in repository spring-extensions.

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

commit 5c880e4f681dce996aab106749e973c2a081de5a
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jan 17 11:52:31 2018 -0500

    Guard deprecation warning if value is negative.
---
 .../net/shibboleth/ext/spring/config/DurationToLongConverter.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/java/net/shibboleth/ext/spring/config/DurationToLongConverter.java b/src/main/java/net/shibboleth/ext/spring/config/DurationToLongConverter.java
index d67c5e5..69e30c8 100644
--- a/src/main/java/net/shibboleth/ext/spring/config/DurationToLongConverter.java
+++ b/src/main/java/net/shibboleth/ext/spring/config/DurationToLongConverter.java
@@ -41,12 +41,14 @@ public class DurationToLongConverter implements Converter<String,Long>, Conditio
         if (source.startsWith("P")) {
             return DOMTypeSupport.durationToLong(source.trim());
         } else if (source.startsWith("-P")) {
-            throw new IllegalArgumentException("Negative durations are not supported");
+            throw new IllegalArgumentException("Negative duration syntax is not supported");
         } else {
             // Treat as a milliseconds.  But note this
             final long duration = Long.valueOf(source);
-            log.info("Deprecated duration of {} was specified. Use XML duration of {}", source,
-                    DOMTypeSupport.longToDuration(duration));
+            if (duration > 0) {
+                log.info("Deprecated duration of {} was specified. Use XML duration of {}", source,
+                        DOMTypeSupport.longToDuration(duration));
+            }
             return duration;
         }
     }

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


More information about the commits mailing list