From: markt Date: Wed, 30 Mar 2011 12:26:39 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50991 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2f6b0d6796266719497883515642fc4d7367a168;p=tomcat7.0 Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50991 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 --- diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index ab00d8afa..97cbdc08d 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -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(); diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 2df4ab1b8..3c73025c6 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -110,6 +110,11 @@ Also prevent the DefaultServlet from setting a content length header since this too cannot be reliably determined. (markt) + + 50991: Fix regression in fix for 25060 that called + close on a JNDI resource while it was still available to the + application. (markt) +