Skip to content

StringIndexOutOfBoundsException when calling usage with empty command name #200

@jansohn

Description

@jansohn

If the name attribute of the @Command annotation is set to an empty string (or space) and usage() is called the following exception is thrown:

java.lang.StringIndexOutOfBoundsException: String index out of range: -5
	at java.lang.String.substring(String.java:1931)
	at picocli.CommandLine$Help.detailedSynopsis(CommandLine.java:2637)
	at picocli.CommandLine$Help.synopsis(CommandLine.java:2536)
	at picocli.CommandLine.usage(CommandLine.java:427)
	at picocli.CommandLine.usage(CommandLine.java:387)
	at picocli.CommandLine.usage(CommandLine.java:377)

I think it's a valid use case to set the name to an empty string.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions