commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "BELUGA BEHR (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CLI-241) OptionValidator Implementation Does Not Agree With JavaDoc
Date Thu, 04 Jul 2013 15:15:47 GMT
BELUGA BEHR created CLI-241:
-------------------------------

             Summary: OptionValidator Implementation Does Not Agree With JavaDoc
                 Key: CLI-241
                 URL: https://issues.apache.org/jira/browse/CLI-241
             Project: Commons CLI
          Issue Type: Bug
          Components: Validation
    Affects Versions: 1.2
            Reporter: BELUGA BEHR


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");
        }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message