roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r470625 - /incubator/roller/trunk/src/org/apache/roller/ui/rendering/servlets/ResourceServlet.java
Date Fri, 03 Nov 2006 01:26:42 GMT
Author: agilliland
Date: Thu Nov  2 17:26:42 2006
New Revision: 470625

URL: http://svn.apache.org/viewvc?view=rev&rev=470625
Log:
add a finally block to ensure that resource stream is properly closed even if an exception
occurs.


Modified:
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/servlets/ResourceServlet.java

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/servlets/ResourceServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/servlets/ResourceServlet.java?view=diff&rev=470625&r1=470624&r2=470625
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/servlets/ResourceServlet.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/servlets/ResourceServlet.java
Thu Nov  2 17:26:42 2006
@@ -158,16 +158,17 @@
                 out.write(buf, 0, length);
             }
             
-            // cleanup
+            // close output stream
             out.close();
-            resourceStream.close();
             
         } catch (Exception ex) {
-            log.error("Error writing resource file", ex);
             if(!response.isCommitted()) {
                 response.reset();
                 response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             }
+        } finally {
+            // make sure stream to resource file is closed
+            resourceStream.close();
         }
 
     }



Mime
View raw message