Uploaded image for project: 'Commons CLI'
  1. Commons CLI
  2. CLI-191

Coding error: OptionGroup.setSelected causes java.lang.NullPointerException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.3
    • Component/s: None
    • Labels:
      None

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              prong gg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: