Skip to content

Commit

Permalink
Simplified redundant judgment (#1489)
Browse files Browse the repository at this point in the history
Signed-off-by: crazyhzm <crazyhzm@apache.org>
  • Loading branch information
CrazyHZM committed May 2, 2024
1 parent b35aa27 commit 6814ba3
Showing 1 changed file with 3 additions and 16 deletions.
Expand Up @@ -47,24 +47,11 @@ public static String[] cleanArgs(String[] args) {

// this has to be a separate "if" statement, to capture the case of: "-Dfoo=bar"
if (addedToBuffer && arg.endsWith("\"")) {
String cleanArgPart = arg.substring(0, arg.length() - 1);

// if we're building an argument, keep doing so.
if (currentArg != null) {
// if this is the case of "-Dfoo=bar", then we need to adjust the buffer.
if (addedToBuffer) {
currentArg.setLength(currentArg.length() - 1);
}
// otherwise, we trim the trailing " and append to the buffer.
else {
// TODO introducing a space here...not sure what else to do but collapse whitespace
currentArg.append(' ').append(cleanArgPart);
}
// if this is the case of "-Dfoo=bar", then we need to adjust the buffer.
currentArg.setLength(currentArg.length() - 1);

cleaned.add(currentArg.toString());
} else {
cleaned.add(cleanArgPart);
}
cleaned.add(currentArg.toString());

currentArg = null;
addedToBuffer = false;
Expand Down

0 comments on commit 6814ba3

Please sign in to comment.