commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [48/50] [abbrv] commons-cli git commit: Add final modifier to local variables.
Date Thu, 08 Jun 2017 17:37:17 GMT
Add final modifier to local variables.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@1797673 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-cli/commit/357a8b0b
Tree: http://git-wip-us.apache.org/repos/asf/commons-cli/tree/357a8b0b
Diff: http://git-wip-us.apache.org/repos/asf/commons-cli/diff/357a8b0b

Branch: refs/heads/master
Commit: 357a8b0b8f1090db29e0d541a9419f570a78457b
Parents: 9a048d0
Author: Gary D. Gregory <ggregory@apache.org>
Authored: Mon Jun 5 16:37:32 2017 +0000
Committer: Gary D. Gregory <ggregory@apache.org>
Committed: Mon Jun 5 16:37:32 2017 +0000

----------------------------------------------------------------------
 .../commons/cli/AmbiguousOptionException.java   |   4 +-
 .../org/apache/commons/cli/CommandLine.java     |  32 +-
 .../org/apache/commons/cli/DefaultParser.java   |  62 ++--
 .../java/org/apache/commons/cli/GnuParser.java  |   6 +-
 .../org/apache/commons/cli/HelpFormatter.java   |  48 +--
 .../commons/cli/MissingOptionException.java     |   4 +-
 .../java/org/apache/commons/cli/Option.java     |  10 +-
 .../org/apache/commons/cli/OptionGroup.java     |   6 +-
 .../org/apache/commons/cli/OptionValidator.java |   4 +-
 .../java/org/apache/commons/cli/Options.java    |  12 +-
 .../java/org/apache/commons/cli/Parser.java     |  36 +--
 .../commons/cli/PatternOptionBuilder.java       |   4 +-
 .../org/apache/commons/cli/PosixParser.java     |  16 +-
 .../org/apache/commons/cli/TypeHandler.java     |  10 +-
 src/main/java/org/apache/commons/cli/Util.java  |   2 +-
 .../org/apache/commons/cli/ApplicationTest.java |  58 ++--
 .../commons/cli/ArgumentIsOptionTest.java       |  12 +-
 .../org/apache/commons/cli/CommandLineTest.java |  62 ++--
 .../apache/commons/cli/HelpFormatterTest.java   | 200 ++++++------
 .../apache/commons/cli/OptionBuilderTest.java   |  26 +-
 .../org/apache/commons/cli/OptionGroupTest.java |  70 ++--
 .../java/org/apache/commons/cli/OptionTest.java |  18 +-
 .../org/apache/commons/cli/OptionsTest.java     |  46 +--
 .../org/apache/commons/cli/ParserTestCase.java  | 316 +++++++++----------
 .../commons/cli/PatternOptionBuilderTest.java   |  56 ++--
 .../java/org/apache/commons/cli/ValueTest.java  | 100 +++---
 .../java/org/apache/commons/cli/ValuesTest.java |   6 +-
 .../apache/commons/cli/bug/BugCLI133Test.java   |   8 +-
 .../apache/commons/cli/bug/BugCLI13Test.java    |   5 +-
 .../apache/commons/cli/bug/BugCLI148Test.java   |  12 +-
 .../apache/commons/cli/bug/BugCLI162Test.java   |  22 +-
 .../apache/commons/cli/bug/BugCLI18Test.java    |   6 +-
 .../apache/commons/cli/bug/BugCLI252Test.java   |   2 +-
 .../apache/commons/cli/bug/BugCLI265Test.java   |  14 +-
 .../apache/commons/cli/bug/BugCLI266Test.java   |  24 +-
 .../apache/commons/cli/bug/BugCLI71Test.java    |  16 +-
 .../org/apache/commons/cli/bug/BugsTest.java    | 112 +++----
 37 files changed, 724 insertions(+), 723 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java b/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
