You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "gg (JIRA)" <ji...@apache.org> on 2009/11/07 15:17:32 UTC
[jira] Updated: (CLI-191) Coding error: OptionGroup.setSelected
causes java.lang.NullPointerException
[ https://issues.apache.org/jira/browse/CLI-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
gg updated CLI-191:
-------------------
Description:
Code snippet from OptionGroup.setSelected(Option option):
...
if (selected == null || selected.equals(option.getOpt()))
{
selected = option.getOpt();
}
else
{
throw new AlreadySelectedException(this, option);
}
...
When parameter option is "null" to reset the selected option, selected.equals(option.getOpt()) will obviously fail.
Issue is already fixed in the head revision of 1.3.
was:
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.
> 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);
> }
> ...
> When parameter option is "null" to reset the selected option, selected.equals(option.getOpt()) will obviously fail.
> Issue is already 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.