This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
     new 8231c5a  Fix another intermittent failure. Same root cause as the BZ 
49567 test
8231c5a is described below

commit 8231c5a692e3a85956ffdf3c7fa3a521c502054a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Mar 5 10:11:59 2020 +0000

    Fix another intermittent failure. Same root cause as the BZ 49567 test
---
 test/org/apache/catalina/core/TestAsyncContextImpl.java | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/catalina/core/TestAsyncContextImpl.java 
b/test/org/apache/catalina/core/TestAsyncContextImpl.java
index 565b93c..2f7ba07 100644
--- a/test/org/apache/catalina/core/TestAsyncContextImpl.java
+++ b/test/org/apache/catalina/core/TestAsyncContextImpl.java
@@ -283,7 +283,21 @@ public class TestAsyncContextImpl extends TomcatBaseTest {
                         resp.getWriter().print("OK");
                         req.getAsyncContext().complete();
                         result.append('5');
-                        result.append(req.isAsyncStarted());
+                        try {
+                            // Once complete() has been called on a
+                            // non-container thread it is not safe to
+                            // continue to use the request object as it
+                            // may be recycled at any point. Normally
+                            // there is enough time for this call to
+                            // complete but not always. If this call
+                            // fails in Tomcat an NPE will result so
+                            // handle this here with a hack. What we are
+                            // really checking here is that it does not
+                            // return true.
+                            result.append(req.isAsyncStarted());
+                        } catch (NullPointerException npe) {
+                            result.append("false");
+                        }
                         done = true;
                     } catch (InterruptedException e) {
                         result.append(e);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to