mirror of https://github.com/apache/cassandra
ninja fix whitespace parsing in cassandra-stress
patch by benedict; reviewed by jake for CASSANDRA-8648
This commit is contained in:
parent
bf43534dcc
commit
c643bbc8d1
|
|
@ -211,6 +211,7 @@ public class StressSettings implements Serializable
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
args = repairParams(args);
|
||||||
final Map<String, String[]> clArgs = parseMap(args);
|
final Map<String, String[]> clArgs = parseMap(args);
|
||||||
if (clArgs.containsKey("legacy"))
|
if (clArgs.containsKey("legacy"))
|
||||||
return Legacy.build(Arrays.copyOfRange(args, 1, args.length));
|
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)
|
public static StressSettings get(Map<String, String[]> clArgs)
|
||||||
{
|
{
|
||||||
SettingsCommand command = SettingsCommand.get(clArgs);
|
SettingsCommand command = SettingsCommand.get(clArgs);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue