https://issues.apache.org/bugzilla/show_bug.cgi?id=52722

             Bug #: 52722
           Summary: An incomplete fix for the resource leak bug in
                    HTMLManagerServlet.java
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Manager application
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: liangg...@sei.pku.edu.cn
    Classification: Unclassified


The fix revision 412780 was aimed to remove an resource leak bug on the  
PrintWriter object "writer "in the method "cacheContext" of the file 
"/tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java"
, but it is incomplete. 

When the statements at lines 309-540 throw any eception, the objects
"writer"can 
not be closed as expected. The best way to close such resource object is
putting  
such close operations in the finaly block of a try-catch-finally structure.

The buggy code in the head revision is copied  as bellows:

 public void list(HttpServletRequest request,
                     HttpServletResponse response,
                     String message) throws IOException {

        if (debug >= 1)
            log("list: Listing contexts for virtual host '" +
                host.getName() + "'");

308        PrintWriter writer = response.getWriter();

        // HTML Header Section
        writer.print(Constants.HTML_HEADER_SECTION);
。。。。。

        // Finish up the response
        writer.flush();
541        writer.close();
    }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to