diff --git a/java/server/src/org/openqa/grid/selenium/GridLauncher.java b/java/server/src/org/openqa/grid/selenium/GridLauncher.java index 75c3c8551b665..aa13dc635470b 100644 --- a/java/server/src/org/openqa/grid/selenium/GridLauncher.java +++ b/java/server/src/org/openqa/grid/selenium/GridLauncher.java @@ -29,6 +29,7 @@ import org.openqa.selenium.remote.server.log.TerseFormatter; import org.openqa.selenium.server.SeleniumServer; import org.openqa.selenium.server.cli.RemoteControlLauncher; +import org.openqa.selenium.server.shared.CliUtils; import java.io.File; import java.io.IOException; @@ -98,11 +99,11 @@ public static void main(String[] args) throws Exception { private static void printInfoAboutRoles(CommandLineOptionHelper helper) { if (helper.hasParamValue("-role")) { - RemoteControlLauncher.printWrappedLine( + CliUtils.printWrappedLine( "", "Error: the role '" + helper.getParamValue("-role") + "' does not match a recognized server role\n"); } else { - RemoteControlLauncher.printWrappedLine( + CliUtils.printWrappedLine( "", "Error: -role option needs to be followed by the value that defines role of this component in the grid\n"); } @@ -113,7 +114,7 @@ private static void printInfoAboutRoles(CommandLineOptionHelper helper) { " standalone as a standalone server not being a part of a grid\n" + "\n" + "If -role option is omitted the server runs standalone\n"); - RemoteControlLauncher.printWrappedLine( + CliUtils.printWrappedLine( "", "To get help on the options available for a specific role run the server" + " with -help option and the corresponding -role option value"); diff --git a/java/server/src/org/openqa/selenium/server/cli/RemoteControlLauncher.java b/java/server/src/org/openqa/selenium/server/cli/RemoteControlLauncher.java index fb859c0e849fb..e353681ce6fa6 100644 --- a/java/server/src/org/openqa/selenium/server/cli/RemoteControlLauncher.java +++ b/java/server/src/org/openqa/selenium/server/cli/RemoteControlLauncher.java @@ -18,6 +18,8 @@ package org.openqa.selenium.server.cli; +import static org.openqa.selenium.server.shared.CliUtils.printWrappedLine; + import org.openqa.selenium.server.InjectionHelper; import org.openqa.selenium.server.RemoteControlConfiguration; @@ -294,31 +296,6 @@ public static String getArg(String[] args, int i) { return args[i]; } - public static void printWrappedLine(String prefix, String msg) { - printWrappedLine(System.out, prefix, msg, true); - } - - public static void printWrappedLine(PrintStream output, String prefix, String msg, boolean first) { - output.print(prefix); - if (!first) { - output.print(" "); - } - int defaultWrap = 70; - int wrap = defaultWrap - prefix.length(); - if (wrap > msg.length()) { - output.println(msg); - return; - } - String lineRaw = msg.substring(0, wrap); - int spaceIndex = lineRaw.lastIndexOf(' '); - if (spaceIndex == -1) { - spaceIndex = lineRaw.length(); - } - String line = lineRaw.substring(0, spaceIndex); - output.println(line); - printWrappedLine(output, prefix, msg.substring(spaceIndex + 1), false); - } - public static void setSystemProperty(String arg) { if (arg.indexOf('=') == -1) { usage("poorly formatted Java property setting (I expect to see '=') " + arg);