ninja fix whitespace parsing in cassandra-stress

patch by benedict; reviewed by jake for CASSANDRA-8648
This commit is contained in:
Benedict Elliott Smith 2015-02-11 16:11:38 +00:00
parent bf43534dcc
commit c643bbc8d1
1 changed files with 18 additions and 0 deletions

View File

@ -211,6 +211,7 @@ public class StressSettings implements Serializable
{
try
{
args = repairParams(args);
final Map<String, String[]> clArgs = parseMap(args);
if (clArgs.containsKey("legacy"))
return Legacy.build(Arrays.copyOfRange(args, 1, args.length));
@ -226,6 +227,23 @@ public class StressSettings implements Serializable
}
}
private static String[] repairParams(String[] args)
{
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String arg : args)
{
if (!first)
sb.append(" ");
sb.append(arg);
first = false;
}
return sb.toString()
.replaceAll("\s+([,=()])", "$1")
.replaceAll("([,=(])\s+", "$1")
.split(" +");
}
public static StressSettings get(Map<String, String[]> clArgs)
{
SettingsCommand command = SettingsCommand.get(clArgs);