james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r883814 - /james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java
Date Tue, 24 Nov 2009 18:58:39 GMT
Author: norman
Date: Tue Nov 24 18:58:39 2009
New Revision: 883814

URL: http://svn.apache.org/viewvc?rev=883814&view=rev
Log:
 MessageSourceServlet had a close() not in a finally block (HUPA-55).Thx to Eric Jablow for
the patch.

Modified:
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java?rev=883814&r1=883813&r2=883814&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java
(original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java
Tue Nov 24 18:58:39 2009
@@ -29,6 +29,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.logging.Log;
 import org.apache.hupa.server.InMemoryIMAPStoreCache;
 import org.apache.hupa.shared.SConsts;
@@ -63,7 +64,7 @@
 
         String message_uuid = request.getParameter(SConsts.PARAM_UID);
         String folderName = request.getParameter(SConsts.PARAM_FOLDER);
-        
+        OutputStream outs = null;
         try {
             long uid = Long.parseLong(message_uuid);
 
@@ -76,10 +77,9 @@
             Message m = f.getMessageByUID(uid);
 
             response.setContentType("text/plain");
-            OutputStream outs = response.getOutputStream();
+            outs = response.getOutputStream();
             m.writeTo(outs);
             outs.flush();
-            outs.close();
 
             if (f.isOpen()) {
                 f.close(false);
@@ -88,6 +88,8 @@
             String msg = "Unable to get raw content of msg for user " + user + " in folder
" + folderName + " with uid " + message_uuid;
             logger.error(msg, e);
             throw new ServletException(msg);
+        } finally {
+            IOUtils.closeQuietly(outs);
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message