DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15088>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15088

org.apache.jasper.servlet.JspServlet doesn't close a FileInputStream.

           Summary: org.apache.jasper.servlet.JspServlet doesn't close a
                    FileInputStream.
           Product: Tomcat 4
           Version: 4.0.6 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Jasper
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


As I know, JspServlet is responsible for checking if jsp should be reloaded or
not, etc.

I found that JspServlet is checking it by opening the jsp file input stream.
In the loadJSP() method of JspServlet,

        // First check if the requested JSP page exists, to avoid creating
        // unnecessary directories and files.
        if (context.getResourceAsStream(jspUri) == null)
            throw new FileNotFoundException(jspUri);

context.getResourceAsStream() returns a InputStream object for the jsp file.
I think this routine would call `org.apache.catalina.core.ApplicationContext''s
getResourceAsStream() method, and then call
`org.apache.naming.resources.FileDirContext''s `streamContent()' method, which
would return a FileInputStream object.

If my inference is true, then `if (context.getResourceAsStream(jspUri) == null)'
code has a problem. Because this code doesn't close the FileInputStream object
explicitly, the file handle might be monitored only by garbage collector.
This can be a problem in case that the limit count of open files is set on a
system. Every request can open a jsp stream, so the open file count increases.

I don't think it's efficient to open the stream to check whether the jsp should
be reloaded or not.

Thanks. (My opinion could be based on misunderstandings.)

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to