DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14786>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14786

Options should not be able to be added more than once

           Summary: Options should not be able to be added more than once
           Product: Commons
           Version: 1.0 Beta 2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: CLI
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


One should not be able to add the same Option (by unique ID) to the Options
object multiple times. Specifically, this causes a problem with required options.

I performed the following set of steps, which resulted in the behavior that the
option I specified was not marked as set in the Parser.requiredOptions List:

Option o = OptionBuilder.isRequired().withDescription("test").create("test");
Options opts = new Options();
opts.addOption(o);
opts.addOption(o);

Now, if I parse a command line like this:

{program} -test

I get an MissingArgumentException thrown from Parser.checkRequiredOptions that
the option was not found. This is because the option has been added to
requiredOptions twice.

I believe that one should not be able to add the same option twice (or this
behavior should be ... er .... optional).

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to