Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified redundant judgment #1489

Merged
merged 1 commit into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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