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 06304b52d4 Remove via Iterator since collection is fail-fast
(ArrayList)
06304b52d4 is described below
commit 06304b52d4975eb0f71a2e85ef065b68b658443e
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 dae5a470b4..457ab2a25d 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -1055,9 +1055,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]