Skip to content

Commit

Permalink
Fixed bug + test
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Gonzalez Cortes committed Jun 27, 2013
1 parent 656c6e9 commit 2ee737f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/main/java/org/fao/unredd/portal/IndicatorsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,13 @@ public void returnIndicators(String layerId) throws IOException,
Outputs indicators = layer.getOutputs();
response.setContentType("application/json;charset=UTF-8");
answer = indicators.toJSON();
try {
response.getWriter().print(answer);
response.flushBuffer();
} catch (IOException e) {
logger.error("Error returning the indicators", e);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
} else {
logger.error("the layer does not exist");
ApplicationController.ErrorCause.ILLEGAL_ARGUMENT
.writeError(response);
}
try {
response.getWriter().print(answer);
response.flushBuffer();
} catch (IOException e) {
logger.error("Error returning the indicators", e);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/fao/unredd/portal/IndicatorsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public void testIndicatorsUnexistantLayer() throws Exception {
when(layerFactory.exists(anyString())).thenReturn(false);
indicators.returnIndicators("");
verify(layerFactory, never()).newLayer(anyString());
verify(response, never()).setStatus(anyInt());
}

@Test
Expand Down

0 comments on commit 2ee737f

Please sign in to comment.