Mercurial > hg > digilib-old
changeset 820:dc8cda290f2f stream
deal with null response
author | robcast |
---|---|
date | Tue, 22 Feb 2011 18:33:55 +0100 |
parents | a23c4c15a6a8 |
children | 6c752969f9e8 |
files | servlet/src/digilib/servlet/ServletOps.java |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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();