Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 66597 invoked from network); 30 Jul 2008 20:21:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Jul 2008 20:21:54 -0000 Received: (qmail 26814 invoked by uid 500); 30 Jul 2008 20:21:52 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 26734 invoked by uid 500); 30 Jul 2008 20:21:51 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 26723 invoked by uid 99); 30 Jul 2008 20:21:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jul 2008 13:21:51 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jul 2008 20:21:05 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id B8656234C181 for ; Wed, 30 Jul 2008 13:21:31 -0700 (PDT) Message-ID: <1339696878.1217449291754.JavaMail.jira@brutus> Date: Wed, 30 Jul 2008 13:21:31 -0700 (PDT) From: "Oliver Heger (JIRA)" To: issues@commons.apache.org Subject: [jira] Resolved: (CLI-150) Negative numbers mistaken for options In-Reply-To: <18078596.1201101994311.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CLI-150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oliver Heger resolved CLI-150. ------------------------------ Resolution: Fixed Fix applied in revision 681191. WriteableCommandLineImpl.looksLikeOption() now tries harder to find out whether an element of the command line is an option. Instead of simply checking for a possible option prefix, it now also verifies whether an option with such a name exists in the current group. > Negative numbers mistaken for options > ------------------------------------- > > Key: CLI-150 > URL: https://issues.apache.org/jira/browse/CLI-150 > Project: Commons CLI > Issue Type: Bug > Components: Parser > Environment: Sun JDK 1.6, Ubuntu 7.04 > Reporter: Dioktos > Fix For: 2.0 > > Attachments: BugCLI150Test.java, patchCL150.patch > > > 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.