tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java
Date Fri, 06 Oct 2000 00:50:30 GMT
craigmcc    00/10/05 17:50:30

  Modified:    catalina/src/share/org/apache/catalina/core
                        ApplicationDispatcher.java
  Log:
  Correctly rethrow IOExceptions and ServletExceptions (which may also be
  wrapping unchecked errors) thrown by servlets that are called via
  RequestDispatcher.forward() or RequestDispatcher.include().
  
  Revision  Changes    Path
  1.6       +25 -23    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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ApplicationDispatcher.java	2000/10/05 19:38:00	1.5
  +++ ApplicationDispatcher.java	2000/10/06 00:50:30	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
1.5 2000/10/05 19:38:00 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/10/05 19:38:00 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
1.6 2000/10/06 00:50:30 craigmcc Exp $
  + * $Revision: 1.6 $
  + * $Date: 2000/10/06 00:50:30 $
    *
    * ====================================================================
    *
  @@ -94,7 +94,7 @@
    * <code>javax.servlet.ServletResponseWrapper</code>.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2000/10/05 19:38:00 $
  + * @version $Revision: 1.6 $ $Date: 2000/10/06 00:50:30 $
    */
   
   final class ApplicationDispatcher
  @@ -467,7 +467,8 @@
   	if (response instanceof HttpServletResponse)
   	    hresponse = (HttpServletResponse) response;
   	Servlet servlet = null;
  -	Throwable throwable = null;
  +        IOException ioException = null;
  +        ServletException servletException = null;
   	boolean unavailable = false;
   
   	// Check for the servlet being marked unavailable
  @@ -496,14 +497,14 @@
   	} catch (ServletException e) {
   	    log(sm.getString("applicationDispatcher.allocateException",
   			     wrapper.getName()), e);
  -	    throwable = e;
  -	    // exception(request, response, e);
  +	    servletException = e;
   	    servlet = null;
   	} catch (Throwable e) {
   	    log(sm.getString("applicationDispatcher.allocateException",
   			     wrapper.getName()), e);
  -	    throwable = e;
  -	    // exception(request, response, e);
  +	    servletException = new ServletException
  +                (sm.getString("applicationDispatcher.allocateException",
  +                              wrapper.getName()), e);
   	    servlet = null;
   	}
   
  @@ -519,23 +520,22 @@
   	} catch (IOException e) {
   	    log(sm.getString("applicationDispatcher.serviceException",
   			     wrapper.getName()), e);
  -	    throwable = e;
  +	    ioException = e;
   	} catch (UnavailableException e) {
   	    log(sm.getString("applicationDispatcher.serviceException",
   			     wrapper.getName()), e);
  -	    throwable = e;
  -	    // exception(request, response, e);
  +	    servletException = e;
   	    wrapper.unavailable(e);
   	} catch (ServletException e) {
   	    log(sm.getString("applicationDispatcher.serviceException",
   			     wrapper.getName()), e);
  -	    throwable = e;
  -	    // exception(request, response, e);
  +	    servletException = e;
   	} catch (Throwable e) {
   	    log(sm.getString("applicationDispatcher.serviceException",
   			     wrapper.getName()), e);
  -	    throwable = e;
  -	    // exception(request, response, e);
  +            servletException = new ServletException
  +                (sm.getString("applicationDispatcher.serviceException",
  +                              wrapper.getName()), e);
   	}
   
   	// Deallocate the allocated servlet instance
  @@ -545,18 +545,20 @@
   	} catch (ServletException e) {
   	    log(sm.getString("applicationDispatcher.deallocateException",
   			     wrapper.getName()), e);
  -	    throwable = e;
  -	    // exception(request, response, e);
  +	    servletException = e;
   	} catch (Throwable e) {
   	    log(sm.getString("applicationDispatcher.deallocateException",
   			     wrapper.getName()), e);
  -	    throwable = e;
  -	    // exception(request, response, e);
  +            servletException = new ServletException
  +                (sm.getString("applicationDispatcher.deallocateException",
  +                              wrapper.getName()), e);
   	}
   
  -	// Generate a response for the generated HTTP status and message
  -	// if (throwable == null)
  -	//     status(request, response);
  +        // Rethrow an exception if one was thrown by the invoked servlet
  +        if (ioException != null)
  +            throw ioException;
  +        if (servletException != null)
  +            throw servletException;
   
       }
   
  
  
  

Mime
View raw message