Fixed bug 405942: Please adapt Eclipse to the new Runtime.exec behavior in Java 1.7.0_21 and Java 1.6.0_45
diff --git a/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/browsers/MozillaBrowser.java b/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/browsers/MozillaBrowser.java
index 426a2b1..69d0f9f 100644
--- a/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/browsers/MozillaBrowser.java
+++ b/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/browsers/MozillaBrowser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -13,8 +13,10 @@
import java.io.IOException;
import java.net.URL;
+import java.util.StringTokenizer;
import org.eclipse.core.runtime.Platform;
+
import org.eclipse.ui.browser.AbstractWebBrowser;
import org.eclipse.ui.internal.browser.WebBrowserUIPlugin;
import org.eclipse.ui.internal.browser.WebBrowserUtil;
@@ -86,12 +88,19 @@
}
/**
- * @param browserCmd
+ * @param command the command
+ * @param parameters the parameters
* @return int 0 if success
*/
- private int openBrowser(String browserCmd) {
+ private int openBrowser(String command, String parameters) {
try {
- Process pr = Runtime.getRuntime().exec(browserCmd);
+ StringTokenizer tokenizer = new StringTokenizer(parameters);
+ String[] commandArray = new String[tokenizer.countTokens() + 1];
+ commandArray[0] = command;
+ for (int i= 1; tokenizer.hasMoreTokens(); i++)
+ commandArray[i] = tokenizer.nextToken();
+
+ Process pr = Runtime.getRuntime().exec(commandArray);
StreamConsumer outputs = new StreamConsumer(pr.getInputStream());
(outputs).start();
StreamConsumer errors = new StreamConsumer(pr.getErrorStream());
@@ -162,19 +171,19 @@
if (exitRequested)
return;
if (firstLaunch && Platform.OS_WIN32.equals(Platform.getOS())) {
- if (openBrowser(executable + " " + WebBrowserUtil.createParameterString(parameters, url)) == 0) //$NON-NLS-1$
+ if (openBrowser(executable, WebBrowserUtil.createParameterString(parameters, url)) == 0)
return;
browserFullyOpenedAt = System.currentTimeMillis() + DELAY;
return;
}
- if (openBrowser(executable + ' ' + parameters + " -remote openURL(" + url + ")") //$NON-NLS-1$ //$NON-NLS-2$
+ if (openBrowser(executable, parameters + " -remote openURL(" + url + ")") //$NON-NLS-1$ //$NON-NLS-2$
== 0)
return;
if (exitRequested)
return;
browserFullyOpenedAt = System.currentTimeMillis() + DELAY;
- openBrowser(executable + " " + WebBrowserUtil.createParameterString(parameters, url)); //$NON-NLS-1$
+ openBrowser(executable, WebBrowserUtil.createParameterString(parameters, url));
}
private void waitForBrowser() {