Github user jaredjstewart commented on a diff in the pull request:
https://github.com/apache/geode/pull/699#discussion_r132568184
--- Diff:
geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java ---
@@ -1352,11 +1328,13 @@ protected void parseCommand(final String... args) {
* @see
org.apache.geode.distributed.LocatorLauncher.Command#isCommand(String)
* @see #parseArguments(String...)
*/
- protected void parseMemberName(final String[] args) {
- for (String arg : args) {
- if (!(arg.startsWith(OPTION_PREFIX) || Command.isCommand(arg))) {
- setMemberName(arg);
- break;
+ protected void parseMemberName(final String... args) {
+ if (args != null) {
+ for (String arg : args) {
+ if (!(arg.startsWith(OPTION_PREFIX) || Command.isCommand(arg))) {
--- End diff --
I believe the behavior of this method may contradicts its javadoc, which
says that
> If the argument does **not** start with '-' or is **not** the name of a
Locator launcher command, then the value is presumed to be the member name for
the Locator in GemFire.
Whereas the actual implementation seems to find values which **are** the
name of a Locator launcher command. I would guess that the javadoc is correct
about the intended behavior.
<hr>
P.S. I can't resist writing this in a declarative style with streams :)
```
protected void parseMemberName(final String... args) {
if (args == null) return;
Arrays.stream(args)
.filter(arg -> !(arg.startsWith(OPTION_PREFIX) ||
Command.isCommand(arg)))
.findFirst()
.ifPresent(this::setMemberName);
}
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---