LoadClientAppsJob.parseArgs() minor cleanup

This commit is contained in:
zzz
2018-04-14 14:35:53 +00:00
parent d12b531c54
commit ffad52e48c

View File

@ -117,18 +117,18 @@ public class LoadClientAppsJob extends JobImpl {
public static String[] parseArgs(String args) {
List<String> argList = new ArrayList<String>(4);
if (args != null) {
char data[] = args.toCharArray();
StringBuilder buf = new StringBuilder(32);
boolean isQuoted = false;
for (int i = 0; i < data.length; i++) {
switch (data[i]) {
for (int i = 0; i < args.length(); i++) {
char c = args.charAt(i);
switch (c) {
case '\'':
case '"':
if (isQuoted) {
String str = buf.toString().trim();
if (str.length() > 0)
argList.add(str);
buf = new StringBuilder(32);
buf.setLength(0);
}
isQuoted = !isQuoted;
break;
@ -137,16 +137,16 @@ public class LoadClientAppsJob extends JobImpl {
// whitespace - if we're in a quoted section, keep this as part of the quote,
// otherwise use it as a delim
if (isQuoted) {
buf.append(data[i]);
buf.append(c);
} else {
String str = buf.toString().trim();
if (str.length() > 0)
argList.add(str);
buf = new StringBuilder(32);
buf.setLength(0);
}
break;
default:
buf.append(data[i]);
buf.append(c);
break;
}
}
@ -315,12 +315,6 @@ public class LoadClientAppsJob extends JobImpl {
} catch (Throwable t) {}
return false;
}
}
public String getName() { return "Load up any client applications"; }