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 2024/03/15 19:40:07 UTC
(tomcat) 02/02: Fix test failure. Throw ISE rather than NPE if AsyncContext is recycled
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 63aea1057ed68d74e12a0e340a88b99036ecfc47
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Mar 15 19:37:48 2024 +0000
Fix test failure. Throw ISE rather than NPE if AsyncContext is recycled
Note: test failure is intermittent
---
java/org/apache/catalina/core/AsyncContextImpl.java | 2 ++
webapps/docs/changelog.xml | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/java/org/apache/catalina/core/AsyncContextImpl.java b/java/org/apache/catalina/core/AsyncContextImpl.java
index 0840b7a61e..210d29a356 100644
--- a/java/org/apache/catalina/core/AsyncContextImpl.java
+++ b/java/org/apache/catalina/core/AsyncContextImpl.java
@@ -293,6 +293,8 @@ public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
public boolean isStarted() {
AtomicBoolean result = new AtomicBoolean(false);
+ Request request = this.request;
+ check();
request.getCoyoteRequest().action(ActionCode.ASYNC_IS_STARTED, result);
return result.get();
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index d26fdd6813..96e1e9ef1a 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -161,6 +161,12 @@
build-date to the SecurityListener, and log a warning if the server
is old. (schultz)
</add>
+ <fix>
+ When using the <code>AsyncContext</code>, throw an
+ <code>IllegalStateException</code>, rather than allowing an
+ <code>NullPointerException</code>, if an attempt is made to use the
+ <code>AsyncContext</code> after it has been recycled. (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