[spring-extensions] branch master updated: IDP-1450 Be less forgiving of empty boolean attributes

Rod Widdowson rdw at steadingsoftware.com
Mon Jul 22 06:04:21 EDT 2019


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

rdw 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=157013a51b17728ddb3c342bae3a5a15801497f7

The following commit(s) were added to refs/heads/master by this push:
       new  157013a   IDP-1450 Be less forgiving of empty boolean attributes
157013a is described below

commit 157013a51b17728ddb3c342bae3a5a15801497f7
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jul 22 11:03:00 2019 +0100

    IDP-1450 Be less forgiving of empty boolean attributes
---
 .../shibboleth/ext/spring/factory/PatternFactoryBean.java    | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/main/java/net/shibboleth/ext/spring/factory/PatternFactoryBean.java b/src/main/java/net/shibboleth/ext/spring/factory/PatternFactoryBean.java
index 9bbbab6..3c7122a 100644
--- a/src/main/java/net/shibboleth/ext/spring/factory/PatternFactoryBean.java
+++ b/src/main/java/net/shibboleth/ext/spring/factory/PatternFactoryBean.java
@@ -23,6 +23,7 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 /**
  * Factory bean for {@link Pattern}. Allows us to inject property based case sensitivity.
@@ -30,7 +31,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
 public class PatternFactoryBean extends AbstractComponentAwareFactoryBean<Pattern> {
 
     /** Whether the we are case sensitive or not. */
-    @Nullable private Boolean caseSensitive;
+    @Nullable private String caseSensitive;
 
     /** The regular expressions. */
     @Nullable private String regexp;
@@ -45,7 +46,7 @@ public class PatternFactoryBean extends AbstractComponentAwareFactoryBean<Patter
      * 
      * @return Returns the caseSensitive.
      */
-    public Boolean getCaseSensitive() {
+    public String getCaseSensitive() {
         return caseSensitive;
     }
 
@@ -54,7 +55,7 @@ public class PatternFactoryBean extends AbstractComponentAwareFactoryBean<Patter
      * 
      * @param what The value to set.
      */
-    public void setCaseSensitive(@Nullable final Boolean what) {
+    public void setCaseSensitive(@Nullable final String what) {
         caseSensitive = what;
     }
 
@@ -80,7 +81,10 @@ public class PatternFactoryBean extends AbstractComponentAwareFactoryBean<Patter
     @Override protected Pattern doCreateInstance() throws Exception {
         Constraint.isNotNull(regexp, "Regular expression cannot be null");
         
-        if (null == getCaseSensitive() || getCaseSensitive()) {
+        final Boolean isCaseSentitive = StringSupport.booleanOf(caseSensitive);
+        Constraint.isNotNull(isCaseSentitive, "caseSensitive cannot be null");
+
+        if (isCaseSentitive) {
             return Pattern.compile(regexp, 0);
         } else {
             return Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);

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


More information about the commits mailing list