Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2012-09-21 18:43:18 +0000
committerMarkus Keller2012-09-21 18:43:18 +0000
commitaeb204dd5975c4bd3ed2a35f43b44c0b5095860e (patch)
tree06f81af4816aa106b68088cb1cbb8b858e463d0e
parent7b835aa2a6a7fc236d5984d2e57061e17c171fe1 (diff)
downloadeclipse.platform.debug-aeb204dd5975c4bd3ed2a35f43b44c0b5095860e.tar.gz
eclipse.platform.debug-aeb204dd5975c4bd3ed2a35f43b44c0b5095860e.tar.xz
eclipse.platform.debug-aeb204dd5975c4bd3ed2a35f43b44c0b5095860e.zip
Bug 387504: Bugs in program argument parsing (compared to command line)v20120921-184318I20120925-0800
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/ArgumentParsingTests.java28
1 files changed, 16 insertions, 12 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/ArgumentParsingTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/ArgumentParsingTests.java
index 33647b75e..2262084d6 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/ArgumentParsingTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/ArgumentParsingTests.java
@@ -74,34 +74,38 @@ public class ArgumentParsingTests extends TestCase {
private static void runCommandLine(String commandLine, String[] arguments) throws IOException,
URISyntaxException, CoreException {
- URL classFolderUrl = FileLocator.find(TestsPlugin.getDefault().getBundle(), new Path("bin/"), null);
- classFolderUrl= FileLocator.toFileURL(classFolderUrl);
- File classFolderFile = URIUtil.toFile(URIUtil.toURI(classFolderUrl));
+ URL classPathUrl = FileLocator.find(TestsPlugin.getDefault().getBundle(), new Path("bin/"), null);
+ if (classPathUrl == null) { // not running from the workspace, but from the built bundle
+ classPathUrl = FileLocator.find(TestsPlugin.getDefault().getBundle(), Path.ROOT, null);
+ }
+ classPathUrl = FileLocator.toFileURL(classPathUrl);
+ File classPathFile = URIUtil.toFile(URIUtil.toURI(classPathUrl));
- String[] execArgs= new String[arguments.length + 2];
+ String[] execArgs= new String[arguments.length + 4];
execArgs[0]= new Path(System.getProperty("java.home")).append("bin/java").toOSString();
- execArgs[1]= ArgumentsPrinter.class.getName();
- System.arraycopy(arguments, 0, execArgs, 2, arguments.length);
+ execArgs[1]= "-cp";
+ execArgs[2]= classPathFile.getAbsolutePath();
+ execArgs[3]= ArgumentsPrinter.class.getName();
+ System.arraycopy(arguments, 0, execArgs, 4, arguments.length);
- ArrayList resultArgs = runCommandLine(execArgs, classFolderFile);
+ ArrayList resultArgs = runCommandLine(execArgs);
assertEquals("unexpected exec result;",
Arrays.asList(arguments).toString(),
resultArgs.toString());
if (! Platform.getOS().equals(Constants.OS_WIN32)) {
- execArgs= new String[] { "sh", "-c", execArgs[0] + " " + execArgs[1] + " " + commandLine};
- resultArgs = runCommandLine(execArgs, classFolderFile);
+ execArgs = new String[] { "sh", "-c", execArgs[0] + " " + execArgs[1] + " " + execArgs[2] + " " + execArgs[3] + " " + commandLine };
+ resultArgs = runCommandLine(execArgs);
assertEquals("unexpected sh exec result;",
Arrays.asList(arguments).toString(),
resultArgs.toString());
-
}
}
- private static ArrayList runCommandLine(String[] execArgs, File workingDir)
+ private static ArrayList runCommandLine(String[] execArgs)
throws CoreException, IOException {
- Process process = DebugPlugin.exec(execArgs, workingDir);
+ Process process = DebugPlugin.exec(execArgs, null);
BufferedReader procOut = new BufferedReader(new InputStreamReader(process.getInputStream()));
ArrayList procArgs= new ArrayList();

Back to the top