IDEA-81313 (restore space escaping in BrowserUtil)

This commit is contained in:
Roman Shevchenko
2012-02-15 18:14:24 +01:00
parent 6ccbd57194
commit 2220f79f2b
@@ -171,11 +171,11 @@ public class BrowserUtil {
try {
final GeneralCommandLine commandLine = new GeneralCommandLine(command);
commandLine.addParameter(curl.toString());
commandLine.addParameter(escapeUrl(curl.toString()));
commandLine.createProcess();
if (LOG.isDebugEnabled()) {
LOG.debug("Browser launched with command line: " + commandLine.getCommandLineString());
LOG.debug("Browser launched with command line: " + commandLine);
}
}
catch (final ExecutionException e) {
@@ -185,12 +185,8 @@ public class BrowserUtil {
@NotNull
public static String escapeUrl(@NotNull @NonNls String url) {
if (SystemInfo.isWindows) {
return (url.indexOf(' ') > 0 || url.indexOf('&') > -1) ? "\"" + url + "\"" : url;
}
else {
return url.replaceAll(" ", "%20");
}
return SystemInfo.isWindows ? url.replaceAll(" ", "%20")
: url;
}
private static boolean launchBrowserUsingDesktopApi(final String sUrl) {
@@ -226,6 +222,7 @@ public class BrowserUtil {
public static String[] getOpenBrowserCommand(final @NonNls @NotNull String browserPath) {
final String[] command;
if (SystemInfo.isMac) {
if (new File(browserPath).isFile()) {
// versions before 10.6 don't allow to pass command line arguments to browser via 'open' command
@@ -247,6 +244,7 @@ public class BrowserUtil {
else {
command = new String[]{browserPath};
}
return command;
}