commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dioktos (JIRA)" <>
Subject [jira] Created: (CLI-150) Negative numbers mistaken for options
Date Wed, 23 Jan 2008 15:26:34 GMT
Negative numbers mistaken for options

                 Key: CLI-150
             Project: Commons CLI
          Issue Type: Bug
          Components: CLI-2.x
    Affects Versions: 2.0
         Environment: Sun JDK 1.6, Ubuntu 7.04
            Reporter: Dioktos

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.

View raw message