tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JspServlet.java
Date Fri, 16 Apr 2004 21:50:49 GMT
luehe       2004/04/16 14:50:49

  Modified:    jasper2/src/share/org/apache/jasper/servlet JspServlet.java
  Log:
  Moved check for JSP resource existence into synchronized block (if JspServletWrapper==null),
to avoid having multiple threads check for it simultaneously
  
  Revision  Changes    Path
  1.35      +14 -12    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- JspServlet.java	17 Mar 2004 19:23:05 -0000	1.34
  +++ JspServlet.java	16 Apr 2004 21:50:49 -0000	1.35
  @@ -252,21 +252,23 @@
           JspServletWrapper wrapper =
               (JspServletWrapper) rctxt.getWrapper(jspUri);
           if (wrapper == null) {
  -            // First check if the requested JSP page exists, to avoid
  -            // creating unnecessary directories and files.
  -            InputStream resourceStream = context.getResourceAsStream(jspUri);
  -            if (resourceStream == null) {
  -                response.sendError(HttpServletResponse.SC_NOT_FOUND, jspUri);
  -                return;
  -            } else {
  -                try {
  -                    resourceStream.close();
  -                } catch(IOException e) { /* ignore */ }
  -            }
  -            boolean isErrorPage = exception != null;
               synchronized(this) {
                   wrapper = (JspServletWrapper) rctxt.getWrapper(jspUri);
                   if (wrapper == null) {
  +                    // Check if the requested JSP page exists, to avoid
  +                    // creating unnecessary directories and files.
  +                    InputStream resourceStream =
  +                        context.getResourceAsStream(jspUri);
  +                    if (resourceStream == null) {
  +                        response.sendError(HttpServletResponse.SC_NOT_FOUND,
  +                                           jspUri);
  +                        return;
  +                    } else {
  +                        try {
  +                            resourceStream.close();
  +                        } catch(IOException e) { /* ignore */ }
  +                    }
  +                    boolean isErrorPage = exception != null;
                       wrapper = new JspServletWrapper(config, options, jspUri,
                                                       isErrorPage, rctxt);
                       rctxt.addWrapper(jspUri,wrapper);
  
  
  

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


Mime
View raw message