This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 0605a9acaa Fix intermittent test failure
0605a9acaa is described below
commit 0605a9acaa802a4cba48b1facf0b4e12ccd37440
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 10b0285c4c..2e1e154675 100644
--- a/test/org/apache/catalina/startup/TomcatBaseTest.java
+++ b/test/org/apache/catalina/startup/TomcatBaseTest.java
@@ -994,22 +994,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]