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

Greg Toombs updated CLI-251:
----------------------------
    Description: 
In WriteableCommandLineImpl.java, the code after this comment:

           // ensure that all parent options are also added

ends up rejecting what should be valid command-line args. If you make a group 
and use it as a child in more than one parent, which is a wholly reasonable 
usage of the API, I think the child only registers one parent and then the "int 
present" counting goes over its maximum and the args are rejected. hasOption 
returns a false positive.

  was:
In GroupImpl.java, the code after this comment:

            // if the child option is present then validate it

ends up rejecting what should be valid command-line args. If you make a group 
and use it as a child in more than one parent, which is a wholly reasonable 
usage of the API, I think the child only registers one parent and then the "int 
present" counting goes over its maximum and the args are rejected. hasOption 
returns a false positive.


> Groups cannot be reused
> -----------------------
>
>                 Key: CLI-251
>                 URL: https://issues.apache.org/jira/browse/CLI-251
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: CLI-2.x, Options definition, Validation
>    Affects Versions: 2.0
>            Reporter: Greg Toombs
>            Priority: Minor
>
> In WriteableCommandLineImpl.java, the code after this comment:
>            // ensure that all parent options are also added
> ends up rejecting what should be valid command-line args. If you make a group 
> and use it as a child in more than one parent, which is a wholly reasonable 
> usage of the API, I think the child only registers one parent and then the 
> "int present" counting goes over its maximum and the args are rejected. 
> hasOption returns a false positive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to