Bug 558324 - Ant remote jar runtime errors

Fixed regression from commit b4a6b202a05852967f9c90357d7598bee898c577
that broke runtime argument handling in
org.eclipse.ant.internal.launching.remote.InternalAntRunner.processMinusDProperties(List<String>)
and this broke entire ant execution in remote JVM. One can't iterate
over lists with iterator and remove elements from the list directly.

Change-Id: I6505064fd5367623f483e2c5db7314dec82b8316
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/ant/org.eclipse.ant.launching/lib/remote.jar b/ant/org.eclipse.ant.launching/lib/remote.jar
index 8a84998..cf78240 100644
--- a/ant/org.eclipse.ant.launching/lib/remote.jar
+++ b/ant/org.eclipse.ant.launching/lib/remote.jar
Binary files differ
diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java
index 5ecbbcd..af88bb6 100644
--- a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java
+++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java
@@ -1094,7 +1094,9 @@
 
 	@SuppressWarnings("unused")
 	private void processMinusDProperties(List<String> commands) {
-		for (String arg : commands) {
+		String[] args = commands.toArray(new String[commands.size()]);
+		for (int i = 0; i < args.length; i++) {
+			String arg = args[i];
 			if (arg.startsWith("-D")) { //$NON-NLS-1$
 				String name = arg.substring(2, arg.length());
 				String value = null;
@@ -1115,7 +1117,7 @@
 					userProperties = new HashMap<String, String>();
 				}
 				userProperties.put(name, value);
-				commands.remove(arg);
+				commands.remove(args[i]);
 			}
 		}
 	}