Coding error: OptionGroup.setSelected causes java.lang.NullPointerException
---------------------------------------------------------------------------
Key: CLI-191
URL: https://issues.apache.org/jira/browse/CLI-191
Project: Commons CLI
Issue Type: Bug
Affects Versions: 1.2
Reporter: gg
Fix For: 1.3
Code snippet from OptionGroup.setSelected(Option option):
...
if (selected == null || selected.equals(option.getOpt()))
{
selected = option.getOpt();
}
else
{
throw new AlreadySelectedException(this, option);
}
...
This code does not rock. When parameter option is "null" to reset the selected
option, selected.equals(option.getOpt()) will oviously fail.
Fixed in the head revision of 1.3.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.