From: markt Date: Thu, 24 Feb 2011 17:25:38 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50826 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2fe4b3c7a6a6bd3dcc438cf71af7ef5f8ce0f551;p=tomcat7.0 Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50826 Avoid IAE when Tomcat instance is destroyed without every being started. Add a test case for this. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1074225 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index b16bde713..4291d3978 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -5486,11 +5486,15 @@ public class StandardContext extends ContainerBase ((Lifecycle) loader).destroy(); } - // Send j2ee.object.deleted notification - Notification notification = - new Notification("j2ee.object.deleted", this.getObjectName(), - sequenceNumber.getAndIncrement()); - broadcaster.sendNotification(notification); + // If in state NEW when destroy is called, the object name will never + // have been set so the notification can't be created + if (getObjectName() != null) { + // Send j2ee.object.deleted notification + Notification notification = + new Notification("j2ee.object.deleted", this.getObjectName(), + sequenceNumber.getAndIncrement()); + broadcaster.sendNotification(notification); + } if (namingResources != null) { namingResources.destroy(); diff --git a/test/org/apache/catalina/startup/TestTomcat.java b/test/org/apache/catalina/startup/TestTomcat.java index 13664885c..1d4ed23ce 100644 --- a/test/org/apache/catalina/startup/TestTomcat.java +++ b/test/org/apache/catalina/startup/TestTomcat.java @@ -326,4 +326,21 @@ public class TestTomcat extends TomcatBaseTest { assertTrue(res.toString().contains(" Web crawlers can trigger the creation of many thousands of sessions as they crawl a site which may result in significant memory consumption. - Thw new Crawler Session Manager Valve ensures that crawlers are + The new Crawler Session Manager Valve ensures that crawlers are associated with a single session - just like normal users - regardless of whether or not they provide a session token with their requests. (markt) @@ -142,6 +142,11 @@ Don't attempt to start NamingResources for Contexts multiple times. (markt) + + 50826: Avoid IllegalArgumentException if an + embedded Tomcat instance that includes at least one Context is destroyed + without ever being started. (markt) +