You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/08/10 13:09:33 UTC
[tomcat] branch 9.0.x updated: Ensure access to children is always sync'd - identified by Coverity
This is an automated email from the ASF dual-hosted git repository.
markt 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 ad88bb6b13 Ensure access to children is always sync'd - identified by Coverity
ad88bb6b13 is described below
commit ad88bb6b13a0498204851bda5f65f6ca715c0ae4
Author: Mark Thomas <ma...@apache.org>
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 7c30072d68..c9f51acc6e 100644
--- a/java/org/apache/catalina/core/ContainerBase.java
+++ b/java/org/apache/catalina/core/ContainerBase.java
@@ -1196,11 +1196,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(next.getObjectName());
+ List<ObjectName> names;
+ synchronized (children) {
+ names = new ArrayList<>(children.size());
+ for (Container next : children.values()) {
+ if (next instanceof ContainerBase) {
+ names.add(next.getObjectName());
+ }
}
}
return names.toArray(new ObjectName[0]);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org