You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2007/05/22 19:48:16 UTC

[jira] Closed: (CLI-51) [cli] Parameter value "-something" misinterpreted as a parameter

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

Henri Yandell closed CLI-51.
----------------------------

    Resolution: Fixed

svn ci -m "Applying test and fix patch from CLI-51. Thanks to Brian Egge. " src/
Sending        src/java/org/apache/commons/cli/PosixParser.java
Adding         src/test/org/apache/commons/cli/bug/BugCLI51Test.java
Transmitting file data ..
Committed revision 540661.

> [cli] Parameter value "-something" misinterpreted as a parameter
> ----------------------------------------------------------------
>
>                 Key: CLI-51
>                 URL: https://issues.apache.org/jira/browse/CLI-51
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: CLI-1.x
>    Affects Versions: Nightly Builds
>         Environment: Operating System: Windows NT
> Platform: PC
>            Reporter: Nigel King
>         Assigned To: Henri Yandell
>            Priority: Critical
>             Fix For: 1.1
>
>         Attachments: CL51.patch, CL51.patch
>
>
> If a parameter value is passed that contains a hyphen as the (delimited) first 
> character, CLI parses this a parameter. For example using the call
> java myclass -t "-something"
> Results in the parser creating the invalid parameter -o (noting that it is 
> skipping the 's')
> My code is using the Posix parser as follows
> Options options = buildCommandLineOptions();
> CommandLineParser parser = new PosixParser();
> CommandLine commandLine = null;
> try {
> 			
> 	commandLine = parser.parse(options, args);
> }
> catch (ParseException e) {
> 			
> 	System.out.println("Invalid parameters. " + e.getMessage() + NEW_LINE);
> 	System.exit(EXIT_CODE_ERROR);
> }
> This has been tested against the nightly build dated 20050503.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org