Issue Details (XML | Word | Printable)

Key: CLI-149
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Nathan Niesen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons CLI

MissingOptionException.getMessage() changed from CLI 1.0 > 1.1

Created: 16/Jan/08 05:06 PM   Updated: 08/May/08 06:56 AM
Return to search
Component/s: CLI-1.x
Affects Version/s: 1.1
Fix Version/s: 1.2

Time Tracking:
Not Specified

Resolution Date: 08/May/08 06:56 AM


 Description  « Hide
The MissingOptionException.getMessage() string changed from CLI 1.0 > 1.1.

CLI 1.0 was poorly formatted but readable:
Missing required options: -format-source-properties

CLI 1.1 is almost unreadable:
Missing required options: formatsourceproperties

In CLI 1.0 Options.addOption(Option) prefixed the stored options with a "-" and in CLI 1.1 it doesn't.

I would suggest changing Parser.checkRequiredOptions() to add the options to the error message with a prefix of " -":

OLD:
// loop through the required options
while (iter.hasNext())

{ buff.append(iter.next()); }

NEW:
// loop through the required options
while (iter.hasNext())

{ buff.append(" -" + iter.next()); }

Resulting in:
Missing required options: -format -source -properties



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alexandru Luchian added a comment - 28/Mar/08 02:24 PM
Also, there are no spaces between option names.

It should be something like:

NEW:
// loop through the required options
while (iter.hasNext())

{ buff.append(" -" + iter.next() + " "); }

OR

NEW:
// loop through the required options
while (iter.hasNext())

{ buff.append(iter.next() + " "); }

Henri Yandell added a comment - 08/May/08 06:50 AM - edited
Agreed on the whitespace. I don't see why it shouldn't be:

Missing required options: format, source, properties


Henri Yandell added a comment - 08/May/08 06:56 AM
svn ci -m "Adding comma delimited whitespace to the exception message that lists missing required options as requested in CLI-149. I didn't add the requested -, as it could be – or some other prefix. Unit tests also added. "

Sending src/java/org/apache/commons/cli/Parser.java
Sending src/test/org/apache/commons/cli/OptionsTest.java
Sending src/test/org/apache/commons/cli/ParseRequiredTest.java
Transmitting file data ...
Committed revision 654431.