Skip to content

Commit 43a6746

Browse files
committedJun 7, 2024
8307091: A few client tests intermittently throw ConcurrentModificationException
Backport-of: 465bdd9e416cacc6cc7dd91a29cc84adf2eaf1ed
1 parent ce19e61 commit 43a6746

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed
 

‎src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java

+16-10
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,15 @@ public DoChangeContents call() {
360360
break;
361361
}
362362
}
363-
if (start >= 0 && end > start
364-
&& newFileCache.subList(end, newSize).equals(fileCache.subList(start, oldSize))) {
365-
if (loadThread.isInterrupted()) {
366-
return null;
363+
364+
if (start >= 0 && end > start) {
365+
List<File> listStart_OldSize = new Vector<>(fileCache.subList(start, oldSize));
366+
if (newFileCache.subList(end, newSize).equals(listStart_OldSize)) {
367+
if (loadThread.isInterrupted()) {
368+
return null;
369+
}
370+
return new DoChangeContents(newFileCache.subList(start, end), start, null, 0, fid);
367371
}
368-
return new DoChangeContents(newFileCache.subList(start, end), start, null, 0, fid);
369372
}
370373
} else if (newSize < oldSize) {
371374
//see if interval is removed
@@ -378,12 +381,15 @@ public DoChangeContents call() {
378381
break;
379382
}
380383
}
381-
if (start >= 0 && end > start
382-
&& fileCache.subList(end, oldSize).equals(newFileCache.subList(start, newSize))) {
383-
if (loadThread.isInterrupted()) {
384-
return null;
384+
385+
if (start >= 0 && end > start) {
386+
List<File> listEnd_OldSize = new Vector<>(fileCache.subList(end, oldSize));
387+
if (listEnd_OldSize.equals(newFileCache.subList(start, newSize))) {
388+
if (loadThread.isInterrupted()) {
389+
return null;
390+
}
391+
return new DoChangeContents(null, 0, new Vector<>(fileCache.subList(start, end)), start, fid);
385392
}
386-
return new DoChangeContents(null, 0, new Vector<>(fileCache.subList(start, end)), start, fid);
387393
}
388394
}
389395
if (!fileCache.equals(newFileCache)) {

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Jun 7, 2024

@openjdk-notifier[bot]
Please sign in to comment.