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
((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();
assertTrue(res.toString().contains("<?xml version=\"1.0\" "));
}
+ public void testBug50826() throws Exception {
+ Tomcat tomcat = getTomcatInstance();
+ String contextPath = "/examples";
+
+ File appDir = new File(getBuildDirectory(), "webapps" + contextPath);
+ // app dir is relative to server home
+ tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
+
+ Exception e = null;
+ try {
+ tomcat.destroy();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ e = ex;
+ }
+ assertNull(e);
+ }
}
<add>
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)
Don't attempt to start NamingResources for Contexts multiple times.
(markt)
</fix>
+ <fix>
+ <bug>50826</bug>: Avoid <code>IllegalArgumentException</code> if an
+ embedded Tomcat instance that includes at least one Context is destroyed
+ without ever being started. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">