Skip to content

Commit

Permalink
Fixed NPE when no concept is found
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Westergaard Lassen committed Sep 12, 2012
1 parent 7ae0611 commit 1928fd8
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -70,6 +70,13 @@ private Concept getIsA() {
return isAType; return isAType;
} }


private ConceptNode toConceptNode(Concept concept) {
return new ConceptNode(
concept.getConceptId(),
concept.getTerm(),
false);
}

@RequestMapping(value = "search", produces = "application/json;charset=utf-8") @RequestMapping(value = "search", produces = "application/json;charset=utf-8")
public ResponseEntity<String> search(@RequestParam("query") String query) { public ResponseEntity<String> search(@RequestParam("query") String query) {
Concept concept = conceptRepository.getByFullyspecifiedName(query); Concept concept = conceptRepository.getByFullyspecifiedName(query);
Expand Down Expand Up @@ -116,7 +123,7 @@ public TreeResponse conceptTree(final String conceptId) {
Concept target = conceptRepository.getByConceptId(conceptId); Concept target = conceptRepository.getByConceptId(conceptId);
if (target == null) { if (target == null) {
logger.debug("Did not find any concepts with conceptId=" + conceptId); logger.debug("Did not find any concepts with conceptId=" + conceptId);
return null; return new TreeResponse(null);
} }
List<Concept> levels = getThreeLevelsUpFrom(target); List<Concept> levels = getThreeLevelsUpFrom(target);
reverse(levels); reverse(levels);
Expand Down

0 comments on commit 1928fd8

Please sign in to comment.