Simplified redundant judgment (#1489)

Signed-off-by: crazyhzm <crazyhzm@apache.org>
This commit is contained in:
Jermaine Hua 2024-05-02 20:51:05 +08:00 committed by GitHub
parent b35aa27b80
commit 6814ba386d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 16 deletions

View File

@ -47,24 +47,11 @@ public class CleanArgument {
// this has to be a separate "if" statement, to capture the case of: "-Dfoo=bar" // this has to be a separate "if" statement, to capture the case of: "-Dfoo=bar"
if (addedToBuffer && arg.endsWith("\"")) { if (addedToBuffer && arg.endsWith("\"")) {
String cleanArgPart = arg.substring(0, arg.length() - 1);
// if we're building an argument, keep doing so. // 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 this is the case of "-Dfoo=bar", then we need to adjust the buffer.
if (addedToBuffer) {
currentArg.setLength(currentArg.length() - 1); 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);
}
cleaned.add(currentArg.toString()); cleaned.add(currentArg.toString());
} else {
cleaned.add(cleanArgPart);
}
currentArg = null; currentArg = null;
addedToBuffer = false; addedToBuffer = false;