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 0d23722f58 Remove via Iterator since collection is fail-fast
(ArrayList)
0d23722f58 is described below
commit 0d23722f585ce9092dbd11ef76760236bf0381c4
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 1ef73559a2..17151e4824 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -1057,9 +1057,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]