From fcfd2e7be6c4e7286b17256564b74c8f21958553 Mon Sep 17 00:00:00 2001 From: Jim Blake Date: Tue, 20 Jan 2015 16:09:53 -0500 Subject: [PATCH] VIVO-869 The display should not barf if no IndexHistory is present. --- .../webapp/search/controller/IndexController.java | 9 ++++++--- .../freemarker/body/admin/searchIndexStatus.ftl | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/IndexController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/IndexController.java index f22cfcf6a..2c100a140 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/IndexController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/IndexController.java @@ -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 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, diff --git a/webapp/web/templates/freemarker/body/admin/searchIndexStatus.ftl b/webapp/web/templates/freemarker/body/admin/searchIndexStatus.ftl index 804cad8dc..4ffff2a13 100644 --- a/webapp/web/templates/freemarker/body/admin/searchIndexStatus.ftl +++ b/webapp/web/templates/freemarker/body/admin/searchIndexStatus.ftl @@ -40,9 +40,13 @@

History

- <#list history as ie> - <@showIndexerEvent ie /> - + <#if history?has_content > + <#list history as ie> + <@showIndexerEvent ie /> + + <#else> + +
Event Status Since Counts
Search indexer history is not available.