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