Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 3141 invoked from network); 15 Sep 2008 22:42:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Sep 2008 22:42:06 -0000 Received: (qmail 7516 invoked by uid 500); 15 Sep 2008 22:42:02 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 7093 invoked by uid 500); 15 Sep 2008 22:42:02 -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 7082 invoked by uid 99); 15 Sep 2008 22:42:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Sep 2008 15:42:01 -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; Mon, 15 Sep 2008 22:41:11 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5F697234C1DD for ; Mon, 15 Sep 2008 15:41:44 -0700 (PDT) Message-ID: <1700517916.1221518504389.JavaMail.jira@brutus> Date: Mon, 15 Sep 2008 15:41:44 -0700 (PDT) From: "Emmanuel Bourg (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (CLI-8) Line separator as first char for helpformatter (footer) throws exception MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CLI-8?page=3Dcom.atlassian.jir= a.plugin.system.issuetabpanels:all-tabpanel ] Emmanuel Bourg updated CLI-8: ----------------------------- Description:=20 This might apply for more than just the footer. I only tested footer so don= 't=20 know. compile and run this example and you will get an exception {code:java} public class CliError { public static void main(String[] args) { Options options =3D new Options(); HelpFormatter formatter =3D new HelpFormatter(); String footer =3D System.getProperty("line.separator")+"Hello world."; formatter.printHelp(80, "foobar", "", options, footer, true); } } {code} result is: {code} java.lang.StringIndexOutOfBoundsException: String index out of range: -1 =09at java.lang.String.charAt(String.java:582) =09at org.apache.commons.cli.HelpFormatter.rtrim(HelpFormatter.java:505) =09at org.apache.commons.cli.HelpFormatter.renderWrappedText(HelpFormatter.= java:416) =09at org.apache.commons.cli.HelpFormatter.printWrapped(HelpFormatter.java:= 324) =09at org.apache.commons.cli.HelpFormatter.printWrapped(HelpFormatter.java:= 318) =09at org.apache.commons.cli.HelpFormatter.printHelp(HelpFormatter.java:212= ) =09at org.apache.commons.cli.HelpFormatter.printHelp(HelpFormatter.java:165= ) =09at com.nokia.em.bts.swupdateautomate.test.CliError.main(CliError.java:21= ) Exception in thread "main" Process terminated with exit code 1 {code} was: This might apply for more than just the footer. I only tested footer so don= 't=20 know. compile and run this example and you will get an exception public class CliError { public static void main(String[] args) { Options options =3D new Options(); HelpFormatter formatter =3D new HelpFormatter(); String footer =3D System.getProperty("line.separator")+"Hello world."; formatter.printHelp(80, "foobar", "", options, footer, true); } } result is: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 =09at java.lang.String.charAt(String.java:582) =09at org.apache.commons.cli.HelpFormatter.rtrim(HelpFormatter.java:505) =09at org.apache.commons.cli.HelpFormatter.renderWrappedText (HelpFormatter.java:416) =09at org.apache.commons.cli.HelpFormatter.printWrapped (HelpFormatter.java:324) =09at org.apache.commons.cli.HelpFormatter.printWrapped (HelpFormatter.java:318) =09at org.apache.commons.cli.HelpFormatter.printHelp (HelpFormatter.java:212) =09at org.apache.commons.cli.HelpFormatter.printHelp (HelpFormatter.java:165) =09at com.nokia.em.bts.swupdateautomate.test.CliError.main (CliError.java:21) Exception in thread "main" Process terminated with exit code 1 Summary: Line separator as first char for helpformatter (footer) th= rows exception (was: [cli] Line separator as first char for helpformatter = (footer) throws exception) > Line separator as first char for helpformatter (footer) throws exception > ------------------------------------------------------------------------ > > Key: CLI-8 > URL: https://issues.apache.org/jira/browse/CLI-8 > Project: Commons CLI > Issue Type: Bug > Components: CLI-1.x > Affects Versions: 1.0 > Environment: Operating System: All > Platform: PC > Reporter: Teemu Kanstr=C3=A9n > Fix For: 1.1 > > > This might apply for more than just the footer. I only tested footer so d= on't=20 > know. > compile and run this example and you will get an exception > {code:java} > public class CliError > { > public static void main(String[] args) > { > Options options =3D new Options(); > HelpFormatter formatter =3D new HelpFormatter(); > String footer =3D System.getProperty("line.separator")+"Hello world."= ; > formatter.printHelp(80, "foobar", "", options, footer, true); > } > } > {code} > result is: > {code} > java.lang.StringIndexOutOfBoundsException: String index out of range: -1 > =09at java.lang.String.charAt(String.java:582) > =09at org.apache.commons.cli.HelpFormatter.rtrim(HelpFormatter.java:505) > =09at org.apache.commons.cli.HelpFormatter.renderWrappedText(HelpFormatte= r.java:416) > =09at org.apache.commons.cli.HelpFormatter.printWrapped(HelpFormatter.jav= a:324) > =09at org.apache.commons.cli.HelpFormatter.printWrapped(HelpFormatter.jav= a:318) > =09at org.apache.commons.cli.HelpFormatter.printHelp(HelpFormatter.java:2= 12) > =09at org.apache.commons.cli.HelpFormatter.printHelp(HelpFormatter.java:1= 65) > =09at com.nokia.em.bts.swupdateautomate.test.CliError.main(CliError.java:= 21) > Exception in thread "main" Process terminated with exit code 1 > {code} --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.