costin      01/02/05 22:46:29

  Modified:    src/share/org/apache/tomcat/modules/generators
                        ErrorHandler.java
  Log:
  Fixes for the error handling. More debugging ( maybe we'll need it again )
  
  Revision  Changes    Path
  1.6       +24 -13    
jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/ErrorHandler.java
  
  Index: ErrorHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/ErrorHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ErrorHandler.java 2001/01/31 01:56:46     1.5
  +++ ErrorHandler.java 2001/02/06 06:46:29     1.6
  @@ -86,16 +86,9 @@
        showDebugInfo=b;
       }
   
  -    public void engineInit( ContextManager cm )
  -     throws TomcatException
  -    {
  +    public void engineInit(ContextManager cm ) {
       }
       
  -    public void addContext( ContextManager cm, Context ctx)
  -     throws TomcatException
  -    {
  -    }
  -
       /** Add default error handlers
        */
       public void contextInit( Context ctx)
  @@ -131,6 +124,8 @@
        ctx.addErrorPage( "301", "tomcat.redirectHandler");
        ctx.addServlet( new NotFoundHandler(this, showDebugInfo));
        ctx.addErrorPage( "404", "tomcat.notFoundHandler");
  +
  +     if( debug > 0 ) log( "Init " + ctx + " " + showDebugInfo);
       }
   
       public int handleError( Request req, Response res, Throwable t ) {
  @@ -143,6 +138,7 @@
            ctx=rootContext;
        }
   
  +     if( debug > 0 ) log( "In error handler "  +t );
        if( t==null ) {
            handleStatusImpl( cm, ctx, req, res, res.getStatus() );
        } else {
  @@ -207,8 +203,13 @@
   
        // reset error exception
        res.setErrorException( null );
  -     errorServlet.service( req, res );
  -     Exception ex=res.getErrorException();
  +     Exception ex=null;
  +     try {
  +         errorServlet.service( req, res );
  +         ex=res.getErrorException();
  +     } catch (Exception ex1 ) {
  +         ex=ex1;
  +     }
        if( ex!=null && ! (ex instanceof IOException) ) {
            // we can ignore IOException - probably the user
            // has clicked "STOP"
  @@ -229,6 +230,9 @@
       void handleErrorImpl( ContextManager cm, Context ctx,
                          Request req, Response res , Throwable t  )
       {
  +     if( debug>0 )
  +         log( "Handle error in " + req + " " + t.getMessage() );
  +     
        /** The exception must be available to the user.
            Note that it is _WRONG_ to send the trace back to
            the client. AFAIK the trace is the _best_ debugger.
  @@ -283,11 +287,13 @@
   
        boolean isDefaultHandler = false;
        if ( errorLoop( ctx, req ) ){
  -                return;
  +         log( "Error loop for " + req + " error " + t);
  +         return;
           }
           if ( errorServlet==null) {
            errorServlet = ctx.getServletByName("tomcat.exceptionHandler");
            isDefaultHandler = true;
  +         if( debug>0 ) ctx.log( "Using default handler " + errorServlet );
        }
   
        if (errorServlet == null) {
  @@ -315,8 +321,13 @@
   
        // reset error exception
        res.setErrorException( null );
  -     errorServlet.service( req, res );
  -     Exception ex=res.getErrorException();
  +     Exception ex=null;
  +     try {
  +         errorServlet.service( req, res );
  +         ex=res.getErrorException();
  +     } catch(Exception ex1 ) {
  +         ex=ex1;
  +     }
        if( ex!=null && ! (ex instanceof IOException) ) {
            // we can ignore IOException - probably the user
            // has clicked "STOP"
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to