commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "gg (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CLI-191) Coding error: OptionGroup.setSelected causes java.lang.NullPointerException
Date Sat, 07 Nov 2009 14:17:32 GMT

     [ 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.


Mime
View raw message