User compareTo now handles null user names. NIHVIVO-827
This commit is contained in:
parent
7d41fde0b3
commit
1bf04355a4
1 changed files with 9 additions and 1 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue