You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Emmanuel Bourg (JIRA)" <ji...@apache.org> on 2008/05/29 18:27:45 UTC
[jira] Commented: (CLI-150) Negative numbers mistaken for options
[ https://issues.apache.org/jira/browse/CLI-150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600822#action_12600822 ]
Emmanuel Bourg commented on CLI-150:
------------------------------------
The PosixParser in CLI 1 suffers from the same issue. The GnuParser works fine. I don't know if it's worth trying to fix the PosixParser.
> Negative numbers mistaken for options
> -------------------------------------
>
> Key: CLI-150
> URL: https://issues.apache.org/jira/browse/CLI-150
> Project: Commons CLI
> Issue Type: Bug
> Components: CLI-2.x
> Environment: Sun JDK 1.6, Ubuntu 7.04
> Reporter: Dioktos
> Fix For: 2.0
>
>
> If an option has a negative numerical argument, the parser mistakes it for another option and throws an error. For example, consider:
> {{Argument numArg = aBuilder.withValidator(NumberValidator.getNumberInstance()).withMinimum(1).withMaximum(1).create();}}
> {{Option numOpt = oBuilder.withLongName("num").withArgument(numArg).create();}}
> {{Group options = gBuilder.withOption(numOpt).create();}}
> Then parsing {{--num -0.1}} results in:
> {{Unexpected -0.1 while processing --num}}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.