You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/03/09 09:23:07 UTC
[tomcat] branch main updated: Fix NPE if exception occurs during destruction of Servlet - BZ 65940
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new f4e0502 Fix NPE if exception occurs during destruction of Servlet - BZ 65940
f4e0502 is described below
commit f4e0502daf575c0f47a1bbf9eb45c4b6c85fd7e2
Author: Mark Thomas <ma...@apache.org>
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 22aef41..7f72326 100644
--- a/java/org/apache/catalina/core/StandardWrapper.java
+++ b/java/org/apache/catalina/core/StandardWrapper.java
@@ -1158,7 +1158,6 @@ public class StandardWrapper extends ContainerBase
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
ExceptionUtils.handleThrowable(t);
- instance = null;
fireContainerEvent("unload", this);
unloading = false;
throw new ServletException
@@ -1185,12 +1184,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 5f0850f..f09364a 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -122,6 +122,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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org