--- jakarta-tomcat-5.0.30-src/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java 2004-11-24 16:55:09.000000000 +0000 +++ jakarta-tomcat-5.0.30-src/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java 2006-03-18 21:50:43.000000000 +0000 @@ -4219,17 +4219,18 @@ // Binding thread ClassLoader oldCCL = bindThread(); - // Standard container startup - if (log.isDebugEnabled()) - log.debug("Processing standard container startup"); + boolean mainOk = false; - if (ok) { + try { - boolean mainOk = false; - try { + if (ok) { started = true; + // Standard container startup + if (log.isDebugEnabled()) + log.debug("Processing standard container startup"); + // Start our subordinate components, if any if ((loader != null) && (loader instanceof Lifecycle)) ((Lifecycle) loader).start(); @@ -4279,17 +4280,18 @@ mainOk = true; - } finally { - // Unbinding thread - unbindThread(oldCCL); - if (!mainOk) { - // An exception occurred - // Register with JMX anyway, to allow management - registerJMX(); - } } + } finally { + // Unbinding thread + unbindThread(oldCCL); + if (!mainOk) { + // An exception occurred + // Register with JMX anyway, to allow management + registerJMX(); + } } + if (!getConfigured()) { log.error( "Error getConfigured"); ok = false; @@ -4306,39 +4308,43 @@ // Binding thread oldCCL = bindThread(); - // Create context attributes that will be required - if (ok) { - if (log.isDebugEnabled()) - log.debug("Posting standard context attributes"); - postWelcomeFiles(); - } + try { - if (ok) { - // Notify our interested LifecycleListeners - lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); - } + // Create context attributes that will be required + if (ok) { + if (log.isDebugEnabled()) + log.debug("Posting standard context attributes"); + postWelcomeFiles(); + } - // Configure and call application event listeners and filters - if (ok) { - if (!listenerStart()) { - log.error( "Error listenerStart"); - ok = false; + if (ok) { + // Notify our interested LifecycleListeners + lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); } - } - if (ok) { - if (!filterStart()) { - log.error( "Error filterStart"); - ok = false; + + // Configure and call application event listeners and filters + if (ok) { + if (!listenerStart()) { + log.error( "Error listenerStart"); + ok = false; + } + } + if (ok) { + if (!filterStart()) { + log.error( "Error filterStart"); + ok = false; + } } - } - // Load and initialize all "load on startup" servlets - if (ok) { - loadOnStartup(findChildren()); - } + // Load and initialize all "load on startup" servlets + if (ok) { + loadOnStartup(findChildren()); + } - // Unbinding thread - unbindThread(oldCCL); + } finally { + // Unbinding thread + unbindThread(oldCCL); + } // Set available status depending upon startup success if (ok) { @@ -4501,34 +4507,34 @@ // Binding thread ClassLoader oldCCL = bindThread(); - // Stop our filters - filterStop(); + try { - // Stop ContainerBackgroundProcessor thread - super.threadStop(); + // Stop our filters + filterStop(); - if ((manager != null) && (manager instanceof Lifecycle)) { - ((Lifecycle) manager).stop(); - } + // Stop ContainerBackgroundProcessor thread + super.threadStop(); - // Stop our application listeners - // I think this should be after the children are stopped, - // because now servlet destroy() is called AFTER - // contextDestroyed, which is a Spec violation as noted - // Bugzilla 30762. - // listenerStop(); + if ((manager != null) && (manager instanceof Lifecycle)) { + ((Lifecycle) manager).stop(); + } - // Finalize our character set mapper - setCharsetMapper(null); + // Stop our application listeners + // I think this should be after the children are stopped, + // because now servlet destroy() is called AFTER + // contextDestroyed, which is a Spec violation as noted + // Bugzilla 30762. + // listenerStop(); - // Normal container shutdown processing - if (log.isDebugEnabled()) - log.debug("Processing standard container shutdown"); - // Notify our interested LifecycleListeners - lifecycle.fireLifecycleEvent(STOP_EVENT, null); - started = false; + // Finalize our character set mapper + setCharsetMapper(null); - try { + // Normal container shutdown processing + if (log.isDebugEnabled()) + log.debug("Processing standard container shutdown"); + // Notify our interested LifecycleListeners + lifecycle.fireLifecycleEvent(STOP_EVENT, null); + started = false; // Stop the Valves in our pipeline (including the basic), if any if (pipeline instanceof Lifecycle) {