This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new 102b61d410 Ensure access to children is always sync'd - identified by Coverity 102b61d410 is described below commit 102b61d41042ab2f220ae5e6650ae2a27ac6d428 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org