Revision f1c17375
Added by Katja Luther almost 8 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DefaultTermComparator.java | ||
---|---|---|
26 | 26 |
public class DefaultTermComparator<T extends DefinedTermBase> implements Comparator<T> { |
27 | 27 |
@Override |
28 | 28 |
public int compare(T o1, T o2) { |
29 |
if (o1 == o2){ |
|
30 |
return 0; |
|
31 |
} |
|
32 |
if (o1 == null){ |
|
33 |
return -1; |
|
34 |
} |
|
35 |
if (o2 == null){ |
|
36 |
return 1; |
|
37 |
} |
|
29 | 38 |
String label1 = o1.getLabel(CdmStore.getDefaultLanguage()) != null ? o1.getLabel(CdmStore.getDefaultLanguage()) : o1.getTitleCache(); |
30 | 39 |
String label2 = o2.getLabel(CdmStore.getDefaultLanguage()) != null ? o2.getLabel(CdmStore.getDefaultLanguage()) : o2.getTitleCache(); |
31 | 40 |
return label1.compareTo(label2); |
Also available in: Unified diff
#4018 fix NPE in DefaultTermComparator