As Remy pointed out, this really should be in the finally block.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 15 Jul 2008 15:51:44 +0000 (15:51 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 15 Jul 2008 15:51:44 +0000 (15:51 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@676944 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/servlets/CGIServlet.java

index 1de39ac..054cc34 100644 (file)
@@ -1728,16 +1728,20 @@ public final class CGIServlet extends HttpServlet {
                     }
                 } //replacement for Process.waitFor()
     
-                // Close the output stream if used
-                if (cgiOutput != null) {
-                    cgiOutput.close();
-                }
             }
             catch (IOException e){
                 log ("Caught exception " + e);
                 throw e;
             }
             finally{
+                // Close the output stream if used
+                if (cgiOutput != null) {
+                    try {
+                        cgiOutput.close();
+                    } catch (IOException ioe) {
+                        log ("Exception closing output stream " + ioe);
+                    }
+                }
                 if (debug > 4) {
                     log ("Running finally block");
                 }