-
Notifications
You must be signed in to change notification settings - Fork 446
Closed
Labels
Milestone
Description
When running Groovy CliBuilder tests with picocli 4.3.0, the following error occurs:
- CliBuilderTest.testAnnotationsInterfaceToStringWithName
- CliBuilderTest.testMandatoryParametersDoNotConsumeOtherOptions
- CliBuilderTest.testMultipleOccurrencesSeparateSeparate3
- CliBuilderTest.testLongOptionsRequireDoubleHyphenByDefault
- CliBuilderTest.testAcceptLongOptionsWithSingleHyphen_usage
- CliBuilderTest.testGroovyDocAntExample
- CliBuilderTest.testAnnotationsInterfaceToStringWithUsage
java.lang.NullPointerException
at picocli.CommandLine$Help$DefaultParamLabelRenderer.renderParameterLabel(CommandLine.java:15041)
at picocli.CommandLine$Help.createDetailedSynopsisOptionsText(CommandLine.java:14146)
at picocli.CommandLine$Help.detailedSynopsis(CommandLine.java:14072)
at picocli.CommandLine$Help.synopsis(CommandLine.java:14026)
at picocli.CommandLine$Model$UsageMessageSpec$5.render(CommandLine.java:7209)
at picocli.CommandLine.usage(CommandLine.java:2565)
at picocli.CommandLine.usage(CommandLine.java:2543)
at picocli.CommandLine.usage(CommandLine.java:2499)
at picocli.CommandLine$usage.call(Unknown Source)
at groovy.cli.picocli.CliBuilder.printUsage(CliBuilder.groovy:644)
The error occurs on this line:
String split = argSpec.splitRegexSynopsisLabel().isEmpty() ? argSpec.splitRegex() : argSpec.splitRegexSynopsisLabel();which suggests that argSpec.splitRegexSynopsisLabel() returns null.
Looking at the ArgSpec constructor, this seems to be caused by a copy-and-paste bug:
// actual
splitRegex = builder.splitRegex == null ? "" : builder.splitRegex;
splitRegexSynopsisLabel = builder.splitRegex == null ? "" : builder.splitRegexSynopsisLabel;Should be:
splitRegex = builder.splitRegex == null ? "" : builder.splitRegex;
splitRegexSynopsisLabel = builder.splitRegexSynopsisLabel== null ? "" : builder.splitRegexSynopsisLabel;