commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CLI-6) Unknown options are ignored instead of throwing UnrecognizedOptionException
Date Thu, 24 Jul 2008 20:01:32 GMT

     [ https://issues.apache.org/jira/browse/CLI-6?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Emmanuel Bourg updated CLI-6:
-----------------------------

      Component/s:     (was: CLI-2.x)
                   CLI-1.x
      Environment:     (was: Operating System: All
Platform: Other)
    Fix Version/s:     (was: 2.0)
                   1.2
          Summary: Unknown options are ignored instead of throwing UnrecognizedOptionException
 (was: [cli] Unknown options are ignored instead of throwing UnrecognizedOptionException)

Retargeting for CLI 1.x since this is not a CLI2 issue.

> Unknown options are ignored instead of throwing UnrecognizedOptionException
> ---------------------------------------------------------------------------
>
>                 Key: CLI-6
>                 URL: https://issues.apache.org/jira/browse/CLI-6
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: CLI-1.x
>    Affects Versions: 1.0
>            Reporter: Peter Kunszt
>             Fix For: 1.2
>
>         Attachments: cli-6.patch, patch
>
>
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message