Details
Description
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
Attachments
Issue Links
- is duplicated by
-
CLI-18 HelpFormatter.printHelp(String cmdLineSyntax, String header, Options options, String footer) throws exception if footer contains CR LF
- Closed