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,6 +109,14 @@ public class User implements Comparable {
|
||||||
|
|
||||||
public int compareTo(Object o) {
|
public int compareTo(Object o) {
|
||||||
Collator collator = Collator.getInstance();
|
Collator collator = Collator.getInstance();
|
||||||
|
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());
|
return collator.compare(this.getUsername(),((User)o).getUsername());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue