@@ -106,7 +106,7 @@ public CommandLine parse(Options options, String[] arguments, Properties propert
106106 expectedOpts = new ArrayList (options .getRequiredOptions ());
107107
108108 // clear the data from the groups
109- for (OptionGroup group : options .getOptionGroups ())
109+ for (final OptionGroup group : options .getOptionGroups ())
110110 {
111111 group .setSelected (null );
112112 }
@@ -115,7 +115,7 @@ public CommandLine parse(Options options, String[] arguments, Properties propert
115115
116116 if (arguments != null )
117117 {
118- for (String argument : arguments )
118+ for (final String argument : arguments )
119119 {
120120 handleToken (argument );
121121 }
@@ -144,24 +144,24 @@ private void handleProperties(Properties properties) throws ParseException
144144 return ;
145145 }
146146
147- for (Enumeration <?> e = properties .propertyNames (); e .hasMoreElements ();)
147+ for (final Enumeration <?> e = properties .propertyNames (); e .hasMoreElements ();)
148148 {
149- String option = e .nextElement ().toString ();
149+ final String option = e .nextElement ().toString ();
150150
151- Option opt = options .getOption (option );
151+ final Option opt = options .getOption (option );
152152 if (opt == null )
153153 {
154154 throw new UnrecognizedOptionException ("Default option wasn't defined" , option );
155155 }
156156
157157 // if the option is part of a group, check if another option of the group has been selected
158- OptionGroup group = options .getOptionGroup (opt );
159- boolean selected = group != null && group .getSelected () != null ;
158+ final OptionGroup group = options .getOptionGroup (opt );
159+ final boolean selected = group != null && group .getSelected () != null ;
160160
161161 if (!cmd .hasOption (option ) && !selected )
162162 {
163163 // get the value from the properties
164- String value = properties .getProperty (option );
164+ final String value = properties .getProperty (option );
165165
166166 if (opt .hasArg ())
167167 {
@@ -275,7 +275,7 @@ private boolean isNegativeNumber(String token)
275275 Double .parseDouble (token );
276276 return true ;
277277 }
278- catch (NumberFormatException e )
278+ catch (final NumberFormatException e )
279279 {
280280 return false ;
281281 }
@@ -305,8 +305,8 @@ private boolean isShortOption(String token)
305305 }
306306
307307 // remove leading "-" and "=value"
308- int pos = token .indexOf ("=" );
309- String optName = pos == -1 ? token .substring (1 ) : token .substring (1 , pos );
308+ final int pos = token .indexOf ("=" );
309+ final String optName = pos == -1 ? token .substring (1 ) : token .substring (1 , pos );
310310 if (options .hasShortOption (optName ))
311311 {
312312 return true ;
@@ -327,8 +327,8 @@ private boolean isLongOption(String token)
327327 return false ;
328328 }
329329
330- int pos = token .indexOf ("=" );
331- String t = pos == -1 ? token : token .substring (0 , pos );
330+ final int pos = token .indexOf ("=" );
331+ final String t = pos == -1 ? token : token .substring (0 , pos );
332332
333333 if (!options .getMatchingOptions (t ).isEmpty ())
334334 {
@@ -401,7 +401,7 @@ private void handleLongOption(String token) throws ParseException
401401 */
402402 private void handleLongOptionWithoutEqual (String token ) throws ParseException
403403 {
404- List <String > matchingOpts = options .getMatchingOptions (token );
404+ final List <String > matchingOpts = options .getMatchingOptions (token );
405405 if (matchingOpts .isEmpty ())
406406 {
407407 handleUnknownToken (currentToken );
@@ -428,13 +428,13 @@ else if (matchingOpts.size() > 1)
428428 */
429429 private void handleLongOptionWithEqual (String token ) throws ParseException
430430 {
431- int pos = token .indexOf ('=' );
431+ final int pos = token .indexOf ('=' );
432432
433- String value = token .substring (pos + 1 );
433+ final String value = token .substring (pos + 1 );
434434
435- String opt = token .substring (0 , pos );
435+ final String opt = token .substring (0 , pos );
436436
437- List <String > matchingOpts = options .getMatchingOptions (opt );
437+ final List <String > matchingOpts = options .getMatchingOptions (opt );
438438 if (matchingOpts .isEmpty ())
439439 {
440440 handleUnknownToken (currentToken );
@@ -445,7 +445,7 @@ else if (matchingOpts.size() > 1)
445445 }
446446 else
447447 {
448- Option option = options .getOption (matchingOpts .get (0 ));
448+ final Option option = options .getOption (matchingOpts .get (0 ));
449449
450450 if (option .acceptsArg ())
451451 {
@@ -481,9 +481,9 @@ else if (matchingOpts.size() > 1)
481481 */
482482 private void handleShortAndLongOption (String token ) throws ParseException
483483 {
484- String t = Util .stripLeadingHyphens (token );
484+ final String t = Util .stripLeadingHyphens (token );
485485
486- int pos = t .indexOf ('=' );
486+ final int pos = t .indexOf ('=' );
487487
488488 if (t .length () == 1 )
489489 {
@@ -512,7 +512,7 @@ else if (!options.getMatchingOptions(t).isEmpty())
512512 else
513513 {
514514 // look for a long prefix (-Xmx512m)
515- String opt = getLongPrefix (t );
515+ final String opt = getLongPrefix (t );
516516
517517 if (opt != null && options .getOption (opt ).acceptsArg ())
518518 {
@@ -537,13 +537,13 @@ else if (isJavaProperty(t))
537537 else
538538 {
539539 // equal sign found (-xxx=yyy)
540- String opt = t .substring (0 , pos );
541- String value = t .substring (pos + 1 );
540+ final String opt = t .substring (0 , pos );
541+ final String value = t .substring (pos + 1 );
542542
543543 if (opt .length () == 1 )
544544 {
545545 // -S=V
546- Option option = options .getOption (opt );
546+ final Option option = options .getOption (opt );
547547 if (option != null && option .acceptsArg ())
548548 {
549549 handleOption (option );
@@ -578,13 +578,13 @@ else if (isJavaProperty(opt))
578578 */
579579 private String getLongPrefix (String token )
580580 {
581- String t = Util .stripLeadingHyphens (token );
581+ final String t = Util .stripLeadingHyphens (token );
582582
583583 int i ;
584584 String opt = null ;
585585 for (i = t .length () - 2 ; i > 1 ; i --)
586586 {
587- String prefix = t .substring (0 , i );
587+ final String prefix = t .substring (0 , i );
588588 if (options .hasLongOption (prefix ))
589589 {
590590 opt = prefix ;
@@ -600,8 +600,8 @@ private String getLongPrefix(String token)
600600 */
601601 private boolean isJavaProperty (String token )
602602 {
603- String opt = token .substring (0 , 1 );
604- Option option = options .getOption (opt );
603+ final String opt = token .substring (0 , 1 );
604+ final Option option = options .getOption (opt );
605605
606606 return option != null && (option .getArgs () >= 2 || option .getArgs () == Option .UNLIMITED_VALUES );
607607 }
@@ -642,7 +642,7 @@ private void updateRequiredOptions(Option option) throws AlreadySelectedExceptio
642642 // if the option is in an OptionGroup make that option the selected option of the group
643643 if (options .getOptionGroup (option ) != null )
644644 {
645- OptionGroup group = options .getOptionGroup (option );
645+ final OptionGroup group = options .getOptionGroup (option );
646646
647647 if (group .isRequired ())
648648 {
@@ -684,7 +684,7 @@ protected void handleConcatenatedOptions(String token) throws ParseException
684684 {
685685 for (int i = 1 ; i < token .length (); i ++)
686686 {
687- String ch = String .valueOf (token .charAt (i ));
687+ final String ch = String .valueOf (token .charAt (i ));
688688
689689 if (options .hasOption (ch ))
690690 {
0 commit comments