From b8e18653d9e0b6382cdb70307b6644e15a34fba2 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 19 May 2021 15:52:26 -0600 Subject: [PATCH] Fix JOSM #20555: ACE when removing the plugin Signed-off-by: Taylor Smock --- .../josm/plugins/mapwithai/tools/MapPaintUtils.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/tools/MapPaintUtils.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/tools/MapPaintUtils.java index 8173a7b..83559a2 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/tools/MapPaintUtils.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/tools/MapPaintUtils.java @@ -112,9 +112,12 @@ public final class MapPaintUtils { * Remove MapWithAI paint styles */ public static synchronized void removeMapWithAIPaintStyles() { - new ArrayList<>(MapPaintStyles.getStyles().getStyleSources()).parallelStream().filter( - source -> paintStyleResourceUrl.equals(source.url) || TEST_PATTERN.matcher(source.url).matches()) - .forEach(style -> GuiHelper.runInEDT(() -> MapPaintStyles.removeStyle(style))); + // WebStart has issues with streams and EDT permissions. Don't use streams. + for (StyleSource style : new ArrayList<>(MapPaintStyles.getStyles().getStyleSources())) { + if (paintStyleResourceUrl.equals(style.url) || TEST_PATTERN.matcher(style.url).matches()) { + GuiHelper.runInEDT(() -> MapPaintStyles.removeStyle(style)); + } + } } /**