commons-issues mailing list archives

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


Mime
View raw message