You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Phil Hanna <Ph...@sas.com> on 2000/08/04 12:46:45 UTC

[Patch] fix for Bug #7 - org.apache.tomcat.core.ServletWrapper - UnavailableException being ignored

Throwing a permanent UnavailableException from a servlet's init() method should prevent requests from being serviced, but it does not.  The org.apache.tomcat.core.ServletWrapper doInit() method does not take into account that getUnavailableSeconds() returns -1 for a permanent UnavailableException.

My fix applies to the service() method.  It already checks for the exception and retries if the (temporary) unavailable time limit has expired.  I added code to force a return with initialized=false if the exception is permanent.

BTW, I posted this as a comment to BugRat bug 7.  Is that the appropriate place to post a fix?  I wasn't sure, so I posted it here as well.

--- ServletWrapper.original Tue Aug 01 03:23:30 2000
+++ ServletWrapper.java Fri Aug 04 06:12:23 2000
@@ -353,6 +353,12 @@
  }
 
  if( unavailable!=null  ) {
+  // Don't load at all if permanently unavailable
+  if (((UnavailableException) unavailable).getUnavailableSeconds() == -1) {
+   initialized = false;
+   return;
+  }
+
      // Don't load if Unavailable timer is in place
      if(  stillUnavailable() ) {
   handleUnavailable( req, res );