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

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


The following commit(s) were added to refs/heads/main by this push:
     new 9004b5a643 Fix intermittent test failure
9004b5a643 is described below

commit 9004b5a64364d4b1a33c4672a6a73e7ef6aecbbe
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 cd885e5620..bd64fb40bd 100644
--- a/test/org/apache/catalina/startup/TomcatBaseTest.java
+++ b/test/org/apache/catalina/startup/TomcatBaseTest.java
@@ -991,22 +991,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