[164181] RuntimeBridge is non-deterministic
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeBridge.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeBridge.java
index 336ee89..0dd1491 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeBridge.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeBridge.java
@@ -48,8 +48,19 @@
}
private static void addMapping(String id, String id2, String version) {
+ ArrayList list = null;
try {
- mappings.put(id, RuntimeManager.getRuntimeComponentType(id2).getVersion(version));
+ list = (ArrayList) mappings.get(id);
+ } catch (Exception e) {
+ // ignore
+ }
+
+ if (list == null)
+ list = new ArrayList(2);
+
+ try {
+ list.add(RuntimeManager.getRuntimeComponentType(id2).getVersion(version));
+ mappings.put(id, list);
} catch (Exception e) {
// ignore
}
@@ -119,9 +130,6 @@
return components;
// define server runtime component
- String typeId = runtime.getRuntimeType().getId();
- IRuntimeComponentVersion mapped = (IRuntimeComponentVersion) mappings.get(typeId);
-
Map properties = new HashMap(5);
if (runtime.getLocation() != null)
properties.put("location", runtime.getLocation().toPortableString());
@@ -138,7 +146,15 @@
properties.put(CLASSPATH, path.toPortableString());
}
- components.add(RuntimeManager.createRuntimeComponent(mapped, properties));
+ String typeId = runtime.getRuntimeType().getId();
+ if (mappings.containsKey(typeId)) {
+ ArrayList list = (ArrayList) mappings.get(typeId);
+ int size = list.size();
+ for (int i = 0; i < size; i++) {
+ IRuntimeComponentVersion mapped = (IRuntimeComponentVersion) list.get(i);
+ components.add(RuntimeManager.createRuntimeComponent(mapped, properties));
+ }
+ }
// define JRE component
IJavaRuntime javaRuntime = (IJavaRuntime) runtime.loadAdapter(IJavaRuntime.class, null);