Skip to content

Commit

Permalink
Returning 404 instead of NPE when type is not present.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisoelkers committed Jun 12, 2015
1 parent f21c41e commit 8ac5a12
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/controllers/api/OutputsApiController.java
Expand Up @@ -37,8 +37,13 @@ public Result index() throws APIException, IOException {
}

public Result available(String outputType) throws APIException, IOException {
final AvailableOutputSummary result = outputService.available().types.get(outputType);
return ok(Json.toJson(result));
final Map<String, AvailableOutputSummary> types = outputService.available().types;
final AvailableOutputSummary result = types.get(outputType);
if (result != null) {
return ok(Json.toJson(result));
} else {
return notFound();
}
}

public Result availableTypes() throws APIException, IOException {
Expand Down

0 comments on commit 8ac5a12

Please sign in to comment.