Skip to content

Commit af098fb

Browse files
committed
UIEXT-3150: Fix ConcurrentModificationException
* Those exceptions were thrown in various workflow tests at this place UIEXT-3150 (WebUI-Migration Excel Reader)
1 parent f254f35 commit af098fb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

org.knime.core.ui/src/eclipse/org/knime/core/webui/node/dialog/configmapping/NodeSettingsAtPathUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
*/
4949
package org.knime.core.webui.node.dialog.configmapping;
5050

51+
import java.util.ArrayList;
5152
import java.util.Optional;
5253

5354
import org.knime.core.node.NodeSettings;
@@ -133,7 +134,10 @@ static void replaceAtPathIfPresent(final NodeSettings settings, final ConfigPath
133134
*/
134135
static void deletePath(final NodeSettings settings, final ConfigPath path) {
135136
if (path.size() == 0) {
136-
settings.iterator().forEachRemaining(settings::removeConfig);
137+
// Collect all keys first to avoid ConcurrentModificationException
138+
final var keysToRemove = new ArrayList<String>();
139+
settings.iterator().forEachRemaining(keysToRemove::add);
140+
keysToRemove.forEach(settings::removeConfig);
137141
return;
138142
}
139143
getNodeSettingsAtPath(settings, path.withoutLastKey()).ifPresent(atPath -> atPath.removeConfig(path.lastKey()));

0 commit comments

Comments
 (0)