Bug 421938 - [1.8] ExecutionEnvironmentDescription#getVMArguments does
not preserve VM arguments
Change-Id: I45a2ff488a97eb60456ce54d292e74d4e1badae6
Signed-off-by: Jesper Moller <jesper@selskabet.org>
diff --git a/org.eclipse.jdt.debug.tests/testfiles/test-jre/bin/test-foundation11-win32.ee b/org.eclipse.jdt.debug.tests/testfiles/test-jre/bin/test-foundation11-win32.ee
index b0a3b04..7e6d0a0 100644
--- a/org.eclipse.jdt.debug.tests/testfiles/test-jre/bin/test-foundation11-win32.ee
+++ b/org.eclipse.jdt.debug.tests/testfiles/test-jre/bin/test-foundation11-win32.ee
@@ -1,5 +1,5 @@
##################################################################################
-# Copyright (c) 2007, 2008 IBM Corporation and others.
+# Copyright (c) 2007, 2013 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
#
# Contributors:
# IBM Corporation - initial API and implementation
+# Jesper S Moller - Bug 421938: [1.8] ExecutionEnvironmentDescription#getVMArguments does not preserve VM arguments
##################################################################################
# Test ".ee" file for testing installed JRE definition
@@ -40,4 +41,5 @@
-Djava.home=..
# all args should get passed through to command line
--XspecialArg2=456
\ No newline at end of file
+-XspecialArg2=456
+-XspecialArg3=789
diff --git a/org.eclipse.jdt.debug.tests/testfiles/test-jre/bin/test-foundation11.ee b/org.eclipse.jdt.debug.tests/testfiles/test-jre/bin/test-foundation11.ee
index 3b4027c..fc4903b 100644
--- a/org.eclipse.jdt.debug.tests/testfiles/test-jre/bin/test-foundation11.ee
+++ b/org.eclipse.jdt.debug.tests/testfiles/test-jre/bin/test-foundation11.ee
@@ -1,5 +1,5 @@
##################################################################################
-# Copyright (c) 2007, 2008 IBM Corporation and others.
+# Copyright (c) 2007, 2013 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
#
# Contributors:
# IBM Corporation - initial API and implementation
+# Jesper S Moller - Bug 421938: [1.8] ExecutionEnvironmentDescription#getVMArguments does not preserve VM arguments
##################################################################################
# Test ".ee" file for testing installed JRE definition
@@ -40,4 +41,5 @@
-Djava.home=..
# all args should get passed through to command line
--XspecialArg2=456
\ No newline at end of file
+-XspecialArg2=456
+-XspecialArg3=789
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EEDefinitionTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EEDefinitionTests.java
index cae3a70..0503e6d 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EEDefinitionTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EEDefinitionTests.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Jesper S Moller - Bug 421938: [1.8] ExecutionEnvironmentDescription#getVMArguments does not preserve VM arguments
*******************************************************************************/
package org.eclipse.jdt.debug.tests.core;
@@ -199,13 +200,14 @@
String defaultVMArguments = description.getVMArguments();
String[] expected = new String[] {
"-XspecialArg:123",
- "-XspecialArg2=456"
+ "-XspecialArg2=456",
+ "-XspecialArg3=789"
};
int prev = -1;
for (int i = 0; i < expected.length; i++) {
int next = defaultVMArguments.indexOf(expected[i]);
- assertTrue("Missing argument: " + expected[i], next >= 0);
- assertTrue("Wrong argument order: " + expected[i], next > prev);
+ assertTrue("Missing argument: " + expected[i] + ": was: " + defaultVMArguments, next >= 0);
+ assertTrue("Wrong argument order: " + expected[i] + ": " + defaultVMArguments, next > prev);
prev = next;
}
}
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/environments/ExecutionEnvironmentDescription.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/environments/ExecutionEnvironmentDescription.java
index bb33d17..c69fc04 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/environments/ExecutionEnvironmentDescription.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/environments/ExecutionEnvironmentDescription.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Jesper S Moller - Bug 421938: [1.8] ExecutionEnvironmentDescription#getVMArguments does not preserve VM arguments
*******************************************************************************/
package org.eclipse.jdt.launching.environments;
@@ -20,6 +21,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@@ -365,7 +367,7 @@
* @exception CoreException if unable to read the file
*/
private void initProperties(File eeFile) throws CoreException {
- Map<String, String> properties = new HashMap<String, String>();
+ Map<String, String> properties = new LinkedHashMap<String, String>();
String eeHome = eeFile.getParentFile().getAbsolutePath();
BufferedReader bufferedReader = null;
try {
@@ -410,7 +412,7 @@
// resolve things with ${ee.home} in them
fProperties = properties; // needs to be done to resolve
Iterator<Entry<String, String>> entries = properties.entrySet().iterator();
- Map<String, String> resolved = new HashMap<String, String>(properties.size());
+ Map<String, String> resolved = new LinkedHashMap<String, String>(properties.size());
while (entries.hasNext()) {
Entry<String, String> entry = entries.next();
String key = entry.getKey();