This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 9af43f9980 Fix test failure. Throw ISE rather than NPE if AsyncContext
is recycled
9af43f9980 is described below
commit 9af43f9980ad9e1f6f21afdee712ee26474d44fa
Author: Mark Thomas <[email protected]>
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 21a832bc13..52bddba3b9 100644
--- a/java/org/apache/catalina/core/AsyncContextImpl.java
+++ b/java/org/apache/catalina/core/AsyncContextImpl.java
@@ -292,6 +292,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 c79852f6ea..538bd09ad0 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -118,6 +118,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: [email protected]
For additional commands, e-mail: [email protected]