# HG changeset patch # User robcast # Date 1298396035 -3600 # Node ID dc8cda290f2ffc3c92efbe54ce3271058fe8d027 # Parent a23c4c15a6a89f61366a7c202712e3600ff253ea deal with null response diff -r a23c4c15a6a8 -r dc8cda290f2f servlet/src/digilib/servlet/ServletOps.java --- a/servlet/src/digilib/servlet/ServletOps.java Mon Feb 21 22:36:35 2011 +0100 +++ b/servlet/src/digilib/servlet/ServletOps.java Tue Feb 22 18:33:55 2011 +0100 @@ -152,7 +152,7 @@ } /** - * print a servlet response and exit + * print a servlet response */ public static void htmlMessage(String msg, HttpServletResponse response) throws IOException { @@ -160,7 +160,7 @@ } /** - * print a servlet response and exit + * print a servlet response */ public static void htmlMessage(String title, String msg, HttpServletResponse response) throws IOException { @@ -222,6 +222,10 @@ public static void sendFile(File f, String mt, String name, HttpServletResponse response, Logger logger) throws ImageOpException, IOException { logger.debug("sendRawFile(" + mt + ", " + f + ")"); + if (response == null) { + logger.error("No response!"); + return; + } if (mt == null) { // auto-detect mime-type mt = FileOps.mimeForFile(f); @@ -290,6 +294,10 @@ public static void sendImage(DocuImage img, String mimeType, HttpServletResponse response, Logger logger) throws ImageOpException, ServletException { + if (response == null) { + logger.error("No response!"); + return; + } logger.debug("sending to response:"+ response + " committed=" + response.isCommitted()); try { OutputStream outstream = response.getOutputStream();