From: Katja Luther Date: Wed, 21 Sep 2016 07:35:58 +0000 (+0200) Subject: fix #6061: add a null check for abbrevTitleCache and titleCache in comparator X-Git-Tag: 4.3.0^2~4 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/28027bed8148feb8c9a3cfdbd7e203e62ad51733 fix #6061: add a null check for abbrevTitleCache and titleCache in comparator --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java index 7fb99183a..96104ab29 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java @@ -215,7 +215,25 @@ public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog { public int compare(UuidAndTitleCache entity1, UuidAndTitleCache entity2) { Collator collator = Collator.getInstance(); - return collator.compare(entity1.getAbbrevTitleCache(), entity2.getAbbrevTitleCache()); + String compareString1 = ""; + if (entity1.getAbbrevTitleCache() != null){ + compareString1 = entity1.getAbbrevTitleCache(); + } + if (entity1.getTitleCache() != null){ + compareString1 += entity1.getTitleCache(); + } + + + String compareString2 = ""; + if (entity2.getAbbrevTitleCache() != null){ + compareString2 = entity2.getAbbrevTitleCache(); + } + if (entity2.getTitleCache() != null){ + compareString2 += entity2.getTitleCache(); + } + + + return collator.compare(compareString1, compareString2); } }; }