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

markt-asf 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 517c4f7c53 Fix intermittent test failure
517c4f7c53 is described below

commit 517c4f7c53f0e2231b17bc7845d3954d16d6448d
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Nov 9 14:34:28 2026 +0000

    Fix intermittent test failure
---
 .../apache/catalina/startup/TomcatBaseTest.java    | 24 +++++++++++++---------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/test/org/apache/catalina/startup/TomcatBaseTest.java 
b/test/org/apache/catalina/startup/TomcatBaseTest.java
index 8278a86ca8..0e31b46ccc 100644
--- a/test/org/apache/catalina/startup/TomcatBaseTest.java
+++ b/test/org/apache/catalina/startup/TomcatBaseTest.java
@@ -1001,22 +1001,26 @@ public abstract class TomcatBaseTest extends 
LoggingBaseTest {
         }
 
         public boolean containsText(CharSequence s) {
-            for (LogRecord record : logRecords) {
-                if (record.getMessage().contains(s)) {
-                    return true;
+            synchronized (logRecords) {
+                for (LogRecord record : logRecords) {
+                    if (record.getMessage().contains(s)) {
+                        return true;
+                    }
                 }
+                return false;
             }
-            return false;
         }
         public boolean hasException(Class<? extends Throwable> type) {
-            for (LogRecord record : logRecords) {
-                Throwable t = record.getThrown();
-                while (t != null) {
-                    if (type.isInstance(t)) {return true;}
-                    t = t.getCause();
+            synchronized (logRecords) {
+                for (LogRecord record : logRecords) {
+                    Throwable t = record.getThrown();
+                    while (t != null) {
+                        if (type.isInstance(t)) {return true;}
+                        t = t.getCause();
+                    }
                 }
+                return false;
             }
-            return false;
         }
 
         @Override


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to