[java-support] branch dev/JSPT-111 updated: Allow null in setter.
Scott Cantor
cantor.2 at osu.edu
Wed May 18 19:53:18 UTC 2022
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch dev/JSPT-111
in repository java-support.
View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=4220556169699cc216ae12f496d4f495ba68bc31
The following commit(s) were added to refs/heads/dev/JSPT-111 by this push:
new 4220556 Allow null in setter.
4220556 is described below
commit 4220556169699cc216ae12f496d4f495ba68bc31
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed May 18 15:53:15 2022 -0400
Allow null in setter.
---
.../security/impl/BasicAccessControlService.java | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/main/java/net/shibboleth/utilities/java/support/security/impl/BasicAccessControlService.java b/src/main/java/net/shibboleth/utilities/java/support/security/impl/BasicAccessControlService.java
index 15b0704..059b29b 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/security/impl/BasicAccessControlService.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/security/impl/BasicAccessControlService.java
@@ -31,7 +31,6 @@ import org.slf4j.LoggerFactory;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
import net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
-import net.shibboleth.utilities.java.support.logic.Constraint;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
import net.shibboleth.utilities.java.support.security.AccessControl;
import net.shibboleth.utilities.java.support.security.AccessControlService;
@@ -56,17 +55,20 @@ public class BasicAccessControlService extends AbstractIdentifiableInitializable
*
* @param map map of named policies
*/
- public void setPolicyMap(@Nonnull @NonnullElements final Map<String,AccessControl> map) {
+ public void setPolicyMap(@Nullable @NonnullElements final Map<String,AccessControl> map) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
- Constraint.isNotNull(map, "Policy map cannot be null");
- policyMap = new HashMap<>(map.size());
-
- for (final Map.Entry<String,AccessControl> entry : map.entrySet()) {
- final String trimmed = StringSupport.trimOrNull(entry.getKey());
- if (trimmed != null && entry.getValue() != null) {
- policyMap.put(trimmed, entry.getValue());
+ if (map != null) {
+ policyMap = new HashMap<>(map.size());
+
+ for (final Map.Entry<String,AccessControl> entry : map.entrySet()) {
+ final String trimmed = StringSupport.trimOrNull(entry.getKey());
+ if (trimmed != null && entry.getValue() != null) {
+ policyMap.put(trimmed, entry.getValue());
+ }
}
+ } else {
+ policyMap = Collections.emptyMap();
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list