This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new 9f94deb Fix NPE if exception occurs during destruction of Servlet -
BZ 65940
9f94deb is described below
commit 9f94deb0d6b626441ab388e22be4ef43a2d1368f
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Mar 9 09:22:34 2022 +0000
Fix NPE if exception occurs during destruction of Servlet - BZ 65940
https://bz.apache.org/bugzilla/show_bug.cgi?id=65940
Also includes a trivial optimisation
---
java/org/apache/catalina/core/StandardWrapper.java | 4 ++--
webapps/docs/changelog.xml | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/core/StandardWrapper.java
b/java/org/apache/catalina/core/StandardWrapper.java
index 2388f3d..a7ebe83 100644
--- a/java/org/apache/catalina/core/StandardWrapper.java
+++ b/java/org/apache/catalina/core/StandardWrapper.java
@@ -1337,7 +1337,6 @@ public class StandardWrapper extends ContainerBase
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
ExceptionUtils.handleThrowable(t);
- instance = null;
instancePool = null;
nInstances = 0;
fireContainerEvent("unload", this);
@@ -1366,12 +1365,13 @@ public class StandardWrapper extends ContainerBase
}
}
}
+ instance = null;
+ instanceInitialized = false;
}
}
// Deregister the destroyed instance
instance = null;
- instanceInitialized = false;
if (isJspServlet && jspMonitorON != null ) {
Registry.getRegistry(null, null).unregisterComponent(jspMonitorON);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index d50cfa0..fed2b97 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -117,6 +117,10 @@
original request cannot be mapped to a context. This typically happens
when no ROOT context is defined. Pull request by elkman. (markt)
</fix>
+ <fix>
+ <bug>65940</bug>: Fix <code>NullPointerException</code> if an exception
+ occurs during the destruction of a Servlet. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]