Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 8078 invoked from network); 24 Jul 2008 20:02:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Jul 2008 20:02:24 -0000 Received: (qmail 15067 invoked by uid 500); 24 Jul 2008 20:02:23 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 14996 invoked by uid 500); 24 Jul 2008 20:02:22 -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 14985 invoked by uid 99); 24 Jul 2008 20:02:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Jul 2008 13:02:22 -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; Thu, 24 Jul 2008 20:01:36 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 36C4E234C185 for ; Thu, 24 Jul 2008 13:01:32 -0700 (PDT) Message-ID: <1068756062.1216929692223.JavaMail.jira@brutus> Date: Thu, 24 Jul 2008 13:01:32 -0700 (PDT) From: "Emmanuel Bourg (JIRA)" To: issues@commons.apache.org Subject: [jira] Reopened: (CLI-6) Unknown options are ignored instead of throwing UnrecognizedOptionException 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-6?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Emmanuel Bourg reopened CLI-6: ------------------------------ > Unknown options are ignored instead of throwing UnrecognizedOptionException > --------------------------------------------------------------------------- > > Key: CLI-6 > URL: https://issues.apache.org/jira/browse/CLI-6 > Project: Commons CLI > Issue Type: Bug > Components: CLI-1.x > Affects Versions: 1.0 > Reporter: Peter Kunszt > Fix For: 1.2 > > Attachments: cli-6.patch, patch > > > CLI does not handle unknown options, i.e. throw an 'UnrecognizedOptionException'. > The reason is that the logic of PosixParser.processOptionToken() is incomplete: > if (this.options.hasOption(token)) > { > currentOption = this.options.getOption(token); > tokens.add(token); > } > else if (stopAtNonOption) > { > eatTheRest = true; > } > ie. if the stopAtNonOption is not set and the token is unknown, it > will be ignored. there has to be a default case added: > else { > tokens.add(token); > } > in which case the caller will throw the proper exception, because > in Parse there is another check whether the option exists. > i would've submitted a patch but did not find where to, sorry. > peter -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.