Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringIndexOutOfBoundsException when calling usage with empty command name #200

Closed
jansohn opened this issue Oct 10, 2017 · 4 comments
Closed
Milestone

Comments

@jansohn
Copy link

jansohn commented Oct 10, 2017

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.

@remkop remkop added this to the 2.0.0 milestone Oct 10, 2017
@remkop
Copy link
Owner

remkop commented Oct 10, 2017

Thanks for raising this! I was able to reproduce the issue and I'm looking at it now.

@remkop remkop closed this as completed in 4668145 Oct 10, 2017
@remkop
Copy link
Owner

remkop commented Oct 10, 2017

Fixed in master. Please verify.
Thanks again for raising this!

@jansohn
Copy link
Author

jansohn commented Oct 11, 2017

Works, thanks for fixing this!

@remkop
Copy link
Owner

remkop commented Oct 11, 2017

Thanks for verifying. Will look at #201 next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants