[java-opensaml COMMIT] in /trunk: opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/WhitelistBlacklistParameters....

noreply at shibboleth.net noreply at shibboleth.net
Wed May 7 17:40:19 EDT 2014


Author: putmanb
Date: Wed May  7 17:40:18 2014
New Revision: 3845

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3845&view=rev
Log:
Fix inconsistent use of Set vs List.

Modified:
    trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/WhitelistBlacklistParameters.java
    trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicWhitelistBlacklistConfiguration.java

Modified: trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/WhitelistBlacklistParameters.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/WhitelistBlacklistParameters.java?rev=3845&r1=3844&r2=3845&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/WhitelistBlacklistParameters.java (original)
+++ trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/WhitelistBlacklistParameters.java Wed May  7 17:40:18 2014
@@ -21,16 +21,15 @@
 import java.util.Collections;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotLive;
 import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
-import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
-import com.google.common.base.Predicates;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
 
 /**
  * The whitelist and blacklist algorithm parameters.
@@ -45,8 +44,8 @@
         
     /** Constructor. */
     public WhitelistBlacklistParameters() {
-        whiteListedAlgorithmURIs = Collections.emptyList();
-        blackListedAlgorithmURIs = Collections.emptyList();
+        whiteListedAlgorithmURIs = Collections.emptySet();
+        blackListedAlgorithmURIs = Collections.emptySet();
     }
     
     /**
@@ -55,7 +54,7 @@
      * @return the list of algorithms
      */
     @Nonnull @NonnullElements @NotLive @Unmodifiable public Collection<String> getWhitelistedAlgorithmURIs() {
-        return ImmutableList.copyOf(whiteListedAlgorithmURIs);
+        return ImmutableSet.copyOf(whiteListedAlgorithmURIs);
     }
     
     /**
@@ -63,9 +62,12 @@
      * 
      * @param uris the list of algorithms
      */
-    public void setWhitelistedAlgorithmURIs(@Nonnull @NonnullElements final Collection<String> uris) {
-        Constraint.isNotNull(uris, "Whitelist cannot be null");
-        whiteListedAlgorithmURIs = Lists.newArrayList(Collections2.filter(uris, Predicates.notNull()));
+    public void setWhitelistedAlgorithmURIs(@Nullable final Collection<String> uris) {
+        if (uris == null) {
+            whiteListedAlgorithmURIs = Collections.emptySet();
+            return;
+        }
+        whiteListedAlgorithmURIs = Sets.newHashSet(StringSupport.normalizeStringCollection(uris));
     }
     
     /**
@@ -74,7 +76,7 @@
      * @return the list of algorithms
      */
     @Nonnull @NonnullElements @NotLive @Unmodifiable public Collection<String> getBlacklistedAlgorithmURIs() {
-        return ImmutableList.copyOf(blackListedAlgorithmURIs);
+        return ImmutableSet.copyOf(blackListedAlgorithmURIs);
     }
     
     /**
@@ -83,8 +85,11 @@
      * @param uris the list of algorithms
      */
     public void setBlacklistedAlgorithmURIs(@Nonnull @NonnullElements final Collection<String> uris) {
-        Constraint.isNotNull(uris, "Blacklist cannot be null");
-        blackListedAlgorithmURIs = Lists.newArrayList(Collections2.filter(uris, Predicates.notNull()));
+        if (uris == null) {
+            blackListedAlgorithmURIs = Collections.emptySet();
+            return;
+        }
+        blackListedAlgorithmURIs = Sets.newHashSet(StringSupport.normalizeStringCollection(uris));
     }
     
 }

Modified: trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicWhitelistBlacklistConfiguration.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicWhitelistBlacklistConfiguration.java?rev=3845&r1=3844&r2=3845&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicWhitelistBlacklistConfiguration.java (original)
+++ trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicWhitelistBlacklistConfiguration.java Wed May  7 17:40:18 2014
@@ -63,8 +63,8 @@
     
     /** Constructor. */
     public BasicWhitelistBlacklistConfiguration() {
-        whitelist = Collections.emptyList();
-        blacklist = Collections.emptyList();
+        whitelist = Collections.emptySet();
+        blacklist = Collections.emptySet();
         precedence = DEFAULT_PRECEDENCE;
     }
     



More information about the commits mailing list