From 19e823f8d3baacea5452a06cb20b2b761c08ffd8 Mon Sep 17 00:00:00 2001 From: JokerSun <781487810@qq.com> Date: Wed, 17 Apr 2019 09:41:17 +0800 Subject: [PATCH] AuthorityUtils Null Check Fixes: gh-6773 --- .../springframework/security/core/authority/AuthorityUtils.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/org/springframework/security/core/authority/AuthorityUtils.java b/core/src/main/java/org/springframework/security/core/authority/AuthorityUtils.java index 15b3507a1f..4cfe410067 100644 --- a/core/src/main/java/org/springframework/security/core/authority/AuthorityUtils.java +++ b/core/src/main/java/org/springframework/security/core/authority/AuthorityUtils.java @@ -24,6 +24,7 @@ import java.util.Set; import org.springframework.security.core.GrantedAuthority; import org.springframework.util.StringUtils; +import org.springframework.util.Assert; /** * Utility method for manipulating GrantedAuthority collections etc. @@ -55,6 +56,7 @@ public abstract class AuthorityUtils { */ public static Set authorityListToSet( Collection userAuthorities) { + Assert.notNull(userAuthorities, "userAuthorities cannot be null"); Set set = new HashSet<>(userAuthorities.size()); for (GrantedAuthority authority : userAuthorities) {