avoiding NPEs in loadTreeBranch methods
authorAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Tue, 19 Oct 2021 13:41:32 +0000 (15:41 +0200)
committerAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Wed, 20 Oct 2021 09:21:18 +0000 (11:21 +0200)
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/ClassificationServiceImpl.java

index 39f39ea896f47e0c6b7108f33b26abee52e6532c..10c7404b23a7fd49c1956a26165aaaf1d73e7e77 100644 (file)
@@ -280,11 +280,11 @@ public class ClassificationServiceImpl
         TaxonNode node = taxonNodeService.find(nodeUuid);
         if(node == null){
             logger.warn("The specified taxon is not found in the given tree.");
-            return null;
+            return new ArrayList<>(0);
         }else if (subtree != null && !node.isDescendant(subtree)){
             //TODO handle as exception? E.g. FilterException, AccessDeniedException?
             logger.warn("The specified taxon is not found for the given subtree.");
-            return null;
+            return new ArrayList<>(0);
         }
 
         return loadTreeBranch(node, subtree, baseRank, includeUnpublished, propertyPaths);