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=17662>.
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=17662

unknown options are ignored instead of throwing UnrecognizedOptionException

           Summary: unknown options are ignored instead of throwing
                    UnrecognizedOptionException
           Product: Commons
           Version: 1.0 Beta 2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: CLI
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


CLI does not handle unknown options, i.e. throw an 'UnrecognizedOptionException'.
The reason is that the logic of PosixParser.processOptionToken() is incomplete:

        if (this.options.hasOption(token))
        {
            currentOption = this.options.getOption(token);
            tokens.add(token);
        }
        else if (stopAtNonOption)
        {
            eatTheRest = true;
        }


ie. if the stopAtNonOption is not set and the token is unknown, it
will be ignored. there has to be a default case added:


          else {
            tokens.add(token);
        }

in which case the caller will throw the proper exception, because
in Parse there is another check whether the option exists.

i would've submitted a patch but did not find where to, sorry.
peter

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

Reply via email to