SEC-1337: Add Serializable interface to internal comparator

This commit is contained in:
Luke Taylor 2009-12-18 14:12:32 +00:00
parent 55679971f0
commit 354b043fd1
1 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,7 @@
package org.springframework.security.core.userdetails; package org.springframework.security.core.userdetails;
import java.io.Serializable;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -195,7 +196,7 @@ public class User implements UserDetails {
return sortedAuthorities; return sortedAuthorities;
} }
private static class AuthorityComparator implements Comparator<GrantedAuthority> { private static class AuthorityComparator implements Comparator<GrantedAuthority>, Serializable {
public int compare(GrantedAuthority g1, GrantedAuthority g2) { public int compare(GrantedAuthority g1, GrantedAuthority g2) {
// Neither should ever be null as each entry is checked before adding it to the set. // Neither should ever be null as each entry is checked before adding it to the set.
// If the authority is null, it is a custom authority and should precede others. // If the authority is null, it is a custom authority and should precede others.