index eede231..151aa8f 100644
--- a/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
+++ b/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
@@ -66,11 +66,11 @@ public class AmbiguousOptionException extends UnrecognizedOptionException
      */
     private static String createMessage(String option, Collection<String> matchingOptions)
     {
-        StringBuilder buf = new StringBuilder("Ambiguous option: '");
+        final StringBuilder buf = new StringBuilder("Ambiguous option: '");
         buf.append(option);
         buf.append("'  (could be: ");
 
-        Iterator<String> it = matchingOptions.iterator();
+        final Iterator<String> it = matchingOptions.iterator();
         while (it.hasNext())
         {
             buf.append("'");

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/CommandLine.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/CommandLine.java b/src/main/java/org/apache/commons/cli/CommandLine.java
index 57de683..cca26f6 100644
--- a/src/main/java/org/apache/commons/cli/CommandLine.java
+++ b/src/main/java/org/apache/commons/cli/CommandLine.java
@@ -104,7 +104,7 @@ public class CommandLine implements Serializable
         {
             return getParsedOptionValue(opt);
         }
-        catch (ParseException pe)
+        catch (final ParseException pe)
         {
             System.err.println("Exception found converting " + opt + " to desired type: " + pe.getMessage());
             return null;
@@ -126,7 +126,7 @@ public class CommandLine implements Serializable
         {
             return null;
         }
-        String res = getOptionValue(option);
+        final String res = getOptionValue(option);
         if (res == null)
         {
             return null;
@@ -188,7 +188,7 @@ public class CommandLine implements Serializable
         {
             return null;
         }
-        String[] values = getOptionValues(option);
+        final String[] values = getOptionValues(option);
         return (values == null) ? null : values[0];
     }
 
@@ -226,9 +226,9 @@ public class CommandLine implements Serializable
      */
     public String[] getOptionValues(Option option)
     {
-        List<String> values = new ArrayList<String>();
+        final List<String> values = new ArrayList<String>();
 
-        for (Option processedOption : options)
+        for (final Option processedOption : options)
         {
             if (processedOption.equals(option))
             {
@@ -260,7 +260,7 @@ public class CommandLine implements Serializable
     private Option resolveOption(String opt)
     {
         opt = Util.stripLeadingHyphens(opt);
-        for (Option option : options)
+        for (final Option option : options)
         {
             if (opt.equals(option.getOpt()))
             {
@@ -300,7 +300,7 @@ public class CommandLine implements Serializable
      */
     public String getOptionValue(Option option, String defaultValue)
     {
-        String answer = getOptionValue(option);
+        final String answer = getOptionValue(option);
         return (answer != null) ? answer : defaultValue;
     }
 
@@ -347,13 +347,13 @@ public class CommandLine implements Serializable
      */
     public Properties getOptionProperties(Option option)
     {
-        Properties props = new Properties();
+        final Properties props = new Properties();
 
-        for (Option processedOption : options)
+        for (final Option processedOption : options)
         {
             if (processedOption.equals(option))
             {
-                List<String> values = processedOption.getValuesList();
+                final List<String> values = processedOption.getValuesList();
                 if (values.size() >= 2)
                 {
                     // use the first 2 arguments as the key/value pair
@@ -385,13 +385,13 @@ public class CommandLine implements Serializable
      */
     public Properties getOptionProperties(String opt)
     {
-        Properties props = new Properties();
+        final Properties props = new Properties();
 
-        for (Option option : options)
+        for (final Option option : options)
         {
             if (opt.equals(option.getOpt()) || opt.equals(option.getLongOpt()))
             {
-                List<String> values = option.getValuesList();
+                final List<String> values = option.getValuesList();
                 if (values.size() >= 2)
                 {
                     // use the first 2 arguments as the key/value pair
@@ -415,7 +415,7 @@ public class CommandLine implements Serializable
      */
     public String[] getArgs()
     {
-        String[] answer = new String[args.size()];
+        final String[] answer = new String[args.size()];
 
         args.toArray(answer);
 
@@ -492,10 +492,10 @@ public class CommandLine implements Serializable
      */
     public Option[] getOptions()
     {
-        Collection<Option> processed = options;
+        final Collection<Option> processed = options;
 
         // reinitialise array
-        Option[] optionsArray = new Option[processed.size()];
+        final Option[] optionsArray = new Option[processed.size()];
 
         // return the array
         return processed.toArray(optionsArray);

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/DefaultParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/DefaultParser.java b/src/main/java/org/apache/commons/cli/DefaultParser.java
index 69f01f4..33d772e 100644
--- a/src/main/java/org/apache/commons/cli/DefaultParser.java
+++ b/src/main/java/org/apache/commons/cli/DefaultParser.java
@@ -106,7 +106,7 @@ public class DefaultParser implements CommandLineParser
         expectedOpts = new ArrayList(options.getRequiredOptions());
 
         // clear the data from the groups
-        for (OptionGroup group : options.getOptionGroups())
+        for (final OptionGroup group : options.getOptionGroups())
         {
             group.setSelected(null);
         }
@@ -115,7 +115,7 @@ public class DefaultParser implements CommandLineParser
 
         if (arguments != null)
         {
-            for (String argument : arguments)
+            for (final String argument : arguments)
             {
                 handleToken(argument);
             }
@@ -144,24 +144,24 @@ public class DefaultParser implements CommandLineParser
             return;
         }
 
-        for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();)
+        for (final Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();)
         {
-            String option = e.nextElement().toString();
+            final String option = e.nextElement().toString();
 
-            Option opt = options.getOption(option);
+            final Option opt = options.getOption(option);
             if (opt == null)
             {
                 throw new UnrecognizedOptionException("Default option wasn't defined", option);
             }
 
             // if the option is part of a group, check if another option of the group has been selected
-            OptionGroup group = options.getOptionGroup(opt);
-            boolean selected = group != null && group.getSelected() != null;
+            final OptionGroup group = options.getOptionGroup(opt);
+            final boolean selected = group != null && group.getSelected() != null;
 
             if (!cmd.hasOption(option) && !selected)
             {
                 // get the value from the properties
-                String value = properties.getProperty(option);
+                final String value = properties.getProperty(option);
 
                 if (opt.hasArg())
                 {
@@ -275,7 +275,7 @@ public class DefaultParser implements CommandLineParser
             Double.parseDouble(token);
             return true;
         }
-        catch (NumberFormatException e)
+        catch (final NumberFormatException e)
         {
             return false;
         }
@@ -305,8 +305,8 @@ public class DefaultParser implements CommandLineParser
         }
 
         // remove leading "-" and "=value"
-        int pos = token.indexOf("=");
-        String optName = pos == -1 ? token.substring(1) : token.substring(1, pos);
+        final int pos = token.indexOf("=");
+        final String optName = pos == -1 ? token.substring(1) : token.substring(1, pos);
         if (options.hasShortOption(optName))
         {
             return true;
@@ -327,8 +327,8 @@ public class DefaultParser implements CommandLineParser
             return false;
         }
 
-        int pos = token.indexOf("=");
-        String t = pos == -1 ? token : token.substring(0, pos);
+        final int pos = token.indexOf("=");
+        final String t = pos == -1 ? token : token.substring(0, pos);
 
         if (!options.getMatchingOptions(t).isEmpty())
         {
@@ -401,7 +401,7 @@ public class DefaultParser implements CommandLineParser
      */
     private void handleLongOptionWithoutEqual(String token) throws ParseException
     {
-        List<String> matchingOpts = options.getMatchingOptions(token);
+        final List<String> matchingOpts = options.getMatchingOptions(token);
         if (matchingOpts.isEmpty())
         {
             handleUnknownToken(currentToken);
@@ -428,13 +428,13 @@ public class DefaultParser implements CommandLineParser
      */
     private void handleLongOptionWithEqual(String token) throws ParseException
     {
-        int pos = token.indexOf('=');
+        final int pos = token.indexOf('=');
 
-        String value = token.substring(pos + 1);
+        final String value = token.substring(pos + 1);
 
-        String opt = token.substring(0, pos);
+        final String opt = token.substring(0, pos);
 
-        List<String> matchingOpts = options.getMatchingOptions(opt);
+        final List<String> matchingOpts = options.getMatchingOptions(opt);
         if (matchingOpts.isEmpty())
         {
             handleUnknownToken(currentToken);
@@ -445,7 +445,7 @@ public class DefaultParser implements CommandLineParser
         }
         else
         {
-            Option option = options.getOption(matchingOpts.get(0));
+            final Option option = options.getOption(matchingOpts.get(0));
 
             if (option.acceptsArg())
             {
@@ -481,9 +481,9 @@ public class DefaultParser implements CommandLineParser
      */
     private void handleShortAndLongOption(String token) throws ParseException
     {
-        String t = Util.stripLeadingHyphens(token);
+        final String t = Util.stripLeadingHyphens(token);
 
-        int pos = t.indexOf('=');
+        final int pos = t.indexOf('=');
 
         if (t.length() == 1)
         {
@@ -512,7 +512,7 @@ public class DefaultParser implements CommandLineParser
             else
             {
                 // look for a long prefix (-Xmx512m)
-                String opt = getLongPrefix(t);
+                final String opt = getLongPrefix(t);
 
                 if (opt != null && options.getOption(opt).acceptsArg())
                 {
@@ -537,13 +537,13 @@ public class DefaultParser implements CommandLineParser
         else
         {
             // equal sign found (-xxx=yyy)
-            String opt = t.substring(0, pos);
-            String value = t.substring(pos + 1);
+            final String opt = t.substring(0, pos);
+            final String value = t.substring(pos + 1);
 
             if (opt.length() == 1)
             {
                 // -S=V
-                Option option = options.getOption(opt);
+                final Option option = options.getOption(opt);
                 if (option != null && option.acceptsArg())
                 {
                     handleOption(option);
@@ -578,13 +578,13 @@ public class DefaultParser implements CommandLineParser
      */
     private String getLongPrefix(String token)
     {
-        String t = Util.stripLeadingHyphens(token);
+        final String t = Util.stripLeadingHyphens(token);
 
         int i;
         String opt = null;
         for (i = t.length() - 2; i > 1; i--)
         {
-            String prefix = t.substring(0, i);
+            final String prefix = t.substring(0, i);
             if (options.hasLongOption(prefix))
             {
                 opt = prefix;
@@ -600,8 +600,8 @@ public class DefaultParser implements CommandLineParser
      */
     private boolean isJavaProperty(String token)
     {
-        String opt = token.substring(0, 1);
-        Option option = options.getOption(opt);
+        final String opt = token.substring(0, 1);
+        final Option option = options.getOption(opt);
 
         return option != null && (option.getArgs() >= 2 || option.getArgs() == Option.UNLIMITED_VALUES);
     }
@@ -642,7 +642,7 @@ public class DefaultParser implements CommandLineParser
         // if the option is in an OptionGroup make that option the selected option of the group
         if (options.getOptionGroup(option) != null)
         {
-            OptionGroup group = options.getOptionGroup(option);
+            final OptionGroup group = options.getOptionGroup(option);
 
             if (group.isRequired())
             {
@@ -684,7 +684,7 @@ public class DefaultParser implements CommandLineParser
     {
         for (int i = 1; i < token.length(); i++)
         {
-            String ch = String.valueOf(token.charAt(i));
+            final String ch = String.valueOf(token.charAt(i));
 
             if (options.hasOption(ch))
             {

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/GnuParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/GnuParser.java b/src/main/java/org/apache/commons/cli/GnuParser.java
index fb7de87..bb55940 100644
--- a/src/main/java/org/apache/commons/cli/GnuParser.java
+++ b/src/main/java/org/apache/commons/cli/GnuParser.java
@@ -50,13 +50,13 @@ public class GnuParser extends Parser
     @Override
     protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)
     {
-        List<String> tokens = new ArrayList<String>();
+        final List<String> tokens = new ArrayList<String>();
 
         boolean eatTheRest = false;
 
         for (int i = 0; i < arguments.length; i++)
         {
-            String arg = arguments[i];
+            final String arg = arguments[i];
 
             if ("--".equals(arg))
             {
@@ -69,7 +69,7 @@ public class GnuParser extends Parser
             }
             else if (arg.startsWith("-"))
             {
-                String opt = Util.stripLeadingHyphens(arg);
+                final String opt = Util.stripLeadingHyphens(arg);
 
                 if (options.hasOption(opt))
                 {

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/HelpFormatter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/HelpFormatter.java b/src/main/java/org/apache/commons/cli/HelpFormatter.java
index 4f45c12..46e48d9 100644
--- a/src/main/java/org/apache/commons/cli/HelpFormatter.java
+++ b/src/main/java/org/apache/commons/cli/HelpFormatter.java
@@ -487,7 +487,7 @@ public class HelpFormatter
     public void printHelp(int width, String cmdLineSyntax, String header,
                           Options options, String footer, boolean autoUsage)
     {
-        PrintWriter pw = new PrintWriter(System.out);
+        final PrintWriter pw = new PrintWriter(System.out);
 
         printHelp(pw, width, cmdLineSyntax, header, options, getLeftPadding(), getDescPadding(), footer, autoUsage);
         pw.flush();
@@ -579,24 +579,24 @@ public class HelpFormatter
     public void printUsage(PrintWriter pw, int width, String app, Options options)
     {
         // initialise the string buffer
-        StringBuffer buff = new StringBuffer(getSyntaxPrefix()).append(app).append(" ");
+        final StringBuffer buff = new StringBuffer(getSyntaxPrefix()).append(app).append(" ");
 
         // create a list for processed option groups
-        Collection<OptionGroup> processedGroups = new ArrayList<OptionGroup>();
+        final Collection<OptionGroup> processedGroups = new ArrayList<OptionGroup>();
 
-        List<Option> optList = new ArrayList<Option>(options.getOptions());
+        final List<Option> optList = new ArrayList<Option>(options.getOptions());
         if (getOptionComparator() != null)
         {
             Collections.sort(optList, getOptionComparator());
         }
         // iterate over the options
-        for (Iterator<Option> it = optList.iterator(); it.hasNext();)
+        for (final Iterator<Option> it = optList.iterator(); it.hasNext();)
         {
             // get the next Option
-            Option option = it.next();
+            final Option option = it.next();
 
             // check if the option is part of an OptionGroup
-            OptionGroup group = options.getOptionGroup(option);
+            final OptionGroup group = options.getOptionGroup(option);
 
             // if the option is part of a group 
             if (group != null)
@@ -648,13 +648,13 @@ public class HelpFormatter
             buff.append("[");
         }
 
-        List<Option> optList = new ArrayList<Option>(group.getOptions());
+        final List<Option> optList = new ArrayList<Option>(group.getOptions());
         if (getOptionComparator() != null)
         {
             Collections.sort(optList, getOptionComparator());
         }
         // for each option in the OptionGroup
-        for (Iterator<Option> it = optList.iterator(); it.hasNext();)
+        for (final Iterator<Option> it = optList.iterator(); it.hasNext();)
         {
             // whether the option is required or not is handled at group level
             appendOption(buff, it.next(), true);
@@ -718,7 +718,7 @@ public class HelpFormatter
      */
     public void printUsage(PrintWriter pw, int width, String cmdLineSyntax)
     {
-        int argPos = cmdLineSyntax.indexOf(' ') + 1;
+        final int argPos = cmdLineSyntax.indexOf(' ') + 1;
 
         printWrapped(pw, width, getSyntaxPrefix().length() + argPos, getSyntaxPrefix() + cmdLineSyntax);
     }
@@ -738,7 +738,7 @@ public class HelpFormatter
     public void printOptions(PrintWriter pw, int width, Options options, 
                              int leftPad, int descPad)
     {
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
 
         renderOptions(sb, width, options, leftPad, descPad);
         pw.println(sb.toString());
@@ -766,7 +766,7 @@ public class HelpFormatter
      */
     public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text)
     {
-        StringBuffer sb = new StringBuffer(text.length());
+        final StringBuffer sb = new StringBuffer(text.length());
 
         renderWrappedTextBlock(sb, width, nextLineTabStop, text);
         pw.println(sb.toString());
@@ -798,18 +798,18 @@ public class HelpFormatter
         // the longest opt string this list will be then used to 
         // sort options ascending
         int max = 0;
-        List<StringBuffer> prefixList = new ArrayList<StringBuffer>();
+        final List<StringBuffer> prefixList = new ArrayList<StringBuffer>();
 
-        List<Option> optList = options.helpOptions();
+        final List<Option> optList = options.helpOptions();
 
         if (getOptionComparator() != null)
         {
             Collections.sort(optList, getOptionComparator());
         }
 
-        for (Option option : optList)
+        for (final Option option : optList)
         {
-            StringBuffer optBuf = new StringBuffer();
+            final StringBuffer optBuf = new StringBuffer();
 
             if (option.getOpt() == null)
             {
@@ -827,7 +827,7 @@ public class HelpFormatter
 
             if (option.hasArg())
             {
-                String argName = option.getArgName();
+                final String argName = option.getArgName();
                 if (argName != null && argName.length() == 0)
                 {
                     // if the option has a blank argname
@@ -846,10 +846,10 @@ public class HelpFormatter
 
         int x = 0;
 
-        for (Iterator<Option> it = optList.iterator(); it.hasNext();)
+        for (final Iterator<Option> it = optList.iterator(); it.hasNext();)
         {
-            Option option = it.next();
-            StringBuilder optBuf = new StringBuilder(prefixList.get(x++).toString());
+            final Option option = it.next();
+            final StringBuilder optBuf = new StringBuilder(prefixList.get(x++).toString());
 
             if (optBuf.length() < max)
             {
@@ -858,7 +858,7 @@ public class HelpFormatter
 
             optBuf.append(dpad);
 
-            int nextLineTabStop = max + descPad;
+            final int nextLineTabStop = max + descPad;
 
             if (option.getDescription() != null)
             {
@@ -943,7 +943,7 @@ public class HelpFormatter
     {
         try
         {
-            BufferedReader in = new BufferedReader(new StringReader(text));
+            final BufferedReader in = new BufferedReader(new StringReader(text));
             String line;
             boolean firstLine = true;
             while ((line = in.readLine()) != null)
@@ -959,7 +959,7 @@ public class HelpFormatter
                 renderWrappedText(sb, width, nextLineTabStop, line);
             }
         }
-        catch (IOException e) //NOPMD
+        catch (final IOException e) //NOPMD
         {
             // cannot happen
         }
@@ -1032,7 +1032,7 @@ public class HelpFormatter
      */
     protected String createPadding(int len)
     {
-        char[] padding = new char[len];
+        final char[] padding = new char[len];
         Arrays.fill(padding, ' ');
 
         return new String(padding);

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/MissingOptionException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/MissingOptionException.java b/src/main/java/org/apache/commons/cli/MissingOptionException.java
index 05cb0bb..f9cac0e 100644
--- a/src/main/java/org/apache/commons/cli/MissingOptionException.java
+++ b/src/main/java/org/apache/commons/cli/MissingOptionException.java
@@ -77,11 +77,11 @@ public class MissingOptionException extends ParseException
      */
     private static String createMessage(List<?> missingOptions)
     {
-        StringBuilder buf = new StringBuilder("Missing required option");
+        final StringBuilder buf = new StringBuilder("Missing required option");
         buf.append(missingOptions.size() == 1 ? "" : "s");
         buf.append(": ");
 
-        Iterator<?> it = missingOptions.iterator();
+        final Iterator<?> it = missingOptions.iterator();
         while (it.hasNext())
         {
             buf.append(it.next());

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/Option.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/Option.java b/src/main/java/org/apache/commons/cli/Option.java
index 0b16059..35f2546 100644
--- a/src/main/java/org/apache/commons/cli/Option.java
+++ b/src/main/java/org/apache/commons/cli/Option.java
@@ -463,7 +463,7 @@ public class Option implements Cloneable, Serializable
         if (hasValueSeparator())
         {
             // get the separator character
-            char sep = getValueSeparator();
+            final char sep = getValueSeparator();
 
             // store the index for the value separator
             int index = value.indexOf(sep);
@@ -553,7 +553,7 @@ public class Option implements Cloneable, Serializable
      */
     public String getValue(String defaultValue)
     {
-        String value = getValue();
+        final String value = getValue();
 
         return (value != null) ? value : defaultValue;
     }
@@ -587,7 +587,7 @@ public class Option implements Cloneable, Serializable
     @Override
     public String toString()
     {
-        StringBuilder buf = new StringBuilder().append("[ option: ");
+        final StringBuilder buf = new StringBuilder().append("[ option: ");
 
         buf.append(opt);
 
@@ -681,11 +681,11 @@ public class Option implements Cloneable, Serializable
     {
         try
         {
-            Option option = (Option) super.clone();
+            final Option option = (Option) super.clone();
             option.values = new ArrayList<String>(values);
             return option;
         }
-        catch (CloneNotSupportedException cnse)
+        catch (final CloneNotSupportedException cnse)
         {
             throw new RuntimeException("A CloneNotSupportedException was thrown: " + cnse.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/OptionGroup.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/OptionGroup.java b/src/main/java/org/apache/commons/cli/OptionGroup.java
index dc6d5db..3f52ff7 100644
--- a/src/main/java/org/apache/commons/cli/OptionGroup.java
+++ b/src/main/java/org/apache/commons/cli/OptionGroup.java
@@ -139,15 +139,15 @@ public class OptionGroup implements Serializable
     @Override
     public String toString()
     {
-        StringBuilder buff = new StringBuilder();
+        final StringBuilder buff = new StringBuilder();
         
-        Iterator<Option> iter = getOptions().iterator();
+        final Iterator<Option> iter = getOptions().iterator();
 
         buff.append("[");
 
         while (iter.hasNext())
         {
-            Option option = iter.next();
+            final Option option = iter.next();
 
             if (option.getOpt() != null)
             {

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/OptionValidator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/OptionValidator.java b/src/main/java/org/apache/commons/cli/OptionValidator.java
index 44e2434..f761f12 100644
--- a/src/main/java/org/apache/commons/cli/OptionValidator.java
+++ b/src/main/java/org/apache/commons/cli/OptionValidator.java
@@ -53,7 +53,7 @@ final class OptionValidator
         // handle the single character opt
         if (opt.length() == 1)
         {
-            char ch = opt.charAt(0);
+            final char ch = opt.charAt(0);
 
             if (!isValidOpt(ch))
             {
@@ -64,7 +64,7 @@ final class OptionValidator
         // handle the multi character opt
         else
         {
-            for (char ch : opt.toCharArray())
+            for (final char ch : opt.toCharArray())
             {
                 if (!isValidChar(ch))
                 {

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/Options.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/Options.java b/src/main/java/org/apache/commons/cli/Options.java
index 3468148..056d647 100644
--- a/src/main/java/org/apache/commons/cli/Options.java
+++ b/src/main/java/org/apache/commons/cli/Options.java
@@ -72,7 +72,7 @@ public class Options implements Serializable
             requiredOpts.add(group);
         }
 
-        for (Option option : group.getOptions())
+        for (final Option option : group.getOptions())
         {
             // an Option cannot be required if it is in an
             // OptionGroup, either the group is required or
@@ -175,7 +175,7 @@ public class Options implements Serializable
      */
     public Options addRequiredOption(String opt, String longOpt, boolean hasArg, String description)
     {
-        Option option = new Option(opt, longOpt, hasArg, description);
+        final Option option = new Option(opt, longOpt, hasArg, description);
         option.setRequired(true);
         addOption(option);
         return this;
@@ -189,7 +189,7 @@ public class Options implements Serializable
      */
     public Options addOption(Option opt)
     {
-        String key = opt.getKey();
+        final String key = opt.getKey();
 
         // add it to the long option list
         if (opt.hasLongOpt())
@@ -275,7 +275,7 @@ public class Options implements Serializable
     {
         opt = Util.stripLeadingHyphens(opt);
         
-        List<String> matchingOpts = new ArrayList<String>();
+        final List<String> matchingOpts = new ArrayList<String>();
 
         // for a perfect match return the single option only
         if (longOpts.keySet().contains(opt))
@@ -283,7 +283,7 @@ public class Options implements Serializable
             return Collections.singletonList(opt);
         }
 
-        for (String longOpt : longOpts.keySet())
+        for (final String longOpt : longOpts.keySet())
         {
             if (longOpt.startsWith(opt))
             {
@@ -354,7 +354,7 @@ public class Options implements Serializable
     @Override
     public String toString()
     {
-        StringBuilder buf = new StringBuilder();
+        final StringBuilder buf = new StringBuilder();
 
         buf.append("[ Options: [ short ");
         buf.append(shortOpts.toString());

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/Parser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/Parser.java b/src/main/java/org/apache/commons/cli/Parser.java
index 62909e3..8fd0b5f 100644
--- a/src/main/java/org/apache/commons/cli/Parser.java
+++ b/src/main/java/org/apache/commons/cli/Parser.java
@@ -146,13 +146,13 @@ public abstract class Parser implements CommandLineParser
             throws ParseException
     {
         // clear out the data in options in case it's been used before (CLI-71)
-        for (Option opt : options.helpOptions())
+        for (final Option opt : options.helpOptions())
         {
             opt.clearValues();
         }
         
         // clear the data from the groups
-        for (OptionGroup group : options.getOptionGroups())
+        for (final OptionGroup group : options.getOptionGroups())
         {
             group.setSelected(null);
         }        
@@ -169,14 +169,14 @@ public abstract class Parser implements CommandLineParser
             arguments = new String[0];
         }
 
-        List<String> tokenList = Arrays.asList(flatten(getOptions(), arguments, stopAtNonOption));
+        final List<String> tokenList = Arrays.asList(flatten(getOptions(), arguments, stopAtNonOption));
 
-        ListIterator<String> iterator = tokenList.listIterator();
+        final ListIterator<String> iterator = tokenList.listIterator();
 
         // process each flattened token
         while (iterator.hasNext())
         {
-            String t = iterator.next();
+            final String t = iterator.next();
 
             // the value is the double-dash
             if ("--".equals(t))
@@ -227,7 +227,7 @@ public abstract class Parser implements CommandLineParser
             {
                 while (iterator.hasNext())
                 {
-                    String str = iterator.next();
+                    final String str = iterator.next();
 
                     // ensure only one double-dash is added
                     if (!"--".equals(str))
@@ -258,24 +258,24 @@ public abstract class Parser implements CommandLineParser
             return;
         }
 
-        for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();)
+        for (final Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();)
         {
-            String option = e.nextElement().toString();
+            final String option = e.nextElement().toString();
             
-            Option opt = options.getOption(option);
+            final Option opt = options.getOption(option);
             if (opt == null)
             {
                 throw new UnrecognizedOptionException("Default option wasn't defined", option);
             }
             
             // if the option is part of a group, check if another option of the group has been selected
-            OptionGroup group = options.getOptionGroup(opt);
-            boolean selected = group != null && group.getSelected() != null;
+            final OptionGroup group = options.getOptionGroup(opt);
+            final boolean selected = group != null && group.getSelected() != null;
             
             if (!cmd.hasOption(option) && !selected)
             {
                 // get the value from the properties instance
-                String value = properties.getProperty(option);
+                final String value = properties.getProperty(option);
 
                 if (opt.hasArg())
                 {
@@ -285,7 +285,7 @@ public abstract class Parser implements CommandLineParser
                         {
                             opt.addValueForProcessing(value);
                         }
-                        catch (RuntimeException exp) //NOPMD
+                        catch (final RuntimeException exp) //NOPMD
                         {
                             // if we cannot add the value don't worry about it
                         }
@@ -337,7 +337,7 @@ public abstract class Parser implements CommandLineParser
         // loop until an option is found
         while (iter.hasNext())
         {
-            String str = iter.next();
+            final String str = iter.next();
             
             // found an Option, not an argument
             if (getOptions().hasOption(str) && str.startsWith("-"))
@@ -351,7 +351,7 @@ public abstract class Parser implements CommandLineParser
             {
                 opt.addValueForProcessing(Util.stripLeadingAndTrailingQuotes(str));
             }
-            catch (RuntimeException exp)
+            catch (final RuntimeException exp)
             {
                 iter.previous();
                 break;
@@ -375,7 +375,7 @@ public abstract class Parser implements CommandLineParser
      */
     protected void processOption(String arg, ListIterator<String> iter) throws ParseException
     {
-        boolean hasOption = getOptions().hasOption(arg);
+        final boolean hasOption = getOptions().hasOption(arg);
 
         // if there is no option throw an UnrecognizedOptionException
         if (!hasOption)
@@ -384,7 +384,7 @@ public abstract class Parser implements CommandLineParser
         }
 
         // get the option represented by arg
-        Option opt = (Option) getOptions().getOption(arg).clone();
+        final Option opt = (Option) getOptions().getOption(arg).clone();
         
         // update the required options and groups
         updateRequiredOptions(opt);
@@ -417,7 +417,7 @@ public abstract class Parser implements CommandLineParser
         // option of the group
         if (getOptions().getOptionGroup(opt) != null)
         {
-            OptionGroup group = getOptions().getOptionGroup(opt);
+            final OptionGroup group = getOptions().getOptionGroup(opt);
 
             if (group.isRequired())
             {

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/PatternOptionBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/PatternOptionBuilder.java b/src/main/java/org/apache/commons/cli/PatternOptionBuilder.java
index aef8773..69002b5 100644
--- a/src/main/java/org/apache/commons/cli/PatternOptionBuilder.java
+++ b/src/main/java/org/apache/commons/cli/PatternOptionBuilder.java
@@ -153,11 +153,11 @@ public class PatternOptionBuilder
         boolean required = false;
         Class<?> type = null;
 
-        Options options = new Options();
+        final Options options = new Options();
 
         for (int i = 0; i < pattern.length(); i++)
         {
-            char ch = pattern.charAt(i);
+            final char ch = pattern.charAt(i);
 
             // a value code comes after an option and specifies
             // details about it

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/PosixParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/PosixParser.java b/src/main/java/org/apache/commons/cli/PosixParser.java
index 4a79017..53ceb51 100644
--- a/src/main/java/org/apache/commons/cli/PosixParser.java
+++ b/src/main/java/org/apache/commons/cli/PosixParser.java
@@ -99,13 +99,13 @@ public class PosixParser extends Parser
         this.options = options;
 
         // an iterator for the command line tokens
-        Iterator<String> iter = Arrays.asList(arguments).iterator();
+        final Iterator<String> iter = Arrays.asList(arguments).iterator();
 
         // process each command line token
         while (iter.hasNext())
         {
             // get the next command line token
-            String token = iter.next();
+            final String token = iter.next();
 
             // single or double hyphen
             if ("-".equals(token) || "--".equals(token))
@@ -116,10 +116,10 @@ public class PosixParser extends Parser
             // handle long option --foo or --foo=bar
             else if (token.startsWith("--"))
             {
-                int pos = token.indexOf('=');
-                String opt = pos == -1 ? token : token.substring(0, pos); // --foo
+                final int pos = token.indexOf('=');
+                final String opt = pos == -1 ? token : token.substring(0, pos); // --foo
                 
-                List<String> matchingOpts = options.getMatchingOptions(opt);
+                final List<String> matchingOpts = options.getMatchingOptions(opt);
 
                 if (matchingOpts.isEmpty())
                 {
@@ -149,12 +149,12 @@ public class PosixParser extends Parser
                 }
                 else if (!options.getMatchingOptions(token).isEmpty())
                 {
-                    List<String> matchingOpts = options.getMatchingOptions(token);
+                    final List<String> matchingOpts = options.getMatchingOptions(token);
                     if (matchingOpts.size() > 1)
                     {
                         throw new AmbiguousOptionException(token, matchingOpts);
                     }
-                    Option opt = options.getOption(matchingOpts.get(0));
+                    final Option opt = options.getOption(matchingOpts.get(0));
                     processOptionToken("-" + opt.getLongOpt(), stopAtNonOption);
                 }
                 // requires bursting
@@ -265,7 +265,7 @@ public class PosixParser extends Parser
     {
         for (int i = 1; i < token.length(); i++)
         {
-            String ch = String.valueOf(token.charAt(i));
+            final String ch = String.valueOf(token.charAt(i));
 
             if (options.hasOption(ch))
             {

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/TypeHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/TypeHandler.java b/src/main/java/org/apache/commons/cli/TypeHandler.java
index f981265..f27a587 100644
--- a/src/main/java/org/apache/commons/cli/TypeHandler.java
+++ b/src/main/java/org/apache/commons/cli/TypeHandler.java
@@ -118,7 +118,7 @@ public class TypeHandler
         {
             cl = Class.forName(classname);
         }
-        catch (ClassNotFoundException cnfe)
+        catch (final ClassNotFoundException cnfe)
         {
             throw new ParseException("Unable to find the class: " + classname);
         }
@@ -127,7 +127,7 @@ public class TypeHandler
         {
             return cl.newInstance();
         }
-        catch (Exception e)
+        catch (final Exception e)
         {
             throw new ParseException(e.getClass().getName() + "; Unable to create an instance of: " + classname);
         }
@@ -151,7 +151,7 @@ public class TypeHandler
             }
             return Long.valueOf(str);
         }
-        catch (NumberFormatException e)
+        catch (final NumberFormatException e)
         {
             throw new ParseException(e.getMessage());
         }
@@ -170,7 +170,7 @@ public class TypeHandler
         {
             return Class.forName(classname);
         }
-        catch (ClassNotFoundException e)
+        catch (final ClassNotFoundException e)
         {
             throw new ParseException("Unable to find the class: " + classname);
         }
@@ -205,7 +205,7 @@ public class TypeHandler
         {
             return new URL(str);
         }
-        catch (MalformedURLException e)
+        catch (final MalformedURLException e)
         {
             throw new ParseException("Unable to parse the URL: " + str);
         }

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/main/java/org/apache/commons/cli/Util.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/cli/Util.java b/src/main/java/org/apache/commons/cli/Util.java
index d316b1c..fe22d6c 100644
--- a/src/main/java/org/apache/commons/cli/Util.java
+++ b/src/main/java/org/apache/commons/cli/Util.java
@@ -61,7 +61,7 @@ final class Util
      */
     static String stripLeadingAndTrailingQuotes(String str)
     {
-        int length = str.length();
+        final int length = str.length();
         if (length > 1 && str.startsWith("\"") && str.endsWith("\"") && str.substring(1, length - 1).indexOf('"') == -1)
         {
             str = str.substring(1, length - 1);

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/test/java/org/apache/commons/cli/ApplicationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/cli/ApplicationTest.java b/src/test/java/org/apache/commons/cli/ApplicationTest.java
index 7fffbb9..4162bbf 100644
--- a/src/test/java/org/apache/commons/cli/ApplicationTest.java
+++ b/src/test/java/org/apache/commons/cli/ApplicationTest.java
@@ -44,8 +44,8 @@ public class ApplicationTest
     @Test
     public void testLs() throws Exception {
         // create the command line parser
-        CommandLineParser parser = new PosixParser();
-        Options options = new Options();
+        final CommandLineParser parser = new PosixParser();
+        final Options options = new Options();
         options.addOption( "a", "all", false, "do not hide entries starting with ." );
         options.addOption( "A", "almost-all", false, "do not list implied . and .." );
         options.addOption( "b", "escape", false, "print octal escapes for nongraphic characters" );
@@ -58,9 +58,9 @@ public class ApplicationTest
         options.addOption( "c", false, "with -lt: sort by, and show, ctime (time of last modification of file status information) with -l:show ctime and sort by name otherwise: sort by ctime" );
         options.addOption( "C", false, "list entries by columns" );
 
-        String[] args = new String[]{ "--block-size=10" };
+        final String[] args = new String[]{ "--block-size=10" };
 
-        CommandLine line = parser.parse( options, args );
+        final CommandLine line = parser.parse( options, args );
         assertTrue( line.hasOption( "block-size" ) );
         assertEquals( line.getOptionValue( "block-size" ), "10" );
     }
@@ -71,8 +71,8 @@ public class ApplicationTest
     @Test
     public void testAnt() throws Exception {
         // use the GNU parser
-        CommandLineParser parser = new GnuParser( );
-        Options options = new Options();
+        final CommandLineParser parser = new GnuParser( );
+        final Options options = new Options();
         options.addOption( "help", false, "print this message" );
         options.addOption( "projecthelp", false, "print project help information" );
         options.addOption( "version", false, "print the version information and exit" );
@@ -90,14 +90,14 @@ public class ApplicationTest
                            //, null, true, , false, true );
         options.addOption( "find", true, "search for buildfile towards the root of the filesystem and use it" );
 
-        String[] args = new String[]{ "-buildfile", "mybuild.xml",
+        final String[] args = new String[]{ "-buildfile", "mybuild.xml",
             "-Dproperty=value", "-Dproperty1=value1",
             "-projecthelp" };
 
-        CommandLine line = parser.parse( options, args );
+        final CommandLine line = parser.parse( options, args );
 
         // check multiple values
-        String[] opts = line.getOptionValues( "D" );
+        final String[] opts = line.getOptionValues( "D" );
         assertEquals( "property", opts[0] );
         assertEquals( "value", opts[1] );
         assertEquals( "property1", opts[2] );
@@ -112,7 +112,7 @@ public class ApplicationTest
 
     @Test
     public void testGroovy() throws Exception {
-        Options options = new Options();
+        final Options options = new Options();
 
         options.addOption(
             OptionBuilder.withLongOpt("define").
@@ -171,8 +171,8 @@ public class ApplicationTest
             .withLongOpt("autosplit")
             .create('a'));
 
-        Parser parser = new PosixParser();
-        CommandLine line = parser.parse(options, new String[] { "-e", "println 'hello'" }, true);
+        final Parser parser = new PosixParser();
+        final CommandLine line = parser.parse(options, new String[] { "-e", "println 'hello'" }, true);
 
         assertTrue(line.hasOption('e'));
         assertEquals("println 'hello'", line.getOptionValue('e'));
@@ -184,10 +184,10 @@ public class ApplicationTest
     @Test
     public void testMan()
     {
-        String cmdLine =
+        final String cmdLine =
                 "man [-c|-f|-k|-w|-tZT device] [-adlhu7V] [-Mpath] [-Ppager] [-Slist] " +
                         "[-msystem] [-pstring] [-Llocale] [-eextension] [section] page ...";
-        Options options = new Options().
+        final Options options = new Options().
                 addOption("a", "all", false, "find all matching manual pages.").
                 addOption("d", "debug", false, "emit debugging messages.").
                 addOption("e", "extension", false, "limit search to extension type 'extension'.").
@@ -222,9 +222,9 @@ public class ApplicationTest
                 addOption("V", "version", false, "show version.").
                 addOption("h", "help", false, "show this usage message.");
 
-        HelpFormatter hf = new HelpFormatter();
+        final HelpFormatter hf = new HelpFormatter();
         final String EOL = System.getProperty("line.separator");
-        StringWriter out = new StringWriter();
+        final StringWriter out = new StringWriter();
         hf.printHelp(new PrintWriter(out), 60, cmdLine, null, options, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null, false);
         assertEquals("usage: man [-c|-f|-k|-w|-tZT device] [-adlhu7V] [-Mpath]" + EOL +
                         "           [-Ppager] [-Slist] [-msystem] [-pstring]" + EOL +
@@ -275,37 +275,37 @@ public class ApplicationTest
      */
     @Test
     public void testNLT() throws Exception {
-        Option help = new Option("h", "help", false, "print this message");
-        Option version = new Option("v", "version", false, "print version information");
-        Option newRun = new Option("n", "new", false, "Create NLT cache entries only for new items");
-        Option trackerRun = new Option("t", "tracker", false, "Create NLT cache entries only for tracker items");
+        final Option help = new Option("h", "help", false, "print this message");
+        final Option version = new Option("v", "version", false, "print version information");
+        final Option newRun = new Option("n", "new", false, "Create NLT cache entries only for new items");
+        final Option trackerRun = new Option("t", "tracker", false, "Create NLT cache entries only for tracker items");
 
-        Option timeLimit = OptionBuilder.withLongOpt("limit").hasArg()
+        final Option timeLimit = OptionBuilder.withLongOpt("limit").hasArg()
                                         .withValueSeparator()
                                         .withDescription("Set time limit for execution, in minutes")
                                         .create("l");
 
-        Option age = OptionBuilder.withLongOpt("age").hasArg()
+        final Option age = OptionBuilder.withLongOpt("age").hasArg()
                                   .withValueSeparator()
                                   .withDescription("Age (in days) of cache item before being recomputed")
                                   .create("a");
 
-        Option server = OptionBuilder.withLongOpt("server").hasArg()
+        final Option server = OptionBuilder.withLongOpt("server").hasArg()
                                      .withValueSeparator()
                                      .withDescription("The NLT server address")
                                      .create("s");
 
-        Option numResults = OptionBuilder.withLongOpt("results").hasArg()
+        final Option numResults = OptionBuilder.withLongOpt("results").hasArg()
                                          .withValueSeparator()
                                          .withDescription("Number of results per item")
                                          .create("r");
 
-        Option configFile = OptionBuilder.withLongOpt("file").hasArg()
+        final Option configFile = OptionBuilder.withLongOpt("file").hasArg()
                                          .withValueSeparator()
                                          .withDescription("Use the specified configuration file")
                                          .create();
 
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption(help);
         options.addOption(version);
         options.addOption(newRun);
@@ -317,9 +317,9 @@ public class ApplicationTest
         options.addOption(configFile);
 
         // create the command line parser
-        CommandLineParser parser = new PosixParser();
+        final CommandLineParser parser = new PosixParser();
 
-        String[] args = new String[] {
+        final String[] args = new String[] {
                 "-v",
                 "-l",
                 "10",
@@ -329,7 +329,7 @@ public class ApplicationTest
                 "filename"
             };
 
-        CommandLine line = parser.parse(options, args);
+        final CommandLine line = parser.parse(options, args);
         assertTrue(line.hasOption("v"));
         assertEquals(line.getOptionValue("l"), "10");
         assertEquals(line.getOptionValue("limit"), "10");

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/test/java/org/apache/commons/cli/ArgumentIsOptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/cli/ArgumentIsOptionTest.java b/src/test/java/org/apache/commons/cli/ArgumentIsOptionTest.java
index cd716bd..c10bc83 100644
--- a/src/test/java/org/apache/commons/cli/ArgumentIsOptionTest.java
+++ b/src/test/java/org/apache/commons/cli/ArgumentIsOptionTest.java
@@ -40,13 +40,13 @@ public class ArgumentIsOptionTest
     @Test
     public void testOptionAndOptionWithArgument() throws Exception
     {
-        String[] args = new String[]{
+        final String[] args = new String[]{
                 "-p",
                 "-attr",
                 "p"
         };
 
-        CommandLine cl = parser.parse(options, args);
+        final CommandLine cl = parser.parse(options, args);
         assertTrue("Confirm -p is set", cl.hasOption("p"));
         assertTrue("Confirm -attr is set", cl.hasOption("attr"));
         assertTrue("Confirm arg of -attr", cl.getOptionValue("attr").equals("p"));
@@ -56,12 +56,12 @@ public class ArgumentIsOptionTest
     @Test
     public void testOptionWithArgument() throws Exception
     {
-        String[] args = new String[]{
+        final String[] args = new String[]{
                 "-attr",
                 "p"
         };
 
-        CommandLine cl = parser.parse(options, args);
+        final CommandLine cl = parser.parse(options, args);
         assertFalse("Confirm -p is set", cl.hasOption("p"));
         assertTrue("Confirm -attr is set", cl.hasOption("attr"));
         assertTrue("Confirm arg of -attr",
@@ -72,11 +72,11 @@ public class ArgumentIsOptionTest
     @Test
     public void testOption() throws Exception
     {
-        String[] args = new String[]{
+        final String[] args = new String[]{
                 "-p"
         };
 
-        CommandLine cl = parser.parse(options, args);
+        final CommandLine cl = parser.parse(options, args);
         assertTrue("Confirm -p is set", cl.hasOption("p"));
         assertFalse("Confirm -attr is not set", cl.hasOption("attr"));
         assertTrue("Confirm all arguments recognized", cl.getArgs().length == 0);

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/test/java/org/apache/commons/cli/CommandLineTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/cli/CommandLineTest.java b/src/test/java/org/apache/commons/cli/CommandLineTest.java
index 8ef0768..cf22712 100644
--- a/src/test/java/org/apache/commons/cli/CommandLineTest.java
+++ b/src/test/java/org/apache/commons/cli/CommandLineTest.java
@@ -31,16 +31,16 @@ public class CommandLineTest
     @Test
     public void testGetOptionProperties() throws Exception
     {
-        String[] args = new String[] { "-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar" };
+        final String[] args = new String[] { "-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar" };
 
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption(OptionBuilder.withValueSeparator().hasOptionalArgs(2).create('D'));
         options.addOption(OptionBuilder.withValueSeparator().hasArgs(2).withLongOpt("property").create());
 
-        Parser parser = new GnuParser();
-        CommandLine cl = parser.parse(options, args);
+        final Parser parser = new GnuParser();
+        final CommandLine cl = parser.parse(options, args);
 
-        Properties props = cl.getOptionProperties("D");
+        final Properties props = cl.getOptionProperties("D");
         assertNotNull("null properties", props);
         assertEquals("number of properties in " + props, 4, props.size());
         assertEquals("property 1", "value1", props.getProperty("param1"));
@@ -54,18 +54,18 @@ public class CommandLineTest
     @Test
     public void testGetOptionPropertiesWithOption() throws Exception
     {
-        String[] args = new String[] { "-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar" };
+        final String[] args = new String[] { "-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar" };
 
-        Options options = new Options();
-        Option option_D = OptionBuilder.withValueSeparator().hasOptionalArgs(2).create('D');
-        Option option_property = OptionBuilder.withValueSeparator().hasArgs(2).withLongOpt("property").create();
+        final Options options = new Options();
+        final Option option_D = OptionBuilder.withValueSeparator().hasOptionalArgs(2).create('D');
+        final Option option_property = OptionBuilder.withValueSeparator().hasArgs(2).withLongOpt("property").create();
         options.addOption(option_D);
         options.addOption(option_property);
 
-        Parser parser = new GnuParser();
-        CommandLine cl = parser.parse(options, args);
+        final Parser parser = new GnuParser();
+        final CommandLine cl = parser.parse(options, args);
 
-        Properties props = cl.getOptionProperties(option_D);
+        final Properties props = cl.getOptionProperties(option_D);
         assertNotNull("null properties", props);
         assertEquals("number of properties in " + props, 4, props.size());
         assertEquals("property 1", "value1", props.getProperty("param1"));
@@ -79,7 +79,7 @@ public class CommandLineTest
     @Test
     public void testGetOptions()
     {
-        CommandLine cmd = new CommandLine();
+        final CommandLine cmd = new CommandLine();
         assertNotNull(cmd.getOptions());
         assertEquals(0, cmd.getOptions().length);
         
@@ -92,12 +92,12 @@ public class CommandLineTest
 
     @Test
     public void testGetParsedOptionValue() throws Exception {
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption(OptionBuilder.hasArg().withType(Number.class).create("i"));
         options.addOption(OptionBuilder.hasArg().create("f"));
         
-        CommandLineParser parser = new DefaultParser();
-        CommandLine cmd = parser.parse(options, new String[] { "-i", "123", "-f", "foo" });
+        final CommandLineParser parser = new DefaultParser();
+        final CommandLine cmd = parser.parse(options, new String[] { "-i", "123", "-f", "foo" });
         
         assertEquals(123, ((Number) cmd.getParsedOptionValue("i")).intValue());
         assertEquals("foo", cmd.getParsedOptionValue("f"));
@@ -105,12 +105,12 @@ public class CommandLineTest
     
     @Test
     public void testGetParsedOptionValueWithChar() throws Exception {
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption(Option.builder("i").hasArg().type(Number.class).build());
         options.addOption(Option.builder("f").hasArg().build());
         
-        CommandLineParser parser = new DefaultParser();
-        CommandLine cmd = parser.parse(options, new String[] { "-i", "123", "-f", "foo" });
+        final CommandLineParser parser = new DefaultParser();
+        final CommandLine cmd = parser.parse(options, new String[] { "-i", "123", "-f", "foo" });
         
         assertEquals(123, ((Number) cmd.getParsedOptionValue('i')).intValue());
         assertEquals("foo", cmd.getParsedOptionValue('f'));
@@ -118,14 +118,14 @@ public class CommandLineTest
     
     @Test
     public void testGetParsedOptionValueWithOption() throws Exception {
-        Options options = new Options();
-        Option opt_i = Option.builder("i").hasArg().type(Number.class).build();
-        Option opt_f = Option.builder("f").hasArg().build();
+        final Options options = new Options();
+        final Option opt_i = Option.builder("i").hasArg().type(Number.class).build();
+        final Option opt_f = Option.builder("f").hasArg().build();
         options.addOption(opt_i);
         options.addOption(opt_f);
         
-        CommandLineParser parser = new DefaultParser();
-        CommandLine cmd = parser.parse(options, new String[] { "-i", "123", "-f", "foo" });
+        final CommandLineParser parser = new DefaultParser();
+        final CommandLine cmd = parser.parse(options, new String[] { "-i", "123", "-f", "foo" });
         
         assertEquals(123, ((Number) cmd.getParsedOptionValue(opt_i)).intValue());
         assertEquals("foo", cmd.getParsedOptionValue(opt_f));
@@ -133,13 +133,13 @@ public class CommandLineTest
     
     @Test
     public void testNullhOption() throws Exception {
-        Options options = new Options();
-        Option opt_i = Option.builder("i").hasArg().type(Number.class).build();
-        Option opt_f = Option.builder("f").hasArg().build();
+        final Options options = new Options();
+        final Option opt_i = Option.builder("i").hasArg().type(Number.class).build();
+        final Option opt_f = Option.builder("f").hasArg().build();
         options.addOption(opt_i);
         options.addOption(opt_f);
-        CommandLineParser parser = new DefaultParser();
-        CommandLine cmd = parser.parse(options, new String[] { "-i", "123", "-f", "foo" });
+        final CommandLineParser parser = new DefaultParser();
+        final CommandLine cmd = parser.parse(options, new String[] { "-i", "123", "-f", "foo" });
         assertNull(cmd.getOptionValue((Option)null));
         assertNull(cmd.getParsedOptionValue((Option)null));
     }
@@ -148,10 +148,10 @@ public class CommandLineTest
     public void testBuilder()
         throws Exception
     {
-        CommandLine.Builder builder = new CommandLine.Builder();
+        final CommandLine.Builder builder = new CommandLine.Builder();
         builder.addArg( "foo" ).addArg( "bar" );
         builder.addOption( Option.builder( "T" ).build() );
-        CommandLine cmd = builder.build();
+        final CommandLine cmd = builder.build();
 
         assertEquals( "foo", cmd.getArgs()[0] );
         assertEquals( "bar", cmd.getArgList().get( 1 ) );

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/test/java/org/apache/commons/cli/HelpFormatterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/cli/HelpFormatterTest.java b/src/test/java/org/apache/commons/cli/HelpFormatterTest.java
index 847a268..6036d97 100644
--- a/src/test/java/org/apache/commons/cli/HelpFormatterTest.java
+++ b/src/test/java/org/apache/commons/cli/HelpFormatterTest.java
@@ -37,7 +37,7 @@ public class HelpFormatterTest
     @Test
     public void testFindWrapPos() throws Exception
     {
-        HelpFormatter hf = new HelpFormatter();
+        final HelpFormatter hf = new HelpFormatter();
 
         String text = "This is a test.";
         // text width should be max 8; the wrap position is 7
@@ -65,13 +65,13 @@ public class HelpFormatterTest
     @Test
     public void testRenderWrappedTextWordCut()
     {
-        int width = 7;
-        int padding = 0;
-        String text = "Thisisatest.";
-        String expected = "Thisisa" + EOL + 
+        final int width = 7;
+        final int padding = 0;
+        final String text = "Thisisatest.";
+        final String expected = "Thisisa" + EOL + 
                           "test.";
         
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
         new HelpFormatter().renderWrappedText(sb, width, padding, text);
         assertEquals("cut and wrap", expected, sb.toString());
     }
@@ -80,13 +80,13 @@ public class HelpFormatterTest
     public void testRenderWrappedTextSingleLine()
     {
         // single line text
-        int width = 12;
-        int padding = 0;
-        String text = "This is a test.";
-        String expected = "This is a" + EOL + 
+        final int width = 12;
+        final int padding = 0;
+        final String text = "This is a test.";
+        final String expected = "This is a" + EOL + 
                           "test.";
         
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
         new HelpFormatter().renderWrappedText(sb, width, padding, text);
         assertEquals("single line text", expected, sb.toString());
     }
@@ -95,13 +95,13 @@ public class HelpFormatterTest
     public void testRenderWrappedTextSingleLinePadded()
     {
         // single line padded text
-        int width = 12;
-        int padding = 4;
-        String text = "This is a test.";
-        String expected = "This is a" + EOL + 
+        final int width = 12;
+        final int padding = 4;
+        final String text = "This is a test.";
+        final String expected = "This is a" + EOL + 
                           "    test.";
         
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
         new HelpFormatter().renderWrappedText(sb, width, padding, text);
         assertEquals("single line padded text", expected, sb.toString());
     }
@@ -110,15 +110,15 @@ public class HelpFormatterTest
     public void testRenderWrappedTextSingleLinePadded2()
     {
         // single line padded text 2
-        int width = 53;
-        int padding = 24;
-        String text = "  -p,--period <PERIOD>  PERIOD is time duration of form " +
+        final int width = 53;
+        final int padding = 24;
+        final String text = "  -p,--period <PERIOD>  PERIOD is time duration of form " +
                       "DATE[-DATE] where DATE has form YYYY[MM[DD]]";
-        String expected = "  -p,--period <PERIOD>  PERIOD is time duration of" + EOL +
+        final String expected = "  -p,--period <PERIOD>  PERIOD is time duration of" + EOL +
                           "                        form DATE[-DATE] where DATE" + EOL +
                           "                        has form YYYY[MM[DD]]";
         
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
         new HelpFormatter().renderWrappedText(sb, width, padding, text);
         assertEquals("single line padded text 2", expected, sb.toString());
     }
@@ -127,13 +127,13 @@ public class HelpFormatterTest
     public void testRenderWrappedTextMultiLine()
     {
         // multi line text
-        int width = 16;
-        int padding = 0;
-        String expected = "aaaa aaaa aaaa" + EOL +
+        final int width = 16;
+        final int padding = 0;
+        final String expected = "aaaa aaaa aaaa" + EOL +
                       "aaaaaa" + EOL +
                       "aaaaa";
 
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
         new HelpFormatter().renderWrappedText(sb, width, padding, expected);
         assertEquals("multi line text", expected, sb.toString());
     }
@@ -142,16 +142,16 @@ public class HelpFormatterTest
     public void testRenderWrappedTextMultiLinePadded()
     {
         // multi-line padded text
-        int width = 16;
-        int padding = 4;
-        String text = "aaaa aaaa aaaa" + EOL +
+        final int width = 16;
+        final int padding = 4;
+        final String text = "aaaa aaaa aaaa" + EOL +
                       "aaaaaa" + EOL +
                       "aaaaa";
-        String expected = "aaaa aaaa aaaa" + EOL +
+        final String expected = "aaaa aaaa aaaa" + EOL +
                           "    aaaaaa" + EOL +
                           "    aaaaa";
         
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
         new HelpFormatter().renderWrappedText(sb, width, padding, text);
         assertEquals("multi-line padded text", expected, sb.toString());
     }
@@ -159,8 +159,8 @@ public class HelpFormatterTest
     @Test
     public void testPrintOptions() throws Exception
     {
-        StringBuffer sb = new StringBuffer();
-        HelpFormatter hf = new HelpFormatter();
+        final StringBuffer sb = new StringBuffer();
+        final HelpFormatter hf = new HelpFormatter();
         final int leftPad = 1;
         final int descPad = 3;
         final String lpad = hf.createPadding(leftPad);
@@ -209,13 +209,13 @@ public class HelpFormatterTest
     @Test
     public void testPrintHelpWithEmptySyntax()
     {
-        HelpFormatter formatter = new HelpFormatter();
+        final HelpFormatter formatter = new HelpFormatter();
         try
         {
             formatter.printHelp(null, new Options());
             fail("null command line syntax should be rejected");
         }
-        catch (IllegalArgumentException e)
+        catch (final IllegalArgumentException e)
         {
             // expected
         }
@@ -225,7 +225,7 @@ public class HelpFormatterTest
             formatter.printHelp("", new Options());
             fail("empty command line syntax should be rejected");
         }
-        catch (IllegalArgumentException e)
+        catch (final IllegalArgumentException e)
         {
             // expected
         }
@@ -234,11 +234,11 @@ public class HelpFormatterTest
     @Test
     public void testAutomaticUsage() throws Exception
     {
-        HelpFormatter hf = new HelpFormatter();
+        final HelpFormatter hf = new HelpFormatter();
         Options options = null;
         String expected = "usage: app [-a]";
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        PrintWriter pw = new PrintWriter(out);
+        final ByteArrayOutputStream out = new ByteArrayOutputStream();
+        final PrintWriter pw = new PrintWriter(out);
 
         options = new Options().addOption("a", false, "aaaa aaaa aaaa aaaa aaaa");
         hf.printUsage(pw, 60, "app", options);
@@ -260,16 +260,16 @@ public class HelpFormatterTest
     @Test
     public void testPrintUsage()
     {
-        Option optionA = new Option("a", "first");
-        Option optionB = new Option("b", "second");
-        Option optionC = new Option("c", "third");
-        Options opts = new Options();
+        final Option optionA = new Option("a", "first");
+        final Option optionB = new Option("b", "second");
+        final Option optionC = new Option("c", "third");
+        final Options opts = new Options();
         opts.addOption(optionA);
         opts.addOption(optionB);
         opts.addOption(optionC);
-        HelpFormatter helpFormatter = new HelpFormatter();
-        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
-        PrintWriter printWriter = new PrintWriter(bytesOut);
+        final HelpFormatter helpFormatter = new HelpFormatter();
+        final ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+        final PrintWriter printWriter = new PrintWriter(bytesOut);
         helpFormatter.printUsage(printWriter, 80, "app", opts);
         printWriter.close();
         assertEquals("usage: app [-a] [-b] [-c]" + EOL, bytesOut.toString());
@@ -279,12 +279,12 @@ public class HelpFormatterTest
     @Test
     public void testPrintSortedUsage()
     {
-        Options opts = new Options();
+        final Options opts = new Options();
         opts.addOption(new Option("a", "first"));
         opts.addOption(new Option("b", "second"));
         opts.addOption(new Option("c", "third"));
 
-        HelpFormatter helpFormatter = new HelpFormatter();
+        final HelpFormatter helpFormatter = new HelpFormatter();
         helpFormatter.setOptionComparator(new Comparator<Option>()
         {
             public int compare(Option opt1, Option opt2)
@@ -294,7 +294,7 @@ public class HelpFormatterTest
             }
         });
 
-        StringWriter out = new StringWriter();
+        final StringWriter out = new StringWriter();
         helpFormatter.printUsage(new PrintWriter(out), 80, "app", opts);
 
         assertEquals("usage: app [-c] [-b] [-a]" + EOL, out.toString());
@@ -303,15 +303,15 @@ public class HelpFormatterTest
     @Test
     public void testPrintSortedUsageWithNullComparator()
     {
-        Options opts = new Options();
+        final Options opts = new Options();
         opts.addOption(new Option("c", "first"));
         opts.addOption(new Option("b", "second"));
         opts.addOption(new Option("a", "third"));
 
-        HelpFormatter helpFormatter = new HelpFormatter();
+        final HelpFormatter helpFormatter = new HelpFormatter();
         helpFormatter.setOptionComparator(null);
 
-        StringWriter out = new StringWriter();
+        final StringWriter out = new StringWriter();
         helpFormatter.printUsage(new PrintWriter(out), 80, "app", opts);
 
         assertEquals("usage: app [-c] [-b] [-a]" + EOL, out.toString());
@@ -320,17 +320,17 @@ public class HelpFormatterTest
     @Test
     public void testPrintOptionGroupUsage()
     {
-        OptionGroup group = new OptionGroup();
+        final OptionGroup group = new OptionGroup();
         group.addOption(Option.builder("a").build());
         group.addOption(Option.builder("b").build());
         group.addOption(Option.builder("c").build());
 
-        Options options = new Options();
+        final Options options = new Options();
         options.addOptionGroup(group);
 
-        StringWriter out = new StringWriter();
+        final StringWriter out = new StringWriter();
 
-        HelpFormatter formatter = new HelpFormatter();
+        final HelpFormatter formatter = new HelpFormatter();
         formatter.printUsage(new PrintWriter(out), 80, "app", options);
 
         assertEquals("usage: app [-a | -b | -c]" + EOL, out.toString());
@@ -339,18 +339,18 @@ public class HelpFormatterTest
     @Test
     public void testPrintRequiredOptionGroupUsage()
     {
-        OptionGroup group = new OptionGroup();
+        final OptionGroup group = new OptionGroup();
         group.addOption(Option.builder("a").build());
         group.addOption(Option.builder("b").build());
         group.addOption(Option.builder("c").build());
         group.setRequired(true);
 
-        Options options = new Options();
+        final Options options = new Options();
         options.addOptionGroup(group);
 
-        StringWriter out = new StringWriter();
+        final StringWriter out = new StringWriter();
 
-        HelpFormatter formatter = new HelpFormatter();
+        final HelpFormatter formatter = new HelpFormatter();
         formatter.printUsage(new PrintWriter(out), 80, "app", options);
 
         assertEquals("usage: app -a | -b | -c" + EOL, out.toString());
@@ -359,16 +359,16 @@ public class HelpFormatterTest
     @Test
     public void testPrintOptionWithEmptyArgNameUsage()
     {
-        Option option = new Option("f", true, null);
+        final Option option = new Option("f", true, null);
         option.setArgName("");
         option.setRequired(true);
 
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption(option);
 
-        StringWriter out = new StringWriter();
+        final StringWriter out = new StringWriter();
 
-        HelpFormatter formatter = new HelpFormatter();
+        final HelpFormatter formatter = new HelpFormatter();
         formatter.printUsage(new PrintWriter(out), 80, "app", options);
 
         assertEquals("usage: app -f" + EOL, out.toString());
@@ -377,14 +377,14 @@ public class HelpFormatterTest
     @Test
     public void testDefaultArgName()
     {
-        Option option = Option.builder("f").hasArg().required(true).build();
+        final Option option = Option.builder("f").hasArg().required(true).build();
         
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption(option);
         
-        StringWriter out = new StringWriter();
+        final StringWriter out = new StringWriter();
 
-        HelpFormatter formatter = new HelpFormatter();
+        final HelpFormatter formatter = new HelpFormatter();
         formatter.setArgName("argument");
         formatter.printUsage(new PrintWriter(out), 80, "app", options);
 
@@ -394,7 +394,7 @@ public class HelpFormatterTest
     @Test
     public void testRtrim()
     {
-        HelpFormatter formatter = new HelpFormatter();
+        final HelpFormatter formatter = new HelpFormatter();
 
         assertEquals(null, formatter.rtrim(null));
         assertEquals("", formatter.rtrim(""));
@@ -404,7 +404,7 @@ public class HelpFormatterTest
     @Test
     public void testAccessors()
     {
-        HelpFormatter formatter = new HelpFormatter();
+        final HelpFormatter formatter = new HelpFormatter();
 
         formatter.setArgName("argname");
         assertEquals("arg name", "argname", formatter.getArgName());
@@ -435,11 +435,11 @@ public class HelpFormatterTest
     public void testHeaderStartingWithLineSeparator()
     {
         // related to Bugzilla #21215
-        Options options = new Options();
-        HelpFormatter formatter = new HelpFormatter();
-        String header = EOL + "Header";
-        String footer = "Footer";
-        StringWriter out = new StringWriter();
+        final Options options = new Options();
+        final HelpFormatter formatter = new HelpFormatter();
+        final String header = EOL + "Header";
+        final String footer = "Footer";
+        final StringWriter out = new StringWriter();
         formatter.printHelp(new PrintWriter(out), 80, "foobar", header, options, 2, 2, footer, true);
         assertEquals(
                 "usage: foobar" + EOL +
@@ -454,11 +454,11 @@ public class HelpFormatterTest
     public void testIndentedHeaderAndFooter()
     {
         // related to CLI-207
-        Options options = new Options();
-        HelpFormatter formatter = new HelpFormatter();
-        String header = "  Header1\n  Header2";
-        String footer = "  Footer1\n  Footer2";
-        StringWriter out = new StringWriter();
+        final Options options = new Options();
+        final HelpFormatter formatter = new HelpFormatter();
+        final String header = "  Header1\n  Header2";
+        final String footer = "  Footer1\n  Footer2";
+        final StringWriter out = new StringWriter();
         formatter.printHelp(new PrintWriter(out), 80, "foobar", header, options, 2, 2, footer, true);
 
         assertEquals(
@@ -475,13 +475,13 @@ public class HelpFormatterTest
     public void testOptionWithoutShortFormat()
     {
         // related to Bugzilla #19383 (CLI-67)
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption(new Option("a", "aaa", false, "aaaaaaa"));
         options.addOption(new Option(null, "bbb", false, "bbbbbbb"));
         options.addOption(new Option("c", null, false, "ccccccc"));
 
-        HelpFormatter formatter = new HelpFormatter();
-        StringWriter out = new StringWriter();
+        final HelpFormatter formatter = new HelpFormatter();
+        final StringWriter out = new StringWriter();
         formatter.printHelp(new PrintWriter(out), 80, "foobar", "", options, 2, 2, "", true);
         assertEquals(
                 "usage: foobar [-a] [--bbb] [-c]" + EOL +
@@ -495,43 +495,43 @@ public class HelpFormatterTest
     public void testOptionWithoutShortFormat2()
     {
         // related to Bugzilla #27635 (CLI-26)
-        Option help = new Option("h", "help", false, "print this message");
-        Option version = new Option("v", "version", false, "print version information");
-        Option newRun = new Option("n", "new", false, "Create NLT cache entries only for new items");
-        Option trackerRun = new Option("t", "tracker", false, "Create NLT cache entries only for tracker items");
+        final Option help = new Option("h", "help", false, "print this message");
+        final Option version = new Option("v", "version", false, "print version information");
+        final Option newRun = new Option("n", "new", false, "Create NLT cache entries only for new items");
+        final Option trackerRun = new Option("t", "tracker", false, "Create NLT cache entries only for tracker items");
         
-        Option timeLimit = Option.builder("l")
+        final Option timeLimit = Option.builder("l")
                                  .longOpt("limit")
                                  .hasArg()
                                  .valueSeparator()
                                  .desc("Set time limit for execution, in mintues")
                                  .build();
         
-        Option age = Option.builder("a").longOpt("age")
+        final Option age = Option.builder("a").longOpt("age")
                                         .hasArg()
                                         .valueSeparator()
                                         .desc("Age (in days) of cache item before being recomputed")
                                         .build();
         
-        Option server = Option.builder("s").longOpt("server")
+        final Option server = Option.builder("s").longOpt("server")
                                            .hasArg()
                                            .valueSeparator()
                                            .desc("The NLT server address")
                                            .build();
         
-        Option numResults = Option.builder("r").longOpt("results")
+        final Option numResults = Option.builder("r").longOpt("results")
                                                .hasArg()
                                                .valueSeparator()
                                                .desc("Number of results per item")
                                                .build();
         
-        Option configFile = Option.builder().longOpt("config")
+        final Option configFile = Option.builder().longOpt("config")
                                             .hasArg()
                                             .valueSeparator()
                                             .desc("Use the specified configuration file")
                                             .build();
         
-        Options mOptions = new Options();
+        final Options mOptions = new Options();
         mOptions.addOption(help);
         mOptions.addOption(version);
         mOptions.addOption(newRun);
@@ -542,9 +542,9 @@ public class HelpFormatterTest
         mOptions.addOption(numResults);
         mOptions.addOption(configFile);
         
-        HelpFormatter formatter = new HelpFormatter();
+        final HelpFormatter formatter = new HelpFormatter();
         final String EOL = System.getProperty("line.separator");
-        StringWriter out = new StringWriter();
+        final StringWriter out = new StringWriter();
         formatter.printHelp(new PrintWriter(out),80,"commandline","header",mOptions,2,2,"footer",true);
         assertEquals(
                 "usage: commandline [-a <arg>] [--config <arg>] [-h] [-l <arg>] [-n] [-r <arg>]" + EOL +
@@ -566,17 +566,17 @@ public class HelpFormatterTest
     @Test
     public void testHelpWithLongOptSeparator() throws Exception
     {
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption( "f", true, "the file" );
         options.addOption(Option.builder("s").longOpt("size").desc("the size").hasArg().argName("SIZE").build());
         options.addOption(Option.builder().longOpt("age").desc("the age").hasArg().build());
         
-        HelpFormatter formatter = new HelpFormatter();
+        final HelpFormatter formatter = new HelpFormatter();
         assertEquals(HelpFormatter.DEFAULT_LONG_OPT_SEPARATOR, formatter.getLongOptSeparator());
         formatter.setLongOptSeparator("=");
         assertEquals("=", formatter.getLongOptSeparator());
         
-        StringWriter out = new StringWriter();
+        final StringWriter out = new StringWriter();
 
         formatter.printHelp(new PrintWriter(out), 80, "create", "header", options, 2, 2, "footer");
 
@@ -593,15 +593,15 @@ public class HelpFormatterTest
     @Test
     public void testUsageWithLongOptSeparator() throws Exception
     {
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption( "f", true, "the file" );
         options.addOption(Option.builder("s").longOpt("size").desc("the size").hasArg().argName("SIZE").build());
         options.addOption(Option.builder().longOpt("age").desc("the age").hasArg().build());
         
-        HelpFormatter formatter = new HelpFormatter();
+        final HelpFormatter formatter = new HelpFormatter();
         formatter.setLongOptSeparator("=");
         
-        StringWriter out = new StringWriter();
+        final StringWriter out = new StringWriter();
         
         formatter.printUsage(new PrintWriter(out), 80, "create", options);
         


Mime
View raw message