You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/02/17 08:08:18 UTC

cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade Servlet22Interceptor.java

costin      01/02/16 23:08:18

  Modified:    src/facade22/org/apache/tomcat/facade
                        Servlet22Interceptor.java
  Log:
  Fix for the destroy() bug reported by JDNovotny@lbl.gov.
  
  Now both jspDestroy() and destroy() should work ( please check the next
  nigthly build ).
  
  The fix is specific to 3.3.
  
  ( BTW, I can try to do a fix in 3.2.x, but if the bug is present in 3.2.1
  and it's not a regression I would rather fix other bugs in 3.3 )
  
  The problem was that the servlet was removed from context, and then
  destroy() did nothing ( it checks if the servlet is initialized - when
  it's removed from the context the servlet is no longer in a "stable"
  state, it's orphan )
  
  Revision  Changes    Path
  1.11      +8 -2      jakarta-tomcat/src/facade22/org/apache/tomcat/facade/Servlet22Interceptor.java
  
  Index: Servlet22Interceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/Servlet22Interceptor.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Servlet22Interceptor.java	2001/01/01 00:17:22	1.10
  +++ Servlet22Interceptor.java	2001/02/17 07:08:18	1.11
  @@ -116,14 +116,20 @@
   	while (enum.hasMoreElements()) {
   	    String key = (String)enum.nextElement();
   	    Handler wrapper = ctx.getServletByName( key );
  -	    if( ! (wrapper instanceof ServletHandler) )
  +	    
  +	    if( ! (wrapper instanceof ServletHandler) ) 
   		continue;
  -	    ctx.removeServletByName( key );
  +
   	    try {
   		((ServletHandler)wrapper).destroy();
   	    } catch(Exception ex ) {
   		ctx.log( "Error in destroy ", ex);
   	    }
  +	    // remove the context after it is destroyed.
  +	    // remove will "un-declare" the servlet
  +	    // After this the servlet will be in STATE_NEW, and can
  +	    // be reused.
  +	    ctx.removeServletByName( key );
   	}
       }