You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2003/05/13 21:36:38 UTC

cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime JspRuntimeLibrary.java

luehe       2003/05/13 12:36:37

  Modified:    jasper2/src/share/org/apache/jasper/runtime
                        JspRuntimeLibrary.java
  Log:
  Fixed Bugtraq 4861868: Exceptions not propagated to JSP error pages
  
  Reviewed by: Jeanfrancois Arcand
  
  Revision  Changes    Path
  1.22      +17 -3     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java
  
  Index: JspRuntimeLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- JspRuntimeLibrary.java	30 Apr 2003 17:18:42 -0000	1.21
  +++ JspRuntimeLibrary.java	13 May 2003 19:36:37 -0000	1.22
  @@ -139,11 +139,25 @@
        * Returns the value of the javax.servlet.error.exception request
        * attribute value, if present, otherwise the value of the
        * javax.servlet.jsp.jspException request attribute value.
  +     *
  +     * This method is called at the beginning of the generated servlet code
  +     * for a JSP error page, when the "exception" implicit scripting language
  +     * variable is initialized.
        */
       public static Throwable getThrowable(ServletRequest request) {
   	Throwable error = (Throwable) request.getAttribute(SERVLET_EXCEPTION);
   	if (error == null) {
   	    error = (Throwable) request.getAttribute(JSP_EXCEPTION);
  +	    if (error != null) {
  +		/*
  +		 * The only place that sets JSP_EXCEPTION is
  +		 * PageContextImpl.handlePageException(). It really should set
  +		 * SERVLET_EXCEPTION, but that would interfere with the 
  +		 * ErrorReportValve. Therefore, if JSP_EXCEPTION is set, we
  +		 * need to set SERVLET_EXCEPTION.
  +		 */
  +		request.setAttribute(SERVLET_EXCEPTION, error);
  +	    }
   	}
   
   	return error;
  
  
  

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