You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2017/06/08 17:37:15 UTC

[46/50] [abbrv] commons-cli git commit: Add final modifier to local variables.

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/test/java/org/apache/commons/cli/bug/BugCLI162Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/cli/bug/BugCLI162Test.java b/src/test/java/org/apache/commons/cli/bug/BugCLI162Test.java
index 52e2c20..8cfd031 100644
--- a/src/test/java/org/apache/commons/cli/bug/BugCLI162Test.java
+++ b/src/test/java/org/apache/commons/cli/bug/BugCLI162Test.java
@@ -48,12 +48,12 @@ public class BugCLI162Test
 
     @Test
     public void testInfiniteLoop() {
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption("h", "help", false, "This is a looooong description");
         // used to hang & crash
         formatter.printHelp(new PrintWriter(sw), 20, "app", null, options, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null);
 
-        String expected = "usage: app" + CR +
+        final String expected = "usage: app" + CR +
                 " -h,--help   This is" + CR +
                 "             a" + CR +
                 "             looooon" + CR +
@@ -181,8 +181,8 @@ public class BugCLI162Test
             + " \"pname1 pname2\"");
         commandLineOptions.addOption(option);
         //
-        OptionGroup pOutTypesOptionGroup = new OptionGroup();
-        String pOutTypesOptionGroupDoc = OPT + OPT_PARAM_TYPES_INT + " and " + OPT + OPT_PARAM_TYPES_NAME + " are mutually exclusive.";
+        final OptionGroup pOutTypesOptionGroup = new OptionGroup();
+        final String pOutTypesOptionGroupDoc = OPT + OPT_PARAM_TYPES_INT + " and " + OPT + OPT_PARAM_TYPES_NAME + " are mutually exclusive.";
         final String typesClassName = Types.class.getName();
         option = new Option(OPT_PARAM_TYPES_INT, "paramTypes", true, "Parameter types from "
             + typesClassName
@@ -204,8 +204,8 @@ public class BugCLI162Test
         commandLineOptions.addOption(option);
         commandLineOptions.addOptionGroup(pOutTypesOptionGroup);
         //
-        OptionGroup modesOptionGroup = new OptionGroup();
-        String modesOptionGroupDoc = OPT + OPT_PARAM_MODES_INT + " and " + OPT + OPT_PARAM_MODES_NAME + " are mutually exclusive.";
+        final OptionGroup modesOptionGroup = new OptionGroup();
+        final String modesOptionGroupDoc = OPT + OPT_PARAM_MODES_INT + " and " + OPT + OPT_PARAM_MODES_NAME + " are mutually exclusive.";
         option = new Option(OPT_PARAM_MODES_INT, "paramModes", true, "Parameters modes ("
             + ParameterMetaData.parameterModeIn
             + "=IN, "
@@ -250,7 +250,7 @@ public class BugCLI162Test
         commandLineOptions.addOption(option);
 
         formatter.printHelp(new PrintWriter(sw), HelpFormatter.DEFAULT_WIDTH, this.getClass().getName(), null, commandLineOptions, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null);
-        String expected = "usage: org.apache.commons.cli.bug.BugCLI162Test" + CR +
+        final String expected = "usage: org.apache.commons.cli.bug.BugCLI162Test" + CR +
                 " -2,--jdbc2sfmd <arg>        Converts the JDBC file in the first argument" + CR +
                 "                             to an SMFD file specified in the second" + CR +
                 "                             argument." + CR +
@@ -312,14 +312,14 @@ public class BugCLI162Test
 
     @Test
     public void testLongLineChunking() {
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption("x", "extralongarg", false,
                                      "This description has ReallyLongValuesThatAreLongerThanTheWidthOfTheColumns " +
                                      "and also other ReallyLongValuesThatAreHugerAndBiggerThanTheWidthOfTheColumnsBob, " +
                                      "yes. ");
         
         formatter.printHelp(new PrintWriter(sw), 35, this.getClass().getName(), "Header", options, 0, 5, "Footer");
-        String expected = "usage:" + CR +
+        final String expected = "usage:" + CR +
                           "       org.apache.commons.cli.bug.B" + CR +
                           "       ugCLI162Test" + CR +
                           "Header" + CR +
@@ -344,11 +344,11 @@ public class BugCLI162Test
 
     @Test
     public void testLongLineChunkingIndentIgnored() {
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption("x", "extralongarg", false, "This description is Long." );
 
         formatter.printHelp(new PrintWriter(sw), 22, this.getClass().getName(), "Header", options, 0, 5, "Footer");
-        String expected = "usage:" + CR +
+        final String expected = "usage:" + CR +
                           "       org.apache.comm" + CR +
                           "       ons.cli.bug.Bug" + CR +
                           "       CLI162Test" + CR +

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/test/java/org/apache/commons/cli/bug/BugCLI18Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/cli/bug/BugCLI18Test.java b/src/test/java/org/apache/commons/cli/bug/BugCLI18Test.java
index 3d4eb88..0aa2e7d 100644
--- a/src/test/java/org/apache/commons/cli/bug/BugCLI18Test.java
+++ b/src/test/java/org/apache/commons/cli/bug/BugCLI18Test.java
@@ -33,13 +33,13 @@ public class BugCLI18Test
     @Test
     public void testCLI18()
     {
-        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 dksh fkshd fkhs dkfhsdk fhskd hksdks dhfowehfsdhfkjshf skfhkshf sf jkshfk sfh skfh skf f"));
         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", "dsfkfsh kdh hsd hsdh fkshdf ksdh fskdh fsdh fkshfk sfdkjhskjh fkjh fkjsh khsdkj hfskdhf skjdfh ksf khf s", options, 2, 2, "blort j jgj j jg jhghjghjgjhgjhg jgjhgj jhg jhg hjg jgjhghjg jhg hjg jhgjg jgjhghjg jg jgjhgjgjg jhg jhgjh" + '\r' + '\n' + "rarrr", true);
     }

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/test/java/org/apache/commons/cli/bug/BugCLI252Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/cli/bug/BugCLI252Test.java b/src/test/java/org/apache/commons/cli/bug/BugCLI252Test.java
index 7d2f717..06f6cff 100644
--- a/src/test/java/org/apache/commons/cli/bug/BugCLI252Test.java
+++ b/src/test/java/org/apache/commons/cli/bug/BugCLI252Test.java
@@ -37,7 +37,7 @@ public class BugCLI252Test {
     }
 
     private Options getOptions() {
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption(Option.builder().longOpt("prefix").build());
         options.addOption(Option.builder().longOpt("prefixplusplus").build());
         return options;

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/test/java/org/apache/commons/cli/bug/BugCLI265Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/cli/bug/BugCLI265Test.java b/src/test/java/org/apache/commons/cli/bug/BugCLI265Test.java
index eb05bb8..e9849f0 100644
--- a/src/test/java/org/apache/commons/cli/bug/BugCLI265Test.java
+++ b/src/test/java/org/apache/commons/cli/bug/BugCLI265Test.java
@@ -44,17 +44,17 @@ public class BugCLI265Test {
     public void setUp() throws Exception {
         parser = new DefaultParser();
 
-        Option optionT1 = Option.builder("t1").hasArg().numberOfArgs(1).optionalArg(true).argName("t1_path").build();
-        Option optionA = Option.builder("a").hasArg(false).build();
-        Option optionB = Option.builder("b").hasArg(false).build();
-        Option optionLast = Option.builder("last").hasArg(false).build();
+        final Option optionT1 = Option.builder("t1").hasArg().numberOfArgs(1).optionalArg(true).argName("t1_path").build();
+        final Option optionA = Option.builder("a").hasArg(false).build();
+        final Option optionB = Option.builder("b").hasArg(false).build();
+        final Option optionLast = Option.builder("last").hasArg(false).build();
 
         options = new Options().addOption(optionT1).addOption(optionA).addOption(optionB).addOption(optionLast);
     }
 
     @Test
     public void shouldParseShortOptionWithValue() throws Exception {
-        String[] shortOptionWithValue = new String[]{"-t1", "path/to/my/db"};
+        final String[] shortOptionWithValue = new String[]{"-t1", "path/to/my/db"};
 
         final CommandLine commandLine = parser.parse(options, shortOptionWithValue);
 
@@ -64,7 +64,7 @@ public class BugCLI265Test {
 
     @Test
     public void shouldParseShortOptionWithoutValue() throws Exception {
-        String[] twoShortOptions = new String[]{"-t1", "-last"};
+        final String[] twoShortOptions = new String[]{"-t1", "-last"};
 
         final CommandLine commandLine = parser.parse(options, twoShortOptions);
 
@@ -75,7 +75,7 @@ public class BugCLI265Test {
 
     @Test
     public void shouldParseConcatenatedShortOptions() throws Exception {
-        String[] concatenatedShortOptions = new String[] { "-t1", "-ab" };
+        final String[] concatenatedShortOptions = new String[] { "-t1", "-ab" };
 
         final CommandLine commandLine = parser.parse(options, concatenatedShortOptions);
 

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/test/java/org/apache/commons/cli/bug/BugCLI266Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/cli/bug/BugCLI266Test.java b/src/test/java/org/apache/commons/cli/bug/BugCLI266Test.java
index 372b413..694252f 100644
--- a/src/test/java/org/apache/commons/cli/bug/BugCLI266Test.java
+++ b/src/test/java/org/apache/commons/cli/bug/BugCLI266Test.java
@@ -38,11 +38,11 @@ public class BugCLI266Test {
 
     @Test
     public void testOptionComparatorDefaultOrder() throws ParseException {
-        HelpFormatter formatter = new HelpFormatter();
-        List<Option> options = new ArrayList<Option>(getOptions().getOptions());
+        final HelpFormatter formatter = new HelpFormatter();
+        final List<Option> options = new ArrayList<Option>(getOptions().getOptions());
         Collections.sort(options, formatter.getOptionComparator());
         int i = 0;
-        for(Option o: options) {
+        for(final Option o: options) {
             Assert.assertEquals(o.getOpt(), sortOrder.get(i));
             i++;
         }
@@ -50,17 +50,17 @@ public class BugCLI266Test {
 
     @Test
     public void testOptionComparatorInsertedOrder() throws ParseException {
-        Collection<Option> options = getOptions().getOptions();
+        final Collection<Option> options = getOptions().getOptions();
         int i = 0;
-        for(Option o: options) {
+        for(final Option o: options) {
             Assert.assertEquals(o.getOpt(), insertedOrder.get(i));
             i++;
         }
     }
 
     private Options getOptions() {
-        Options options = new Options();
-        Option help = Option.builder("h")
+        final Options options = new Options();
+        final Option help = Option.builder("h")
                 .longOpt("help")
                 .desc("Prints this help message")
                 .build();
@@ -68,17 +68,17 @@ public class BugCLI266Test {
 
         buildOptionsGroup(options);
 
-        Option t = Option.builder("t")
+        final Option t = Option.builder("t")
                 .required()
                 .hasArg()
                 .argName("file")
                 .build();
-        Option w = Option.builder("w")
+        final Option w = Option.builder("w")
                 .required()
                 .hasArg()
                 .argName("word")
                 .build();
-        Option o = Option.builder("o")
+        final Option o = Option.builder("o")
                 .hasArg()
                 .argName("directory")
                 .build();
@@ -89,8 +89,8 @@ public class BugCLI266Test {
     }
 
     private void buildOptionsGroup(Options options) {
-        OptionGroup firstGroup = new OptionGroup();
-        OptionGroup secondGroup = new OptionGroup();
+        final OptionGroup firstGroup = new OptionGroup();
+        final OptionGroup secondGroup = new OptionGroup();
         firstGroup.setRequired(true);
         secondGroup.setRequired(true);
 

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java b/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java
index 41ef600..56c9d8d 100644
--- a/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java
+++ b/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java
@@ -39,11 +39,11 @@ public class BugCLI71Test
     public void setUp() {
         options = new Options();
 
-        Option algorithm = new Option("a" , "algo", true, "the algorithm which it to perform executing");
+        final Option algorithm = new Option("a" , "algo", true, "the algorithm which it to perform executing");
         algorithm.setArgName("algorithm name");
         options.addOption(algorithm);
 
-        Option key = new Option("k" , "key", true, "the key the setted algorithm uses to process");
+        final Option key = new Option("k" , "key", true, "the key the setted algorithm uses to process");
         algorithm.setArgName("value");
         options.addOption(key);
 
@@ -52,8 +52,8 @@ public class BugCLI71Test
 
     @Test
     public void testBasic() throws Exception {
-        String[] args = new String[] { "-a", "Caesar", "-k", "A" };
-        CommandLine line = parser.parse( options, args);
+        final String[] args = new String[] { "-a", "Caesar", "-k", "A" };
+        final CommandLine line = parser.parse( options, args);
         assertEquals( "Caesar", line.getOptionValue("a") );
         assertEquals( "A", line.getOptionValue("k") );
     }
@@ -70,20 +70,20 @@ public class BugCLI71Test
 
     @Test
     public void testLackOfError() throws Exception {
-        String[] args = new String[] { "-k", "-a",  "Caesar" };
+        final String[] args = new String[] { "-k", "-a",  "Caesar" };
         try {
             parser.parse( options, args);
             fail("MissingArgumentException expected");
-        } catch(MissingArgumentException e) {
+        } catch(final MissingArgumentException e) {
             assertEquals("option missing an argument", "k", e.getOption().getOpt());
         }
     }
 
     @Test
     public void testGetsDefaultIfOptional() throws Exception {
-        String[] args = new String[] { "-k", "-a", "Caesar" };
+        final String[] args = new String[] { "-k", "-a", "Caesar" };
         options.getOption("k").setOptionalArg(true);
-        CommandLine line = parser.parse( options, args);
+        final CommandLine line = parser.parse( options, args);
         
         assertEquals( "Caesar", line.getOptionValue("a") );
         assertEquals( "a", line.getOptionValue('k', "a") );

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/357a8b0b/src/test/java/org/apache/commons/cli/bug/BugsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/cli/bug/BugsTest.java b/src/test/java/org/apache/commons/cli/bug/BugsTest.java
index f5746fe..c995ceb 100644
--- a/src/test/java/org/apache/commons/cli/bug/BugsTest.java
+++ b/src/test/java/org/apache/commons/cli/bug/BugsTest.java
@@ -47,27 +47,27 @@ public class BugsTest
     @Test
     public void test11457() throws Exception
     {
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption(OptionBuilder.withLongOpt("verbose").create());
-        String[] args = new String[]{"--verbose"};
+        final String[] args = new String[]{"--verbose"};
 
-        CommandLineParser parser = new PosixParser();
+        final CommandLineParser parser = new PosixParser();
 
-        CommandLine cmd = parser.parse(options, args);
+        final CommandLine cmd = parser.parse(options, args);
         assertTrue(cmd.hasOption("verbose"));
     }
 
     @Test
     public void test11458() throws Exception
     {
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption( OptionBuilder.withValueSeparator( '=' ).hasArgs().create( 'D' ) );
         options.addOption( OptionBuilder.withValueSeparator( ':' ).hasArgs().create( 'p' ) );
-        String[] args = new String[] { "-DJAVA_HOME=/opt/java" , "-pfile1:file2:file3" };
+        final String[] args = new String[] { "-DJAVA_HOME=/opt/java" , "-pfile1:file2:file3" };
 
-        CommandLineParser parser = new PosixParser();
+        final CommandLineParser parser = new PosixParser();
 
-        CommandLine cmd = parser.parse(options, args);
+        final CommandLine cmd = parser.parse(options, args);
 
         String[] values = cmd.getOptionValues('D');
 
@@ -80,10 +80,10 @@ public class BugsTest
         assertEquals(values[1], "file2");
         assertEquals(values[2], "file3");
 
-        Iterator<Option> iter = cmd.iterator();
+        final Iterator<Option> iter = cmd.iterator();
         while (iter.hasNext())
         {
-            Option opt = iter.next();
+            final Option opt = iter.next();
             switch (opt.getId())
             {
                 case 'D':
@@ -104,14 +104,14 @@ public class BugsTest
     @Test
     public void test11680() throws Exception
     {
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption("f", true, "foobar");
         options.addOption("m", true, "missing");
-        String[] args = new String[]{"-f", "foo"};
+        final String[] args = new String[]{"-f", "foo"};
 
-        CommandLineParser parser = new PosixParser();
+        final CommandLineParser parser = new PosixParser();
 
-        CommandLine cmd = parser.parse(options, args);
+        final CommandLine cmd = parser.parse(options, args);
 
         cmd.getOptionValue("f", "default f");
         cmd.getOptionValue("m", "default m");
@@ -147,13 +147,13 @@ public class BugsTest
     public void test12210() throws Exception
     {
         // create the main options object which will handle the first parameter
-        Options mainOptions = new Options();
+        final Options mainOptions = new Options();
         // There can be 2 main exclusive options:  -exec|-rep
 
         // Therefore, place them in an option group
 
         String[] argv = new String[] { "-exec", "-exec_opt1", "-exec_opt2" };
-        OptionGroup grp = new OptionGroup();
+        final OptionGroup grp = new OptionGroup();
 
         grp.addOption(new Option("exec",false,"description for this option"));
 
@@ -162,17 +162,17 @@ public class BugsTest
         mainOptions.addOptionGroup(grp);
 
         // for the exec option, there are 2 options...
-        Options execOptions = new Options();
+        final Options execOptions = new Options();
         execOptions.addOption("exec_opt1", false, " desc");
         execOptions.addOption("exec_opt2", false, " desc");
 
         // similarly, for rep there are 2 options...
-        Options repOptions = new Options();
+        final Options repOptions = new Options();
         repOptions.addOption("repopto", false, "desc");
         repOptions.addOption("repoptt", false, "desc");
 
         // create the parser
-        GnuParser parser = new GnuParser();
+        final GnuParser parser = new GnuParser();
 
         // finally, parse the arguments:
 
@@ -203,17 +203,17 @@ public class BugsTest
     @Test
     public void test13425() throws Exception
     {
-        Options options = new Options();
-        Option oldpass = OptionBuilder.withLongOpt( "old-password" )
+        final Options options = new Options();
+        final Option oldpass = OptionBuilder.withLongOpt( "old-password" )
             .withDescription( "Use this option to specify the old password" )
             .hasArg()
             .create( 'o' );
-        Option newpass = OptionBuilder.withLongOpt( "new-password" )
+        final Option newpass = OptionBuilder.withLongOpt( "new-password" )
             .withDescription( "Use this option to specify the new password" )
             .hasArg()
             .create( 'n' );
 
-        String[] args = { 
+        final String[] args = { 
             "-o", 
             "-n", 
             "newpassword" 
@@ -222,20 +222,20 @@ public class BugsTest
         options.addOption( oldpass );
         options.addOption( newpass );
 
-        Parser parser = new PosixParser();
+        final Parser parser = new PosixParser();
 
         try {
             parser.parse( options, args );
             fail( "MissingArgumentException not caught." );
-        } catch( MissingArgumentException expected ) {
+        } catch( final MissingArgumentException expected ) {
         }
     }
 
     @Test
     public void test13666() throws Exception
     {
-        Options options = new Options();
-        Option dir = OptionBuilder.withDescription( "dir" ).hasArg().create( 'd' );
+        final Options options = new Options();
+        final Option dir = OptionBuilder.withDescription( "dir" ).hasArg().create( 'd' );
         options.addOption( dir );
         
         final PrintStream oldSystemOut = System.out;
@@ -251,7 +251,7 @@ public class BugsTest
             
             System.setOut(new PrintStream(bytes));
 
-            HelpFormatter formatter = new HelpFormatter();
+            final HelpFormatter formatter = new HelpFormatter();
             formatter.printHelp( "dir", options );
 
             assertEquals("usage: dir"+eol+" -d <arg>   dir"+eol,bytes.toString());
@@ -265,30 +265,30 @@ public class BugsTest
     @Test
     public void test13935() throws Exception
     {
-        OptionGroup directions = new OptionGroup();
+        final OptionGroup directions = new OptionGroup();
 
-        Option left = new Option( "l", "left", false, "go left" );
-        Option right = new Option( "r", "right", false, "go right" );
-        Option straight = new Option( "s", "straight", false, "go straight" );
-        Option forward = new Option( "f", "forward", false, "go forward" );
+        final Option left = new Option( "l", "left", false, "go left" );
+        final Option right = new Option( "r", "right", false, "go right" );
+        final Option straight = new Option( "s", "straight", false, "go straight" );
+        final Option forward = new Option( "f", "forward", false, "go forward" );
         forward.setRequired( true );
 
         directions.addOption( left );
         directions.addOption( right );
         directions.setRequired( true );
 
-        Options opts = new Options();
+        final Options opts = new Options();
         opts.addOptionGroup( directions );
         opts.addOption( straight );
 
-        CommandLineParser parser = new PosixParser();
+        final CommandLineParser parser = new PosixParser();
 
         String[] args = new String[] {  };
         try {
             parser.parse(opts, args);
             fail("Expected ParseException");
         }
-        catch (ParseException expected) {
+        catch (final ParseException expected) {
         }
 
         args = new String[] { "-s" };
@@ -296,7 +296,7 @@ public class BugsTest
             parser.parse(opts, args);
             fail("Expected ParseException");
         }
-        catch (ParseException expected) {
+        catch (final ParseException expected) {
         }
 
         args = new String[] { "-s", "-l" };
@@ -312,33 +312,33 @@ public class BugsTest
     @Test
     public void test14786() throws Exception
     {
-        Option o = OptionBuilder.isRequired().withDescription("test").create("test");
-        Options opts = new Options();
+        final Option o = OptionBuilder.isRequired().withDescription("test").create("test");
+        final Options opts = new Options();
         opts.addOption(o);
         opts.addOption(o);
 
-        CommandLineParser parser = new GnuParser();
+        final CommandLineParser parser = new GnuParser();
 
-        String[] args = new String[] { "-test" };
+        final String[] args = new String[] { "-test" };
 
-        CommandLine line = parser.parse( opts, args );
+        final CommandLine line = parser.parse( opts, args );
         assertTrue( line.hasOption( "test" ) );
     }
 
     @Test
     public void test15046() throws Exception
     {
-        CommandLineParser parser = new PosixParser();
-        String[] CLI_ARGS = new String[] {"-z", "c"};
+        final CommandLineParser parser = new PosixParser();
+        final String[] CLI_ARGS = new String[] {"-z", "c"};
 
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption(new Option("z", "timezone", true, "affected option"));
 
         parser.parse(options, CLI_ARGS);
         
         //now add conflicting option
         options.addOption("c", "conflict", true, "conflict option");
-        CommandLine line = parser.parse(options, CLI_ARGS);
+        final CommandLine line = parser.parse(options, CLI_ARGS);
         assertEquals( line.getOptionValue('z'), "c" );
         assertTrue( !line.hasOption("c") );
     }
@@ -346,29 +346,29 @@ public class BugsTest
     @Test
     public void test15648() throws Exception
     {
-        CommandLineParser parser = new PosixParser();
+        final CommandLineParser parser = new PosixParser();
         final String[] args = new String[] { "-m", "\"Two Words\"" };
-        Option m = OptionBuilder.hasArgs().create("m");
-        Options options = new Options();
+        final Option m = OptionBuilder.hasArgs().create("m");
+        final Options options = new Options();
         options.addOption( m );
-        CommandLine line = parser.parse( options, args );
+        final CommandLine line = parser.parse( options, args );
         assertEquals( "Two Words", line.getOptionValue( "m" ) );
     }
     
     @Test
     public void test31148() throws ParseException
     {
-        Option multiArgOption = new Option("o","option with multiple args");
+        final Option multiArgOption = new Option("o","option with multiple args");
         multiArgOption.setArgs(1);
         
-        Options options = new Options();
+        final Options options = new Options();
         options.addOption(multiArgOption);
         
-        Parser parser = new PosixParser();
-        String[] args = new String[]{};
-        Properties props = new Properties();
+        final Parser parser = new PosixParser();
+        final String[] args = new String[]{};
+        final Properties props = new Properties();
         props.setProperty("o","ovalue");
-        CommandLine cl = parser.parse(options,args,props);
+        final CommandLine cl = parser.parse(options,args,props);
         
         assertTrue(cl.hasOption('o'));
         assertEquals("ovalue",cl.getOptionValue('o'));