-
Notifications
You must be signed in to change notification settings - Fork 41.3k
Fix to allow empty argument in maven plugin. Fixes gh-9713 #9916
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
|
||
import java.util.Arrays; | ||
import java.util.LinkedList; | ||
import java.util.stream.Collectors; | ||
|
||
import org.codehaus.plexus.util.cli.CommandLineUtils; | ||
|
||
|
@@ -31,14 +32,17 @@ class RunArguments { | |
|
||
private static final String[] NO_ARGS = {}; | ||
|
||
private final LinkedList<String> args; | ||
private final LinkedList<String> args = new LinkedList<>(); | ||
|
||
RunArguments(String arguments) { | ||
this(parseArgs(arguments)); | ||
} | ||
|
||
RunArguments(String[] args) { | ||
this.args = new LinkedList<>(Arrays.asList(args)); | ||
if (args != null) { | ||
this.args.addAll(Arrays.stream(args).filter(s -> s != null && !"".equals(s)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could probably replace the filter with Arrays.stream(args).filter(StringUtils::hasLength).forEach(this.args::add); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, that is a better solution, |
||
.collect(Collectors.toList())); | ||
} | ||
} | ||
|
||
public LinkedList<String> getArgs() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to initialize instance variables inside constructors instead of at the declaration level