Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 39640 invoked from network); 23 Aug 2007 22:40:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Aug 2007 22:40:54 -0000 Received: (qmail 11007 invoked by uid 500); 23 Aug 2007 22:40:50 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 10921 invoked by uid 500); 23 Aug 2007 22:40:50 -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 10912 invoked by uid 99); 23 Aug 2007 22:40:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Aug 2007 15:40:50 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Aug 2007 22:41:32 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 854B1714204 for ; Thu, 23 Aug 2007 15:40:30 -0700 (PDT) Message-ID: <1722682.1187908830532.JavaMail.jira@brutus> Date: Thu, 23 Aug 2007 15:40:30 -0700 (PDT) From: "Henri Yandell (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (CLI-6) [cli] 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:comment-tabpanel#action_12522302 ] Henri Yandell commented on CLI-6: --------------------------------- Is a patch for 2.0 still needed? > [cli] 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 > Environment: Operating System: All > Platform: Other > Reporter: Peter Kunszt > Fix For: 2.0 > > Attachments: 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.