Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50991
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 30 Mar 2011 12:26:39 +0000 (12:26 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 30 Mar 2011 12:26:39 +0000 (12:26 +0000)
Stop the resources after they have been unbound rather than before

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1086928 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/StandardContext.java
webapps/docs/changelog.xml

index ab00d8a..97cbdc0 100644 (file)
@@ -5393,10 +5393,6 @@ public class StandardContext extends ContainerBase
         // Binding thread
         ClassLoader oldCCL = bindThread();
 
-        if (namingResources != null) {
-            namingResources.stop();
-        }
-        
         try {
 
             // Stop our child containers, if any
@@ -5443,6 +5439,13 @@ public class StandardContext extends ContainerBase
 
             fireLifecycleEvent(Lifecycle.CONFIGURE_STOP_EVENT, null);
 
+            // JNDI resources are unbound in CONFIGURE_STOP_EVENT so it is now
+            // safe to stop the resources which will trigger the close method if
+            // present
+            if (namingResources != null) {
+                namingResources.stop();
+            }
+            
             // Stop the Valves in our pipeline (including the basic), if any
             if (pipeline instanceof Lifecycle) {
                 ((Lifecycle) pipeline).stop();
index 2df4ab1..3c73025 100644 (file)
         Also prevent the DefaultServlet from setting a content length header
         since this too cannot be reliably determined. (markt)
       </fix>
+      <fix>
+        <bug>50991</bug>: Fix regression in fix for <bug>25060</bug> that called
+        close on a JNDI resource while it was still available to the
+        application. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">