This is an automated email from the ASF dual-hosted git repository.
markt 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 7e9ce3880b Remove via Iterator since collection is fail-fast
(ArrayList)
7e9ce3880b is described below
commit 7e9ce3880b66f7fc3bcaf79c751a1808df10843c
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jul 5 18:30:10 2023 +0100
Remove via Iterator since collection is fail-fast (ArrayList)
Identified by Coverity Scan
---
java/org/apache/catalina/servlets/WebdavServlet.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java
b/java/org/apache/catalina/servlets/WebdavServlet.java
index c9be178963..bd75fc7760 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -1056,9 +1056,11 @@ public class WebdavServlet extends DefaultServlet {
// Checking if a child resource of this collection is
// already locked
List<String> lockPaths = new ArrayList<>();
- for (LockInfo currentLock : collectionLocks) {
+ Iterator<LockInfo> collectionLocksIterator =
collectionLocks.iterator();
+ while (collectionLocksIterator.hasNext()) {
+ LockInfo currentLock = collectionLocksIterator.next();
if (currentLock.hasExpired()) {
- collectionLocks.remove(currentLock);
+ collectionLocksIterator.remove();
continue;
}
if (currentLock.path.startsWith(lock.path) &&
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]