tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java
Date Tue, 06 Feb 2001 02:39:43 GMT
craigmcc    01/02/05 18:39:43

  Modified:    catalina/src/share/org/apache/catalina/core
                        ApplicationDispatcher.java
  Log:
  Change the method used to propogate exceptions thrown by included or
  forwarded-to servlets to conform to Section 8.5 of Servlet 2.3 (Proposed
  Final Draft) Specification.  Now, run time exceptions will be propogated
  "as is", rather than being wrapped in a ServletException.
  
  Unit tests for the tester suite are forthcoming.
  
  Revision  Changes    Path
  1.13      +19 -74    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
  
  Index: ApplicationDispatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ApplicationDispatcher.java	2001/02/04 00:49:56	1.12
  +++ ApplicationDispatcher.java	2001/02/06 02:39:43	1.13
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
1.12 2001/02/04 00:49:56 glenn Exp $
  - * $Revision: 1.12 $
  - * $Date: 2001/02/04 00:49:56 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
1.13 2001/02/06 02:39:43 craigmcc Exp $
  + * $Revision: 1.13 $
  + * $Date: 2001/02/06 02:39:43 $
    *
    * ====================================================================
    *
  @@ -97,7 +97,7 @@
    * <code>javax.servlet.ServletResponseWrapper</code>.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.12 $ $Date: 2001/02/04 00:49:56 $
  + * @version $Revision: 1.13 $ $Date: 2001/02/06 02:39:43 $
    */
   
   final class ApplicationDispatcher
  @@ -235,6 +235,8 @@
   
       /**
        * Forward this request and response to another resource for processing.
  +     * Any runtime exception, IOException, or ServletException thrown by the
  +     * called servlet will be propogated to the caller.
        *
        * @param request The servlet request to be forwarded
        * @param response The servlet response to be forwarded
  @@ -283,18 +285,8 @@
   
   	    if (debug >= 1)
   		log(" Non-HTTP Forward");
  +            invoke(request, response);
   
  -	    try {
  -		invoke(request, response);
  -	    } catch (IOException e) {
  -		throw e;
  -	    } catch (ServletException e) {
  -		throw e;
  -	    } catch (Throwable t) {
  -		throw new ServletException
  -		    (sm.getString("applicationDispatcher.forward.throw"), t);
  -	    }
  -
   	}
   
   	// Handle an HTTP named dispatcher forward
  @@ -302,17 +294,7 @@
   
   	    if (debug >= 1)
   		log(" Named Dispatcher Forward");
  -
  -	    try {
  -		invoke(request, response);
  -	    } catch (IOException e) {
  -		throw e;
  -	    } catch (ServletException e) {
  -		throw e;
  -	    } catch (Throwable t) {
  -		throw new ServletException
  -		    (sm.getString("applicationDispatcher.forward.throw"), t);
  -	    }
  +            invoke(request, response);
   
   	}
   
  @@ -340,18 +322,8 @@
   		wrequest.setQueryString(queryString);
   		wrequest.mergeParameters(queryString);
   	    }
  +            invoke(wrequest, response);
   
  -	    try {
  -		invoke(wrequest, response);
  -	    } catch (IOException e) {
  -		throw e;
  -	    } catch (ServletException e) {
  -		throw e;
  -	    } catch (Throwable t) {
  -		throw new ServletException
  -		    (sm.getString("applicationDispatcher.forward.throw"), t);
  -	    }
  -
   	}
   
   	// Commit and close the response before we return
  @@ -379,6 +351,8 @@
   
       /**
        * Include the response from another resource in the current response.
  +     * Any runtime exception, IOException, or ServletException thrown by the
  +     * called servlet will be propogated to the caller.
        *
        * @param request The servlet request that is including this one
        * @param response The servlet response to be appended to
  @@ -424,18 +398,8 @@
   
   	    if (debug >= 1)
   		log(" Non-HTTP Include");
  +            invoke(request, wresponse);
   
  -	    try {
  -		invoke(request, wresponse);
  -	    } catch (IOException e) {
  -		throw e;
  -	    } catch (ServletException e) {
  -		throw e;
  -	    } catch (Throwable t) {
  -		throw new ServletException
  -		    (sm.getString("applicationDispatcher.include.throw"), t);
  -	    }
  -
   	}
   
   	// Handle an HTTP named dispatcher include
  @@ -447,18 +411,8 @@
   	    ApplicationHttpRequest wrequest =
   		new ApplicationHttpRequest((HttpServletRequest) request);
               wrequest.setAttribute(Globals.NAMED_DISPATCHER_ATTR, name);
  +            invoke(wrequest, wresponse);
   
  -	    try {
  -		invoke(wrequest, wresponse);
  -	    } catch (IOException e) {
  -		throw e;
  -	    } catch (ServletException e) {
  -		throw e;
  -	    } catch (Throwable t) {
  -		throw new ServletException
  -		    (sm.getString("applicationDispatcher.include.throw"), t);
  -	    }
  -
   	}
   
   	// Handle an HTTP path based include
  @@ -493,18 +447,8 @@
   		wrequest.setAttribute(Globals.QUERY_STRING_ATTR,
   				      queryString);
   		wrequest.mergeParameters(queryString);
  -	    }
  -
  -	    try {
  -		invoke(wrequest, wresponse);
  -	    } catch (IOException e) {
  -		throw e;
  -	    } catch (ServletException e) {
  -		throw e;
  -	    } catch (Throwable t) {
  -		throw new ServletException
  -		    (sm.getString("applicationDispatcher.include.throw"), t);
   	    }
  +            invoke(wrequest, wresponse);
   
   	}
   
  @@ -542,6 +486,7 @@
   	Servlet servlet = null;
           IOException ioException = null;
           ServletException servletException = null;
  +	RuntimeException runtimeException = null;
   	boolean unavailable = false;
   
   	// Check for the servlet being marked unavailable
  @@ -603,12 +548,10 @@
   	    log(sm.getString("applicationDispatcher.serviceException",
   			     wrapper.getName()), e);
   	    servletException = e;
  -	} catch (Throwable e) {
  +	} catch (RuntimeException e) {
   	    log(sm.getString("applicationDispatcher.serviceException",
   			     wrapper.getName()), e);
  -            servletException = new ServletException
  -                (sm.getString("applicationDispatcher.serviceException",
  -                              wrapper.getName()), e);
  +            runtimeException = e;
   	}
   
   	// Deallocate the allocated servlet instance
  @@ -632,6 +575,8 @@
               throw ioException;
           if (servletException != null)
               throw servletException;
  +	if (runtimeException != null)
  +	    throw runtimeException;
   
       }
   
  
  
  

Mime
View raw message