Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.1
-
None
Description
In Groovy 2.5, groovy.util.CliBuilder is a wrapper that delegates to groovy.cli.commons.CliBuilder. However, this wrapper doesn't correctly handle the case when the arguments fail to be parsed.
Here's how it works with the real CliBuilder:
groovy:000> options = new groovy.cli.commons.CliBuilder(stopAtNonOption: false).parse(['-x']) error: Unrecognized option: -x usage: groovy ===> null
And here's what happens with the wrapper:
groovy:000> options = new groovy.util.CliBuilder(stopAtNonOption: false).parse(['-x']) error: Unrecognized option: -x usage: groovy ===> groovy.util.OptionAccessor@6fc3e1a4 groovy:000> options.arguments() ERROR java.lang.NullPointerException: Cannot invoke method arguments() on null object
I get an object that pretends to be null, but isn't. So I can't determine whether the parsing was successful or not.
Attachments
Issue Links
- is related to
-
GROOVY-8759 groovy.cli.picocli.CliBuilder should behave like cli.commons.CliBuilder on invalid options
- Closed