Skip to content

Fix for CLI-271#9

Closed
laeubi wants to merge 1 commit into
apache:trunkfrom
laeubi:CLI-271
Closed

Fix for CLI-271#9
laeubi wants to merge 1 commit into
apache:trunkfrom
laeubi:CLI-271

Conversation

@laeubi

@laeubi laeubi commented Mar 15, 2017

Copy link
Copy Markdown

Add the posibility to use Options as a parameter for fetching values from the CommandLine.

Add some Tests for coverage

@britter britter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising, but there are some unrelated changes. I think we should discuss the method returning a Properties object in a separated thread.

String[] args = new String[] { "-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar" };

Options options = new Options();
Option option_D = OptionBuilder.withValueSeparator().hasOptionalArgs(2).create('D');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use camel case for variable names

* even if the option doesn't exists
* @since 1.4
*/
public Properties getOptionProperties(Option option)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is a Properties instance returned and not a Map as it says in the first line of the JavaDoc?

@laeubi laeubi Mar 17, 2017

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied the String variant of this including the javadoc, so I assume it was changed some time in the past and the java doc was not changed. In fact Properties extends Hashtable and that implements Map so Properties are also a Map.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see. Makes sense make this symmetric with the String param based version.

}
}

return props;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method does not belong to CLI-271. We should better create a separate jira to be able to discuss its usefulness separately.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does it not belong to CLI271? Its an adoption of the previous String variant (what is now delegating to this method) that I adjusted a bit to remove the requirements of string matching.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thank you for the clarification.

}

@Test
public void testHashCode() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, but unrelated to CLI-271

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain how I remove this from the PR? Must I create a new commit/PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since, I have to apply this via SVN, I can remove it for you.

@asfgit asfgit closed this in 269eae1 Mar 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants