Skip to content

Commit b1ffe27

Browse files
committed
[CLI-241] Clarified javadoc of OptionValidator. Thanks to Beluga Behr.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@1544819 13f79535-47bb-0310-9956-ffa450edef68
1 parent ce5ebdf commit b1ffe27

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

RELEASE-NOTES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ NEW FEATURES:
3636

3737
BUG FIXES:
3838

39+
* Clarified behavior of "OptionValidator#validateOption(String)" in case of null input. Thanks to Beluga Behr. (CLI-241)
40+
3941
* Default options will now work correctly with required options that are missing. (CLI-202)
4042

4143
* Default options will now work correctly together with option groups. (CLI-203)

src/changes/changes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<body>
2424

2525
<release version="1.3" date="in SVN" description="This is a maintenance release containing bug fixes.">
26+
<action type="fix" dev="tn" issue="CLI-241" due-to="Beluga Behr">
27+
Clarified behavior of "OptionValidator#validateOption(String)" in case of null input.
28+
</action>
2629
<action type="update" dev="tn" issue="CLI-240" due-to="Beluga Behr">
2730
Small cleanup of Option class.
2831
</action>

src/main/java/org/apache/commons/cli/OptionValidator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,20 @@ final class OptionValidator
3131
* is valid are:
3232
*
3333
* <ul>
34-
* <li><code>opt</code> is not NULL</li>
3534
* <li>a single character <code>opt</code> that is either
3635
* ' '(special case), '?', '@' or a letter</li>
3736
* <li>a multi character <code>opt</code> that only contains
3837
* letters.</li>
3938
* </ul>
39+
* <p>
40+
* In case {@code opt} is {@code null} no further validation is performed.
4041
*
41-
* @param opt The option string to validate
42+
* @param opt The option string to validate, may be null
4243
* @throws IllegalArgumentException if the Option is not valid.
4344
*/
4445
static void validateOption(String opt) throws IllegalArgumentException
4546
{
46-
// check that opt is not NULL
47+
// if opt is NULL do not check further
4748
if (opt == null)
4849
{
4950
return;

0 commit comments

Comments
 (0)