From e5ad9778f289bdc61202385833d3112b616da25a Mon Sep 17 00:00:00 2001 From: Miller Wang Date: Fri, 17 Nov 2023 18:01:25 +0800 Subject: [PATCH] Fix possible thread issue in azure task adder --- .../intellij/connector/dotazure/BeforeRunTaskAdder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-resource-connector-lib-java/src/main/java/com/microsoft/azure/toolkit/intellij/connector/dotazure/BeforeRunTaskAdder.java b/PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-resource-connector-lib-java/src/main/java/com/microsoft/azure/toolkit/intellij/connector/dotazure/BeforeRunTaskAdder.java index 994b073092..845ca655e2 100644 --- a/PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-resource-connector-lib-java/src/main/java/com/microsoft/azure/toolkit/intellij/connector/dotazure/BeforeRunTaskAdder.java +++ b/PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-resource-connector-lib-java/src/main/java/com/microsoft/azure/toolkit/intellij/connector/dotazure/BeforeRunTaskAdder.java @@ -33,9 +33,9 @@ public void runConfigurationAdded(@Nonnull RunnerAndConfigurationSettings settin } final List> connections = profile.getConnections(); synchronized (config.getBeforeRunTasks()) { - final List> tasks = config.getBeforeRunTasks().stream() - .filter(task -> task instanceof DotEnvBeforeRunTaskProvider.LoadDotEnvBeforeRunTask) - .collect(Collectors.toList()); + final List> tasks = new ArrayList<>(config.getBeforeRunTasks().stream() + .filter(task -> task instanceof DotEnvBeforeRunTaskProvider.LoadDotEnvBeforeRunTask) + .toList()); if (connections.stream().anyMatch(c -> c.isApplicableFor(config))) { tasks.add(new DotEnvBeforeRunTaskProvider.LoadDotEnvBeforeRunTask(config)); }