From 2da44a820373aefa1bfb2b7963fee1fe16a0b87a Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 16 Feb 2017 16:17:30 +0300 Subject: [PATCH] FileDownloader: fixed concurrency problem (EA-95126) --- .../com/intellij/util/download/impl/FileDownloaderImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java b/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java index 3bbb7c2d0ecc..7fb758a4ac97 100644 --- a/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java +++ b/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java @@ -49,6 +49,7 @@ import javax.swing.*; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; @@ -149,8 +150,8 @@ public class FileDownloaderImpl implements FileDownloader { @NotNull @Override public List> download(@NotNull final File targetDir) throws IOException { - final List> downloadedFiles = new ArrayList<>(); - final List> existingFiles = new ArrayList<>(); + List> downloadedFiles = Collections.synchronizedList(new ArrayList<>()); + List> existingFiles = Collections.synchronizedList(new ArrayList<>()); ProgressIndicator parentIndicator = ProgressManager.getInstance().getProgressIndicator(); if (parentIndicator == null) { parentIndicator = new EmptyProgressIndicator();