larryi 00/11/09 06:11:28
Modified: src/share/org/apache/tomcat/core Tag: tomcat_32 Handler.java
Log:
Since exceptions are now being propagated, changes were need to
properly handle exceptions thrown during initialization.
Probably need to review how much is going in the log due to exception
propagation. It might be a bit much.
Revision Changes Path
No revision
No revision
1.7.2.5 +22 -28 jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java
Index: Handler.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java,v
retrieving revision 1.7.2.4
retrieving revision 1.7.2.5
diff -u -r1.7.2.4 -r1.7.2.5
--- Handler.java 2000/11/05 03:55:50 1.7.2.4
+++ Handler.java 2000/11/09 14:11:27 1.7.2.5
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java,v 1.7.2.4
2000/11/05 03:55:50 craigmcc Exp $
- * $Revision: 1.7.2.4 $
- * $Date: 2000/11/05 03:55:50 $
+ * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java,v 1.7.2.5
2000/11/09 14:11:27 larryi Exp $
+ * $Revision: 1.7.2.5 $
+ * $Date: 2000/11/09 14:11:27 $
*
* ====================================================================
*
@@ -222,6 +222,7 @@
} catch( Exception ex ) {
initialized=false;
+ throw ex;
}
}
@@ -251,26 +252,22 @@
if( ! initialized ) {
try {
init();
- if ( ! initialized )
- return; // return if still not initialied
} catch( Exception ex ) {
initialized=false;
if( ex instanceof ClassNotFoundException ) {
contextM.handleStatus( req, res, 404);
return;
}
+ // handle error, does nothing if already handled
+ contextM.handleError( req, res, ex);
+ // rethrow the exception
context.log("Exception in init " + ex.getMessage(), ex );
- if (res.isIncluded()) {
- if (ex instanceof IOException)
- throw (IOException) ex;
- else if (ex instanceof ServletException)
- throw (ServletException) ex;
- else
- throw new ServletException
- ("Included Servlet Init Exception", ex);
- }
- contextM.handleError( req, res, ex );
- return;
+ if (ex instanceof IOException)
+ throw (IOException) ex;
+ else if (ex instanceof ServletException)
+ throw (ServletException) ex;
+ else
+ throw new ServletException("Servlet Init Exception", ex);
}
}
}
@@ -291,21 +288,18 @@
contextM.doPostService( req, res );
if( t==null ) return;
-
- // Rethrow an exception if we are inside an include
- if (res.isIncluded()) {
- context.log("Rethrowing included exception: " + t);
- if (t instanceof IOException)
- throw (IOException) t;
- else if (t instanceof ServletException)
- throw (ServletException) t;
- else
- throw new ServletException("Included Servlet Exception", t);
- }
- // Otherwise, handle a top-level error as usual
+ // handle error, does nothing if already handled
contextM.handleError( req, res, t );
+ // rethrow the exception
+ context.log("Rethrowing doService exception: " + t);
+ if (t instanceof IOException)
+ throw (IOException) t;
+ else if (t instanceof ServletException)
+ throw (ServletException) t;
+ else
+ throw new ServletException("Servlet Exception", t);
}
// protected void handleError( Request req, Response res, Throwable t) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]