From 643ed3d53f703aa2035de351ed4e1d420bec066a Mon Sep 17 00:00:00 2001 From: jeb228 Date: Wed, 30 Jun 2010 18:42:09 +0000 Subject: [PATCH] NIHVIVO-161 Tweak the interface for displaying a system error. --- .../freemarker/ImageUploadController.java | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java index ff30f4632..a6933c2c5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java @@ -71,6 +71,7 @@ public class ImageUploadController extends FreeMarkerHttpServlet { public static final String TEMPLATE_NEW = "imageUpload/newImage.ftl"; public static final String TEMPLATE_REPLACE = "imageUpload/replaceImage.ftl"; public static final String TEMPLATE_CROP = "imageUpload/cropImage.ftl"; + public static final String TEMPLATE_ERROR = "error.ftl"; private static final String URL_HERE = UrlBuilder.getUrl("/uploadImages"); @@ -207,9 +208,9 @@ public class ImageUploadController extends FreeMarkerHttpServlet { // Can't find the entity? Complain. return showAddImagePageWithError(null, e.getMessage()); } catch (Exception e) { - // We weren't expecting this - dump as much info as possible. + // We weren't expecting this - log it, and apologize to the user. log.error(e, e); - return doError(e.toString()); + return new TemplateResponseValues(TEMPLATE_ERROR); } } @@ -290,18 +291,6 @@ public class ImageUploadController extends FreeMarkerHttpServlet { return showIndividualDisplayPage(entity); } - /** - * Display a error message to the user. - * - * @message The text of the error message. - */ - private TemplateResponseValues doError(String message) { - TemplateResponseValues rv = new TemplateResponseValues( - "errorMessage.ftl"); - rv.put("errorMessage", message); - return rv; - } - /** * We need to be talking about an actual Individual here. */ @@ -538,8 +527,8 @@ public class ImageUploadController extends FreeMarkerHttpServlet { /** * For debugging, dump all sorts of information about the request. * - * WARNING: if "req" represents a Multi-part request which has not - * yet been parsed, then reading these parameters will consume them. + * WARNING: if "req" represents a Multi-part request which has not yet been + * parsed, then reading these parameters will consume them. */ @SuppressWarnings("unchecked") private void dumpRequestDetails(HttpServletRequest req) {