commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Harrer (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CLI-252) LongOpt falsely detected as ambiguous
Date Thu, 21 May 2015 16:30:17 GMT

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

Simon Harrer updated CLI-252:
-----------------------------
    Description: 
Options options = new Options();
options.addOption(Option.builder().longOpt("importToOpen").hasArg().argName("FILE").build());
options.addOption(Option.builder("i").longOpt("import").hasArg().argName("FILE").build());

Parsing "--import=FILE" is not possible since 1.3 as it throws a AmbiguousOptionException
stating that it cannot decide whether import is import or importToOpen. In 1.2 this is not
an issue. 

The root lies in the new DefaultParser which does a startsWith check internally. 


  was:
Options options = new Options();       options.addOption(Option.builder().longOpt("importToOpen").hasArg().argName("FILE").build());
options.addOption(Option.builder("i").longOpt("import").hasArg().argName("FILE").build());

Parsing "--import=FILE" is not possible since 1.3 as it throws a AmbiguousOptionException
stating that it cannot decide whether import is import or importToOpen. In 1.2 this is not
an issue. 

The root lies in the new DefaultParser which das s startsWith check. 



> LongOpt falsely detected as ambiguous
> -------------------------------------
>
>                 Key: CLI-252
>                 URL: https://issues.apache.org/jira/browse/CLI-252
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: Parser
>    Affects Versions: 1.3
>         Environment: Windows 7, JDK 1.8.0v45
>            Reporter: Simon Harrer
>             Fix For: 1.2
>
>
> Options options = new Options();
> options.addOption(Option.builder().longOpt("importToOpen").hasArg().argName("FILE").build());
> options.addOption(Option.builder("i").longOpt("import").hasArg().argName("FILE").build());
> Parsing "--import=FILE" is not possible since 1.3 as it throws a AmbiguousOptionException
stating that it cannot decide whether import is import or importToOpen. In 1.2 this is not
an issue. 
> The root lies in the new DefaultParser which does a startsWith check internally. 



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

Mime
View raw message