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 2b0ef3ca6b Fix test failure. Throw ISE rather than NPE if AsyncContext 
is recycled
2b0ef3ca6b is described below

commit 2b0ef3ca6beda6f4b9633aebcd7532fa23e60c84
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 a61ed7c0f2..34970a7c77 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 bf466d1113..b9c69bc6a4 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -139,6 +139,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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to