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

OptionValidator Implementation Does Not Agree With JavaDoc

    Details

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

      Description

      OptionValidator#validateOption

      It states in its JavaDoc that:

      Validates whether opt is a permissible Option shortOpt. The rules that specify if the opt is valid are:

      • it is not NULL
      • it is a single character that is either ' '(special case), '?', '@' or a letter
      • it is a multi characterthat only contains letters.

      The first check in the code though is:

      // check that opt is not NULL
      if (opt == null)

      { return; }

      Consider changing to...

      // check that opt is not NULL
      if (opt == null)

      { throw new IllegalArgumentException("The option cannot be NULL"); }

        Activity

        Hide
        tn Thomas Neidhart added a comment -

        Clarified the javadoc of the method in r1544819.

        The validation is used by the OptionBuilder where the short option may be null.

        Show
        tn Thomas Neidhart added a comment - Clarified the javadoc of the method in r1544819. The validation is used by the OptionBuilder where the short option may be null.

          People

          • Assignee:
            Unassigned
            Reporter:
            belugabehr BELUGA BEHR
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development