ilia created CLI-309:
------------------------
Summary: MissingArgumentException when DefaultParser processes an
option value which starts with hyphen/dash.
Key: CLI-309
URL: https://issues.apache.org/jira/browse/CLI-309
Project: Commons CLI
Issue Type: Bug
Components: Parser
Affects Versions: 1.4
Reporter: ilia
When processing option value which starts with hyphen/dash like *--sec-attr
-password1* , exception [1] occurs. If the current token start with dash, it
will be processed as an option and therefore this will not be set as a value to
the previous option, which will cause [1]. The only way to set such value is to
use equals sign like *--sec-attr=-password1*. In this case the whole token is
processed as option=value pair and the correct value will be set.
[1]
{code:java}
org.apache.commons.cli.MissingArgumentException: Missing argument for option:
xorg.apache.commons.cli.MissingArgumentException: Missing argument for option:
x at
org.apache.commons.cli.DefaultParser.checkRequiredArgs(DefaultParser.java:211)
at org.apache.commons.cli.DefaultParser.handleOption(DefaultParser.java:612) at
org.apache.commons.cli.DefaultParser.handleConcatenatedOptions(DefaultParser.java:691)
at
org.apache.commons.cli.DefaultParser.handleShortAndLongOption(DefaultParser.java:533)
at org.apache.commons.cli.DefaultParser.handleToken(DefaultParser.java:243) at
org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:120) at
org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:81) {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)