JAL-2525 return no features if none matches ontology term!
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 25 Sep 2017 13:44:56 +0000 (14:44 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 25 Sep 2017 13:44:56 +0000 (14:44 +0100)
src/jalview/datamodel/features/SequenceFeatures.java
test/jalview/datamodel/features/SequenceFeaturesTest.java

index 52da8c7..8d5ba58 100644 (file)
@@ -149,6 +149,14 @@ public class SequenceFeatures implements SequenceFeaturesI
     }
 
     Set<String> featureTypes = getFeatureTypes(ontologyTerm);
+    if (featureTypes.isEmpty())
+    {
+      /*
+       * no features of the specified type or any sub-type
+       */
+      return new ArrayList<>();
+    }
+
     return getAllFeatures(featureTypes.toArray(new String[featureTypes
             .size()]));
   }
index a144f03..39d6dce 100644 (file)
@@ -1032,6 +1032,9 @@ public class SequenceFeaturesTest
     assertEquals(features.size(), 2);
     assertTrue(features.contains(sf2));
     assertTrue(features.contains(sf3));
+
+    features = store.getFeaturesByOntology("sequence_variant");
+    assertTrue(features.isEmpty());
   }
 
   @Test(groups = "Functional")