diff options
| author | Dani Megert | 2013-05-27 16:56:20 +0000 |
|---|---|---|
| committer | Dani Megert | 2013-05-27 16:56:20 +0000 |
| commit | 67208447235112204ac5e190e2a9fc0358dbb1db (patch) | |
| tree | 9af4fc6845f83f109811e93cade4a2977bfb98b1 | |
| parent | cca9f904a333be9524dbb644c06890e1c223bfb7 (diff) | |
| download | eclipse.platform.ui-67208447235112204ac5e190e2a9fc0358dbb1db.tar.gz eclipse.platform.ui-67208447235112204ac5e190e2a9fc0358dbb1db.tar.xz eclipse.platform.ui-67208447235112204ac5e190e2a9fc0358dbb1db.zip | |
Fixed bug 405942: Please adapt Eclipse to the new Runtime.exec behavior in Java 1.7.0_21 and Java 1.6.0_45
| -rw-r--r-- | bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/browsers/MozillaBrowser.java | 23 |
1 files changed, 16 insertions, 7 deletions
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 426a2b1f536..69d0f9f32e8 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 @@ package org.eclipse.ui.internal.browser.browsers; 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 @@ public class MozillaBrowser extends AbstractWebBrowser { } /** - * @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 @@ public class MozillaBrowser extends AbstractWebBrowser { 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() { |
