File tree Expand file tree Collapse file tree
main/java/org/apache/commons/cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,6 +72,8 @@ BUG FIXES:
7272
7373CHANGES:
7474
75+ * Small cleanup of Option class. Thanks to Beluga Behr. (CLI-240)
76+
7577 * Options.getRequiredOptions() now returns an unmodifiable list. (CLI-230)
7678
7779 * Clarify javadoc for CommandLine.getOptionValue() that the first specified
Original file line number Diff line number Diff line change 2323 <body >
2424
2525 <release version =" 1.3" date =" in SVN" description =" This is a maintenance release containing bug fixes." >
26+ <action type =" update" dev =" tn" issue =" CLI-240" due-to =" Beluga Behr" >
27+ Small cleanup of Option class.
28+ </action >
2629 <action type =" update" dev =" tn" issue =" CLI-231" due-to =" Duncan Jones" >
2730 Removed DoubleCheckedLocking test from checkstyle configuration.
2831 </action >
Original file line number Diff line number Diff line change @@ -177,12 +177,7 @@ public int getId()
177177 String getKey ()
178178 {
179179 // if 'opt' is null, then it is a 'long' option
180- if (opt == null )
181- {
182- return longOpt ;
183- }
184-
185- return opt ;
180+ return (opt == null ) ? longOpt : opt ;
186181 }
187182
188183 /**
@@ -435,14 +430,11 @@ public int getArgs()
435430 */
436431 void addValueForProcessing (String value )
437432 {
438- switch (numberOfArgs )
433+ if (numberOfArgs == UNINITIALIZED )
439434 {
440- case UNINITIALIZED :
441- throw new RuntimeException ("NO_ARGS_ALLOWED" );
442-
443- default :
444- processValue (value );
435+ throw new RuntimeException ("NO_ARGS_ALLOWED" );
445436 }
437+ processValue (value );
446438 }
447439
448440 /**
@@ -743,12 +735,9 @@ boolean requiresArg()
743735 }
744736 if (numberOfArgs == UNLIMITED_VALUES )
745737 {
746- return values .size () < 1 ;
747- }
748- else
749- {
750- return acceptsArg ();
738+ return values .isEmpty ();
751739 }
740+ return acceptsArg ();
752741 }
753742
754743 /**
You can’t perform that action at this time.
0 commit comments