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 b970fd9262 Ensure access to children is always sync'd - identified by
Coverity
b970fd9262 is described below
commit b970fd9262b62aa67c875ef6c2f79a9ae162e9fc
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Aug 10 14:08:30 2023 +0100
Ensure access to children is always sync'd - identified by Coverity
---
java/org/apache/catalina/core/ContainerBase.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/catalina/core/ContainerBase.java
b/java/org/apache/catalina/core/ContainerBase.java
index 610baf054c..7c2a883eb3 100644
--- a/java/org/apache/catalina/core/ContainerBase.java
+++ b/java/org/apache/catalina/core/ContainerBase.java
@@ -1206,11 +1206,15 @@ public abstract class ContainerBase extends
LifecycleMBeanBase implements Contai
return keyProperties.toString();
}
+
public ObjectName[] getChildren() {
- List<ObjectName> names = new ArrayList<>(children.size());
- for (Container next : children.values()) {
- if (next instanceof ContainerBase) {
- names.add(((ContainerBase) next).getObjectName());
+ List<ObjectName> names;
+ synchronized (children) {
+ names = new ArrayList<>(children.size());
+ for (Container next : children.values()) {
+ if (next instanceof ContainerBase) {
+ names.add(((ContainerBase) next).getObjectName());
+ }
}
}
return names.toArray(new ObjectName[0]);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]