Bug 218205 - JRE Definition dialog does not filter -Dee.* properties
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 dfb7d4e..c736d7f 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 IBM Corporation and others.
+# Copyright (c) 2007, 2008 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
@@ -21,6 +21,9 @@
 -Dee.ext.dirs=..\lib\ext;..\lib\opt-ext
 -Dee.endorsed.dirs=..\lib\endorsed
 
+# all args should get passed through to command line
+-XspecialArg:123
+
 -Dee.language.level=1.4
 -Dee.class.library.level=CDC-1.1/Foundation-1.1
 -Dee.id=CDC-1.1/Foundation-1.1
@@ -30,4 +33,4 @@
 -Djava.home=..
 
 # all args should get passed through to command line
--XspecialArg:123
\ No newline at end of file
+-XspecialArg2=456
\ No newline at end of file
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 4363201..e1f5ea9 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 IBM Corporation and others.
+# Copyright (c) 2007, 2008 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
@@ -21,6 +21,9 @@
 -Dee.ext.dirs=../lib/ext:../lib/opt-ext
 -Dee.endorsed.dirs=../lib/endorsed
 
+# all args should get passed through to command line
+-XspecialArg:123
+
 -Dee.language.level=1.4
 -Dee.class.library.level=CDC-1.1/Foundation-1.1
 -Dee.id=CDC-1.1/Foundation-1.1
@@ -30,4 +33,4 @@
 -Djava.home=..
 
 # all args should get passed through to command line
--XspecialArg:123
\ No newline at end of file
+-XspecialArg2=456
\ 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 894898d..5e6da03 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
@@ -160,21 +160,8 @@
 		assertNotNull("Missing EE file", file);
 		String defaultVMArguments = EEVMType.getVMArguments(file);
 		String[] expected = new String[] {
-				"-Dee.executable",
-				"-Dee.executable.console",
-				"-Dee.bootclasspath",
-				"-Dee.src",
-				"-Dee.javadoc",
-				"-Dee.additional.dirs",
-				"-Dee.ext.dirs",
-				"-Dee.endorsed.dirs",
-				"-Dee.language.level",
-				"-Dee.class.library.level",
-				"-Dee.id",
-				"-Dee.name",
-				"-Dee.description",
-				"-Dee.copyright",
-				"-XspecialArg:123"				
+				"-XspecialArg:123",
+				"-XspecialArg2=456"
 		};
 		int prev = -1;
 		for (int i = 0; i < expected.length; i++) {
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EEVMType.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EEVMType.java
index cc8e1dc..7a0e2e5 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EEVMType.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EEVMType.java
@@ -73,6 +73,11 @@
 	public static final String PROP_NAME = "-Dee.name";  //$NON-NLS-1$
 	
 	/**
+	 * Any line found in the ee file starting with this string will not be added to the vm argument list
+	 */
+	private static final String EE_ARG_FILTER = "-Dee."; //$NON-NLS-1$
+	
+	/**
 	 * Substitution in EE file - replaced with directory of EE file,
 	 * to support absolute path names where needed.
 	 */
@@ -335,23 +340,32 @@
 				while (line != null) {
 					if (!line.startsWith("#")) { //$NON-NLS-1$
 						if (line.trim().length() > 0){
+							boolean appendArgument = !line.startsWith(EE_ARG_FILTER);
 							line = resolve(line, eeHome);
 							int eq = line.indexOf('=');
 							if (eq > 0) {
 								String key = line.substring(0, eq);
-								arguments.append(key).append('=');
+								if (appendArgument){
+									arguments.append(key).append('=');
+								}
 								if (line.length() > eq + 1) {
 									String value = line.substring(eq + 1).trim();
 									properties.put(key, value);
-									if (value.indexOf(' ') > -1){
-										arguments.append('"').append(value).append('"');
-									} else {
-										arguments.append(value);
+									if (appendArgument){
+										if (value.indexOf(' ') > -1){
+											arguments.append('"').append(value).append('"');
+										} else {
+											arguments.append(value);
+										}
 									}
 								}
-								arguments.append(' ');
+								if (appendArgument){
+									arguments.append(' ');	
+								}
 							} else {
-								arguments.append(line).append(' ');
+								if (appendArgument){
+									arguments.append(line).append(' ');
+								}
 							}
 						}
 					}