From eb53a9ce6dda71cfddec732203b146120cc8d0d4 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 7 Apr 2014 10:31:34 -0700 Subject: [PATCH] Minor fix for ConcurrentModificationException --- .../java/org/eclipse/jetty/start/Module.java | 20 +++++++++---------- .../java/org/eclipse/jetty/start/Modules.java | 3 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java index 9f7ea0133d9..f995be6039d 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java @@ -268,6 +268,16 @@ public class Module private void init(BaseHome basehome) { + parentNames = new HashSet<>(); + optionalParentNames = new HashSet<>(); + parentEdges = new HashSet<>(); + childEdges = new HashSet<>(); + xmls = new ArrayList<>(); + initialise = new ArrayList<>(); + libs = new ArrayList<>(); + files = new ArrayList<>(); + jvmArgs = new ArrayList<>(); + String name = basehome.toShortForm(file); // Find module system name (usually in the form of a filesystem reference) @@ -279,16 +289,6 @@ public class Module } this.fileRef = mat.group(1).replace('\\','/'); this.logicalName = this.fileRef; - - parentNames = new HashSet<>(); - optionalParentNames = new HashSet<>(); - parentEdges = new HashSet<>(); - childEdges = new HashSet<>(); - xmls = new ArrayList<>(); - initialise = new ArrayList<>(); - libs = new ArrayList<>(); - files = new ArrayList<>(); - jvmArgs = new ArrayList<>(); } public boolean isEnabled() diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java index 9987dcae4bb..ab263cef4ba 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java @@ -375,7 +375,8 @@ public class Modules implements Iterable public void registerParentsIfMissing(BaseHome basehome, StartArgs args, Module module) throws IOException { - for (String name : new ArrayList<>(module.getParentNames())) + Set parents = new HashSet<>(module.getParentNames()); + for (String name : parents) { if (!modules.containsKey(name)) {