Skip to content

Bug: command name of 72 characters creates infinite loop #739

@thefang12

Description

@thefang12

When you try to set the command name that is 72 characters in length (both programmatically and by annotation) CommandLine initialization goes into an infinite loop.

ps: Not sure if the command name character limit is by design but when the name is longer than 72 characters the following exception is thrown:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1

   at java.lang.String.substring(String.java:1967)
   at picocli.CommandLine$Help$Ansi$Text.getStyledChars(CommandLine.java:14072)
   at picocli.CommandLine$Help$TextTable.copy(CommandLine.java:13414)
   at picocli.CommandLine$Help$TextTable.copy(CommandLine.java:13403)
   at picocli.CommandLine$Help$TextTable.putValue(CommandLine.java:13333)
   at picocli.CommandLine$Help$TextTable.addRowValues(CommandLine.java:13265)
   at picocli.CommandLine$Help.insertSynopsisCommandName(CommandLine.java:12221)
   at picocli.CommandLine$Help.detailedSynopsis(CommandLine.java:12067)
   at picocli.CommandLine$Help.synopsis(CommandLine.java:12015)
   at picocli.CommandLine$Model$UsageMessageSpec$4.render(CommandLine.java:6008)
   at picocli.CommandLine.usage(CommandLine.java:2342)
   at picocli.CommandLine.getUsageMessage(CommandLine.java:2326)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions