Philippe Bastiani created CLI-317:
-------------------------------------
Summary: NullPointerException thrown by CommandLineParser.parse()
Key: CLI-317
URL: https://issues.apache.org/jira/browse/CLI-317
Project: Commons CLI
Issue Type: Bug
Components: Parser
Affects Versions: 1.5
Reporter: Philippe Bastiani
# First at all, i do not understand why your
*testAmbiguousLongWithoutEqualSingleDash* does not lead to a
AmbiguousOptionException
# For this same test, if I replace the deprecated OptionBuilder with
Option.Builder as follows
{code:java}
options.addOption(Option.builder().option("f").longOpt("foo").optionalArg(true).build());
options.addOption(Option.builder().option("b").longOpt("bar").optionalArg(false).build());
{code}
the test leads to a NPE
{code:java}
java.lang.NullPointerException
at
com.alcatel.asn.byteman.core.shell.command.test.DefaultParser.handleShortAndLongOption(DefaultParser.java:476)
at
com.alcatel.asn.byteman.core.shell.command.test.DefaultParser.handleToken(DefaultParser.java:535)
at
com.alcatel.asn.byteman.core.shell.command.test.DefaultParser.parse(DefaultParser.java:714)
at
com.alcatel.asn.byteman.core.shell.command.test.DefaultParser.parse(DefaultParser.java:677)
at
com.alcatel.asn.byteman.core.shell.command.test.DefaultParser.parse(DefaultParser.java:654)
at
com.alcatel.asn.byteman.core.shell.command.test.DefaultParserTest.testAmbiguousLongWithoutEqualSingleDash(DefaultParserTest.java:140)
at
com.alcatel.asn.byteman.core.shell.command.test.DefaultParserTest.main(DefaultParserTest.java:19)
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)