You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stephan Fuhrmann (JIRA)" <ji...@apache.org> on 2018/06/09 12:31:00 UTC

[jira] [Commented] (CLI-258) PosixParser.parse continues to parse even after non-option parameter is appeared

    [ https://issues.apache.org/jira/browse/CLI-258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16506952#comment-16506952 ] 

Stephan Fuhrmann commented on CLI-258:
--------------------------------------

PosixParser was deprecated:
{quote}@deprecated since 1.3, use the \{@link DefaultParser} instead
{quote}
 

> PosixParser.parse continues to parse even after non-option parameter is appeared
> --------------------------------------------------------------------------------
>
>                 Key: CLI-258
>                 URL: https://issues.apache.org/jira/browse/CLI-258
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: CLI-1.x
>    Affects Versions: 1.3
>            Reporter: Yasuko Komiyama
>            Priority: Major
>
> If PosixParser.parse(Options options, String[] arguments, Properties properties, boolean stopAtNonOption) is called with stopAtNonOption = TRUE, once parse() finds any non-option parameter, it is supposed to stop parsing and treat all the rest of the parameters 'as is'.  But when one or more than one options are appeared before the non-option parameter, the parser continues to parse the parameters even after the non-option parameter.  
>   If the non-option parameter is appeared before any options, the parser stops parsing (as expected).  
> For example, when the option -x and -y are configured, the PosixParser.parse(options, "nonOption -xvalue1 -yvalue2", properties, TRUE) parses the arguments as 'nonOption, -xvalue1, -yvalue2".  But if it is called with "-xvalue1 nonOption -yvalue2", then it parses as '-x, value1, nonOption, -y, value2".  For the latter case the 3rd parameter "-yvalue2" should not be parsed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)