VIVO-869 The display should not barf if no IndexHistory is present.

This commit is contained in:
Jim Blake 2015-01-20 16:09:53 -05:00
parent 83a5523ace
commit fcfd2e7be6
2 changed files with 13 additions and 6 deletions

View file

@ -144,17 +144,20 @@ public class IndexController extends FreemarkerHttpServlet {
throws IOException {
if (!PolicyHelper.isAuthorizedForActions(req, REQUIRED_ACTIONS)) {
resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
resp.getWriter().write("You are not authorized to access this page.");
resp.getWriter().write(
"You are not authorized to access this page.");
return;
}
try {
Map<String, Object> body = new HashMap<>();
body.put("statusUrl", UrlBuilder.getUrl(PAGE_URL, "status", "true"));
body.put("rebuildUrl",
UrlBuilder.getUrl(PAGE_URL, "rebuild", "true"));
body.put("status", buildStatusMap(indexer.getStatus()));
body.put("history", history.toMaps());
if (history != null) {
body.put("history", history.toMaps());
}
String rendered = FreemarkerProcessingServiceSetup.getService(
getServletContext()).renderTemplate(STATUS_TEMPLATE_NAME,