commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 21215] New: - Line separator as first char for helpformatter (footer) throws exception
Date Tue, 01 Jul 2003 09:34:49 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21215>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21215

Line separator as first char for helpformatter (footer) throws exception

           Summary: Line separator as first char for helpformatter (footer)
                    throws exception
           Product: Commons
           Version: 1.0 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: CLI
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: kibaltsis@hotmail.com


This might apply for more than just the footer. I only tested footer so don't 
know.

compile and run this example and you will get an exception

public class CliError
{
  public static void main(String[] args)
  {
    Options options = new Options();
    HelpFormatter formatter = new HelpFormatter();
    String footer = System.getProperty("line.separator")+"Hello world.";
    formatter.printHelp(80, "foobar", "", options, footer, true);
  }
}

result is:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.charAt(String.java:582)
	at org.apache.commons.cli.HelpFormatter.rtrim(HelpFormatter.java:505)
	at org.apache.commons.cli.HelpFormatter.renderWrappedText
(HelpFormatter.java:416)
	at org.apache.commons.cli.HelpFormatter.printWrapped
(HelpFormatter.java:324)
	at org.apache.commons.cli.HelpFormatter.printWrapped
(HelpFormatter.java:318)
	at org.apache.commons.cli.HelpFormatter.printHelp
(HelpFormatter.java:212)
	at org.apache.commons.cli.HelpFormatter.printHelp
(HelpFormatter.java:165)
	at com.nokia.em.bts.swupdateautomate.test.CliError.main
(CliError.java:21)

Exception in thread "main" Process terminated with exit code 1

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message