Skip to content
Permalink
Browse files
[CLI-240] Small cleanup of Options class, thanks to Beluga Behr.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@1544802 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
netomi committed Nov 23, 2013
1 parent f9bc181 commit ce5ebdf348d9b1d2e9c45d22c0d9cf582dcd059c
Showing 3 changed files with 11 additions and 17 deletions.
@@ -72,6 +72,8 @@ BUG FIXES:

CHANGES:

* Small cleanup of Option class. Thanks to Beluga Behr. (CLI-240)

* Options.getRequiredOptions() now returns an unmodifiable list. (CLI-230)

* Clarify javadoc for CommandLine.getOptionValue() that the first specified
@@ -23,6 +23,9 @@
<body>

<release version="1.3" date="in SVN" description="This is a maintenance release containing bug fixes.">
<action type="update" dev="tn" issue="CLI-240" due-to="Beluga Behr">
Small cleanup of Option class.
</action>
<action type="update" dev="tn" issue="CLI-231" due-to="Duncan Jones">
Removed DoubleCheckedLocking test from checkstyle configuration.
</action>
@@ -177,12 +177,7 @@ public int getId()
String getKey()
{
// if 'opt' is null, then it is a 'long' option
if (opt == null)
{
return longOpt;
}

return opt;
return (opt == null) ? longOpt : opt;
}

/**
@@ -435,14 +430,11 @@ public int getArgs()
*/
void addValueForProcessing(String value)
{
switch (numberOfArgs)
if (numberOfArgs == UNINITIALIZED)
{
case UNINITIALIZED:
throw new RuntimeException("NO_ARGS_ALLOWED");

default:
processValue(value);
throw new RuntimeException("NO_ARGS_ALLOWED");
}
processValue(value);
}

/**
@@ -743,12 +735,9 @@ boolean requiresArg()
}
if (numberOfArgs == UNLIMITED_VALUES)
{
return values.size() < 1;
}
else
{
return acceptsArg();
return values.isEmpty();
}
return acceptsArg();
}

/**

0 comments on commit ce5ebdf

Please sign in to comment.