AuthorityUtils Null Check

Fixes: gh-6773
This commit is contained in:
JokerSun 2019-04-17 09:41:17 +08:00 committed by Josh Cummings
parent c3b4a5d4c2
commit 19e823f8d3
1 changed files with 2 additions and 0 deletions

View File

@ -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 <tt>GrantedAuthority</tt> collections etc.
@ -55,6 +56,7 @@ public abstract class AuthorityUtils {
*/
public static Set<String> authorityListToSet(
Collection<? extends GrantedAuthority> userAuthorities) {
Assert.notNull(userAuthorities, "userAuthorities cannot be null");
Set<String> set = new HashSet<>(userAuthorities.size());
for (GrantedAuthority authority : userAuthorities) {