[java-identity-provider] 04/04: IDP-1429 Final tidy

Rod Widdowson rdw at steadingsoftware.com
Thu Apr 11 11:19:41 EDT 2019


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

rdw pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=cfd69c96b9ab084ec379258e6c2790f8259ae040

commit cfd69c96b9ab084ec379258e6c2790f8259ae040
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Apr 11 16:15:01 2019 +0100

    IDP-1429 Final tidy
    
    https://issues.shibboleth.net/jira/browse/IDP-1429
    
    Remove string setter for regexp Polocy and matecher filters.
    Rename a field.
---
 .../matcher/impl/AbstractRegexpStringMatcher.java  | 29 +++++++-------------
 .../policyrule/impl/AbstractRegexpPolicyRule.java  | 31 +++++++---------------
 2 files changed, 18 insertions(+), 42 deletions(-)

diff --git a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AbstractRegexpStringMatcher.java b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AbstractRegexpStringMatcher.java
index efc9ad6..87186c9 100644
--- a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AbstractRegexpStringMatcher.java
+++ b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AbstractRegexpStringMatcher.java
@@ -34,7 +34,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
 public abstract class AbstractRegexpStringMatcher extends AbstractMatcher {
 
     /** Regular expression to match. */
-    @NonnullAfterInit private Pattern regex;
+    @NonnullAfterInit private Pattern pattern;
 
     /**
      * Gets the regular expression to match.
@@ -42,28 +42,17 @@ public abstract class AbstractRegexpStringMatcher extends AbstractMatcher {
      * @return the regular expression
      */
     @NonnullAfterInit public String getRegularExpression() {
-        return regex.pattern();
+        return pattern.pattern();
     }
-
-    /**
-     * Sets the regular expression to match.
-     * 
-     * @param expression regular expression to match
-     * @deprecated
-     */
-    public void setRegularExpression(final String expression) {
-        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-        regex = Pattern.compile(expression);
-    }
-    
+   
     /**
      * Sets the {@link Pattern} for matching to match.
      * 
-     * @param pattern the pattern to match
+     * @param thePattern the pattern to match
      */
-    public void setPattern(@Nonnull final Pattern pattern) {
+    public void setPattern(@Nonnull final Pattern thePattern) {
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-        regex = Constraint.isNotNull(pattern, "Pattern supplied to setPattern but not be null");
+        pattern = Constraint.isNotNull(thePattern, "Pattern supplied to setPattern but not be null");
     }
 
     /**
@@ -75,11 +64,11 @@ public abstract class AbstractRegexpStringMatcher extends AbstractMatcher {
      */
     protected boolean regexpCompare(@Nullable final String value) {
         ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
-        if (regex == null || value == null) {
+        if (pattern == null || value == null) {
             return false;
         }
 
-        if (regex.matcher(value).matches()) {
+        if (pattern.matcher(value).matches()) {
             return true;
         }
 
@@ -90,7 +79,7 @@ public abstract class AbstractRegexpStringMatcher extends AbstractMatcher {
     @Override
     protected void doInitialize() throws ComponentInitializationException {
         super.doInitialize();
-        if (null == regex) {
+        if (null == pattern) {
             throw new ComponentInitializationException(getLogPrefix() + " No regular expression provided"); 
         }
     }
diff --git a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/impl/AbstractRegexpPolicyRule.java b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/impl/AbstractRegexpPolicyRule.java
index f4ba66a..2843c0e 100644
--- a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/impl/AbstractRegexpPolicyRule.java
+++ b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/impl/AbstractRegexpPolicyRule.java
@@ -33,40 +33,27 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
 public abstract class AbstractRegexpPolicyRule extends AbstractPolicyRule {
 
     /** Regular expression to match. */
-    private Pattern regex;
+    private Pattern pattern;
 
     /**
      * Gets the regular expression to match.
      * 
-     * @return rsegular expression to match
+     * @return regular expression to match
      */
     @NonnullAfterInit public String getRegularExpression() {
-        return regex.pattern();
+        return pattern.pattern();
     }
 
     /**
-     * Sets the regular expression to match.
-     * 
-     * @param expression regular expression to match
-     * @deprecated
-     */
-    public void setRegularExpression(final String expression) {
-        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-        regex = Pattern.compile(expression);
-    }
-    
-    /**
      * Sets the {@link Pattern} for matching to match.
      * 
-     * @param pattern the pattern to match
+     * @param thePattern the pattern to match
      */
-    public void setPattern(@Nonnull final Pattern pattern) {
+    public void setPattern(@Nonnull final Pattern thePattern) {
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-        regex = Constraint.isNotNull(pattern, "Pattern supplied to setPattern but not be null");
+        pattern = Constraint.isNotNull(thePattern, "Pattern supplied to setPattern but not be null");
     }
 
-
-
     /**
      * Matches the given value against the provided regular expression.
      * 
@@ -78,9 +65,9 @@ public abstract class AbstractRegexpPolicyRule extends AbstractPolicyRule {
         ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
 
         final boolean result;
-        if (regex == null || value == null) {
+        if (pattern == null || value == null) {
             result = false;
-        } else if (regex.matcher(value).matches()) {
+        } else if (pattern.matcher(value).matches()) {
             result = true;
         } else {
             result = false;
@@ -95,7 +82,7 @@ public abstract class AbstractRegexpPolicyRule extends AbstractPolicyRule {
     /** {@inheritDoc} */
     protected void doInitialize() throws ComponentInitializationException {
         super.doInitialize();
-        if (null == regex) {
+        if (null == pattern) {
             throw new ComponentInitializationException(getLogPrefix() + " No regular expression provided");
         }
     }

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


More information about the commits mailing list