From 504e1c4c9196d2784c5d014923f5d2c72105ace5 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Sun, 16 Jul 2023 18:10:15 +0200 Subject: [PATCH] fix(database): Fix ConcurrentModificationException during database migration (#857) --- .../laughing_train/persistence/DataBaseMigration.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github-bot/src/main/java/io/github/martinwitt/laughing_train/persistence/DataBaseMigration.java b/github-bot/src/main/java/io/github/martinwitt/laughing_train/persistence/DataBaseMigration.java index 4d7590408..f47266ed7 100644 --- a/github-bot/src/main/java/io/github/martinwitt/laughing_train/persistence/DataBaseMigration.java +++ b/github-bot/src/main/java/io/github/martinwitt/laughing_train/persistence/DataBaseMigration.java @@ -16,6 +16,7 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.event.Observes; import jakarta.inject.Inject; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; @@ -101,7 +102,7 @@ private void createConfigsIfMissing() { private void removeProjectHashesWithoutResults() { logger.atInfo().log("Removing project hashes without results"); for (Project project : projectRepository.getAll()) { - List commitHashes = project.getCommitHashes(); + List commitHashes = new ArrayList<>(project.getCommitHashes()); for (String commitHash : commitHashes) { if (badSmellRepositoryImpl .mongoCollection()