From ffad52e48c40f916acb920ddba51fa3c60c07723 Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 14 Apr 2018 14:35:53 +0000 Subject: [PATCH] LoadClientAppsJob.parseArgs() minor cleanup --- .../i2p/router/startup/LoadClientAppsJob.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java b/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java index b45be2d96..ed2de0eee 100644 --- a/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java +++ b/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java @@ -117,18 +117,18 @@ public class LoadClientAppsJob extends JobImpl { public static String[] parseArgs(String args) { List argList = new ArrayList(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"; }