User compareTo now handles null user names. NIHVIVO-827

This commit is contained in:
bdc34 2010-07-15 18:52:03 +00:00
parent 7d41fde0b3
commit 1bf04355a4

View file

@ -109,7 +109,15 @@ public class User implements Comparable {
public int compareTo(Object o) {
Collator collator = Collator.getInstance();
return collator.compare(this.getUsername(),((User)o).getUsername());
User other = ((User)o);
if( this.getUsername() == null && other.getUsername() == null )
return 0;
else if( this.getUsername() == null )
return -1;
else if( other.getUsername() == null)
return 1;
else
return collator.compare(this.getUsername(),((User)o).getUsername());
}
}