Permalink
Browse files

Fixed NPE when no concept is found

  • Loading branch information...
1 parent 7ae0611 commit 1928fd8cc00481492e05662641a0b248c5d8f159 @mwl mwl committed Sep 12, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 sc-web/src/main/java/dk/sst/snomedcave/controllers/ConceptController.java
@@ -70,6 +70,13 @@ private Concept getIsA() {
return isAType;
}
+ private ConceptNode toConceptNode(Concept concept) {
+ return new ConceptNode(
+ concept.getConceptId(),
+ concept.getTerm(),
+ false);
+ }
+
@RequestMapping(value = "search", produces = "application/json;charset=utf-8")
public ResponseEntity<String> search(@RequestParam("query") String query) {
Concept concept = conceptRepository.getByFullyspecifiedName(query);
@@ -116,7 +123,7 @@ public TreeResponse conceptTree(final String conceptId) {
Concept target = conceptRepository.getByConceptId(conceptId);
if (target == null) {
logger.debug("Did not find any concepts with conceptId=" + conceptId);
- return null;
+ return new TreeResponse(null);
}
List<Concept> levels = getThreeLevelsUpFrom(target);
reverse(levels);

0 comments on commit 1928fd8

Please sign in to comment.