You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2012/11/30 21:52:08 UTC

svn commit: r1415850 [14/15] - in /commons/proper/io/trunk/src: main/java/org/apache/commons/io/ main/java/org/apache/commons/io/comparator/ main/java/org/apache/commons/io/filefilter/ main/java/org/apache/commons/io/input/ main/java/org/apache/commons...

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamBlockSize.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamBlockSize.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamBlockSize.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamBlockSize.java Fri Nov 30 20:51:39 2012
@@ -46,9 +46,9 @@ public class ReversedLinesFileReaderTest
     }
 
     private ReversedLinesFileReader reversedLinesFileReader;
-    private int testParamBlockSize;
+    private final int testParamBlockSize;
 
-    public ReversedLinesFileReaderTestParamBlockSize(Integer testWithBlockSize) {
+    public ReversedLinesFileReaderTestParamBlockSize(final Integer testWithBlockSize) {
         testParamBlockSize = testWithBlockSize.intValue();
     }
 
@@ -67,62 +67,62 @@ public class ReversedLinesFileReaderTest
     public void closeReader() {
         try {
             reversedLinesFileReader.close();
-        } catch(Exception e) {
+        } catch(final Exception e) {
             // ignore
         }
     }
 
     @Test
     public void testIsoFileDefaults() throws URISyntaxException, IOException {
-        File testFileIso = new File(this.getClass().getResource("/test-file-iso8859-1.bin").toURI());
+        final File testFileIso = new File(this.getClass().getResource("/test-file-iso8859-1.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFileIso, testParamBlockSize, ISO_8859_1);
         assertFileWithShrinkingTestLines(reversedLinesFileReader);
     }
 
     @Test
     public void testUTF8FileWindowsBreaks() throws URISyntaxException, IOException {
-        File testFileIso = new File(this.getClass().getResource("/test-file-utf8-win-linebr.bin").toURI());
+        final File testFileIso = new File(this.getClass().getResource("/test-file-utf8-win-linebr.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFileIso, testParamBlockSize, UTF_8);
         assertFileWithShrinkingTestLines(reversedLinesFileReader);
     }
     @Test
     public void testUTF8FileCRBreaks() throws URISyntaxException, IOException {
-        File testFileIso = new File(this.getClass().getResource("/test-file-utf8-cr-only.bin").toURI());
+        final File testFileIso = new File(this.getClass().getResource("/test-file-utf8-cr-only.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFileIso, testParamBlockSize, UTF_8);
         assertFileWithShrinkingTestLines(reversedLinesFileReader);
     }
 
     @Test
     public void testUTF8File() throws URISyntaxException, IOException {
-        File testFileIso = new File(this.getClass().getResource("/test-file-utf8.bin").toURI());
+        final File testFileIso = new File(this.getClass().getResource("/test-file-utf8.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFileIso, testParamBlockSize, UTF_8);
         assertFileWithShrinkingTestLines(reversedLinesFileReader);
     }
 
     @Test
     public void testEmptyFile() throws URISyntaxException, IOException {
-        File testFileEmpty = new File(this.getClass().getResource("/test-file-empty.bin").toURI());
+        final File testFileEmpty = new File(this.getClass().getResource("/test-file-empty.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFileEmpty, testParamBlockSize, UTF_8);
         assertNull(reversedLinesFileReader.readLine());
     }
 
     @Test
     public void testUTF16BEFile() throws URISyntaxException, IOException {
-        File testFileUTF16BE = new File(this.getClass().getResource("/test-file-utf16be.bin").toURI());
+        final File testFileUTF16BE = new File(this.getClass().getResource("/test-file-utf16be.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFileUTF16BE, testParamBlockSize, "UTF-16BE");
         assertFileWithShrinkingTestLines(reversedLinesFileReader);
     }
 
     @Test
     public void testUTF16LEFile() throws URISyntaxException, IOException {
-        File testFileUTF16LE = new File(this.getClass().getResource("/test-file-utf16le.bin").toURI());
+        final File testFileUTF16LE = new File(this.getClass().getResource("/test-file-utf16le.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFileUTF16LE, testParamBlockSize, "UTF-16LE");
         assertFileWithShrinkingTestLines(reversedLinesFileReader);
     }
 
     @Test
     public void testShiftJISFile() throws URISyntaxException, IOException {
-        File testFileShiftJIS = new File(this.getClass().getResource("/test-file-shiftjis.bin").toURI());
+        final File testFileShiftJIS = new File(this.getClass().getResource("/test-file-shiftjis.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFileShiftJIS, testParamBlockSize, "Shift_JIS");
         assertEqualsAndNoLineBreaks(TEST_LINE_SHIFT_JIS2, reversedLinesFileReader.readLine());
         assertEqualsAndNoLineBreaks(TEST_LINE_SHIFT_JIS1, reversedLinesFileReader.readLine());
@@ -130,24 +130,24 @@ public class ReversedLinesFileReaderTest
 
     @Test // this test is run 3x for same block size as we want to test with 10
     public void testFileSizeIsExactMultipleOfBlockSize() throws URISyntaxException, IOException {
-        int blockSize = 10;
-        File testFile20Bytes = new File(this.getClass().getResource("/test-file-20byteslength.bin").toURI());
+        final int blockSize = 10;
+        final File testFile20Bytes = new File(this.getClass().getResource("/test-file-20byteslength.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFile20Bytes, blockSize, ISO_8859_1);
-        String testLine = "123456789";
+        final String testLine = "123456789";
         assertEqualsAndNoLineBreaks(testLine, reversedLinesFileReader.readLine());
         assertEqualsAndNoLineBreaks(testLine, reversedLinesFileReader.readLine());
     }
 
     @Test
     public void testUTF8FileWindowsBreaksSmallBlockSize2VerifyBlockSpanningNewLines() throws URISyntaxException, IOException {
-        File testFileUtf8 = new File(this.getClass().getResource("/test-file-utf8-win-linebr.bin").toURI());
+        final File testFileUtf8 = new File(this.getClass().getResource("/test-file-utf8-win-linebr.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFileUtf8, testParamBlockSize, UTF_8);
         assertFileWithShrinkingTestLines(reversedLinesFileReader);
     }
 
     @Test
     public void testIsoFileManyWindowsBreaksSmallBlockSize2VerifyBlockSpanningNewLines() throws URISyntaxException, IOException {
-        File testFileIso = new File(this.getClass().getResource("/test-file-iso8859-1-shortlines-win-linebr.bin").toURI());
+        final File testFileIso = new File(this.getClass().getResource("/test-file-iso8859-1-shortlines-win-linebr.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFileIso, testParamBlockSize, ISO_8859_1);
 
         for(int i=3;i>0;i--) {
@@ -160,17 +160,17 @@ public class ReversedLinesFileReaderTest
 
     @Test(expected=UnsupportedEncodingException.class)
     public void testUnsupportedEncodingUTF16() throws URISyntaxException, IOException {
-        File testFileEmpty = new File(this.getClass().getResource("/test-file-empty.bin").toURI());
+        final File testFileEmpty = new File(this.getClass().getResource("/test-file-empty.bin").toURI());
         new ReversedLinesFileReader(testFileEmpty, testParamBlockSize, "UTF-16");
     }
 
     @Test(expected=UnsupportedEncodingException.class)
     public void testUnsupportedEncodingBig5() throws URISyntaxException, IOException {
-        File testFileEncodingBig5 = new File(this.getClass().getResource("/test-file-empty.bin").toURI());
+        final File testFileEncodingBig5 = new File(this.getClass().getResource("/test-file-empty.bin").toURI());
         new ReversedLinesFileReader(testFileEncodingBig5, testParamBlockSize, "Big5");
     }
 
-    private void assertFileWithShrinkingTestLines(ReversedLinesFileReader reversedLinesFileReader) throws IOException {
+    private void assertFileWithShrinkingTestLines(final ReversedLinesFileReader reversedLinesFileReader) throws IOException {
         String line = null;
         int lineCount = 0;
         while ((line = reversedLinesFileReader.readLine()) != null) {
@@ -179,14 +179,14 @@ public class ReversedLinesFileReaderTest
         }
     }
 
-    static void assertEqualsAndNoLineBreaks(String msg, String expected, String actual) {
+    static void assertEqualsAndNoLineBreaks(final String msg, final String expected, final String actual) {
         if(actual!=null) {
             assertFalse("Line contains \\n: line="+actual, actual.contains("\n"));
             assertFalse("Line contains \\r: line="+actual, actual.contains("\r"));
         }
         assertEquals(msg, expected, actual);
     }
-    static void assertEqualsAndNoLineBreaks(String expected, String actual) {
+    static void assertEqualsAndNoLineBreaks(final String expected, final String actual) {
         assertEqualsAndNoLineBreaks(null, expected, actual);
     }
 }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java Fri Nov 30 20:51:39 2012
@@ -68,7 +68,7 @@ public class ReversedLinesFileReaderTest
     private final String encoding;
     private final int buffSize;
 
-    public ReversedLinesFileReaderTestParamFile(String fileName, String encoding, Integer buffsize) {
+    public ReversedLinesFileReaderTestParamFile(final String fileName, final String encoding, final Integer buffsize) {
         this.fileName = fileName;
         this.encoding = encoding;
         this.buffSize = buffsize == null ? 4096 : buffsize.intValue();
@@ -76,10 +76,10 @@ public class ReversedLinesFileReaderTest
 
     @Test
     public void testDataIntegrityWithBufferedReader() throws URISyntaxException, IOException {
-        File testFileIso = new File(this.getClass().getResource("/"+fileName).toURI());
+        final File testFileIso = new File(this.getClass().getResource("/"+fileName).toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFileIso, buffSize, encoding);
 
-        Stack<String> lineStack = new Stack<String>();
+        final Stack<String> lineStack = new Stack<String>();
 
         bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(testFileIso), encoding));
         String line = null;
@@ -91,7 +91,7 @@ public class ReversedLinesFileReaderTest
 
         // read in reverse order and compare with lines from stack
         while((line = reversedLinesFileReader.readLine())!=null) {
-            String lineFromBufferedReader = lineStack.pop();
+            final String lineFromBufferedReader = lineStack.pop();
             assertEquals(lineFromBufferedReader, line);
         }
 
@@ -101,12 +101,12 @@ public class ReversedLinesFileReaderTest
     public void closeReader() {
         try {
             bufferedReader.close();
-        } catch(Exception e) {
+        } catch(final Exception e) {
             // ignore
         }
         try {
             reversedLinesFileReader.close();
-        } catch(Exception e) {
+        } catch(final Exception e) {
             // ignore
         }
     }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestSimple.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestSimple.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestSimple.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestSimple.java Fri Nov 30 20:51:39 2012
@@ -35,30 +35,30 @@ public class ReversedLinesFileReaderTest
     public void closeReader() {
         try {
             reversedLinesFileReader.close();
-        } catch(Exception e) {
+        } catch(final Exception e) {
             // ignore
         }
     }
 
     @Test
     public void testFileSizeIsExactMultipleOfBlockSize() throws URISyntaxException, IOException {
-        int blockSize = 10;
-        File testFile20Bytes = new File(this.getClass().getResource("/test-file-20byteslength.bin").toURI());
+        final int blockSize = 10;
+        final File testFile20Bytes = new File(this.getClass().getResource("/test-file-20byteslength.bin").toURI());
         reversedLinesFileReader = new ReversedLinesFileReader(testFile20Bytes, blockSize, "ISO-8859-1");
-        String testLine = "123456789";
+        final String testLine = "123456789";
         assertEqualsAndNoLineBreaks(testLine, reversedLinesFileReader.readLine());
         assertEqualsAndNoLineBreaks(testLine, reversedLinesFileReader.readLine());
     }
 
     @Test(expected=UnsupportedEncodingException.class)
     public void testUnsupportedEncodingUTF16() throws URISyntaxException, IOException {
-        File testFileEmpty = new File(this.getClass().getResource("/test-file-empty.bin").toURI());
+        final File testFileEmpty = new File(this.getClass().getResource("/test-file-empty.bin").toURI());
         new ReversedLinesFileReader(testFileEmpty, 4096, "UTF-16");
     }
 
     @Test(expected=UnsupportedEncodingException.class)
     public void testUnsupportedEncodingBig5() throws URISyntaxException, IOException {
-        File testFileEncodingBig5 = new File(this.getClass().getResource("/test-file-empty.bin").toURI());
+        final File testFileEncodingBig5 = new File(this.getClass().getResource("/test-file-empty.bin").toURI());
         new ReversedLinesFileReader(testFileEncodingBig5, 4096, "Big5");
     }
 

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/SwappedDataInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/SwappedDataInputStreamTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/SwappedDataInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/SwappedDataInputStreamTest.java Fri Nov 30 20:51:39 2012
@@ -35,7 +35,7 @@ public class SwappedDataInputStreamTest 
     private SwappedDataInputStream sdis;
     private byte[] bytes;
 
-    public SwappedDataInputStreamTest(String name) {
+    public SwappedDataInputStreamTest(final String name) {
         super(name);
     }
 
@@ -51,7 +51,7 @@ public class SwappedDataInputStreamTest 
             0x07,
             0x08
         };
-        ByteArrayInputStream bais = new ByteArrayInputStream( bytes );
+        final ByteArrayInputStream bais = new ByteArrayInputStream( bytes );
         this.sdis = new SwappedDataInputStream( bais );
     }
 
@@ -66,8 +66,8 @@ public class SwappedDataInputStreamTest 
             0x01,
             0x02,
         };
-        ByteArrayInputStream bais = new ByteArrayInputStream( bytes );
-        SwappedDataInputStream sdis = new SwappedDataInputStream( bais );
+        final ByteArrayInputStream bais = new ByteArrayInputStream( bytes );
+        final SwappedDataInputStream sdis = new SwappedDataInputStream( bais );
         assertEquals( false, sdis.readBoolean() );
         assertEquals( true, sdis.readBoolean() );
         assertEquals( true, sdis.readBoolean() );
@@ -90,7 +90,7 @@ public class SwappedDataInputStreamTest 
     }
 
     public void testReadFully() throws IOException {
-        byte[] bytesIn = new byte[8];
+        final byte[] bytesIn = new byte[8];
         this.sdis.readFully(bytesIn);
         for( int i=0; i<8; i++) {
             assertEquals( bytes[i], bytesIn[i] );
@@ -105,7 +105,7 @@ public class SwappedDataInputStreamTest 
         try {
             this.sdis.readLine();
             fail("readLine should be unsupported. ");
-        } catch(UnsupportedOperationException uoe) {
+        } catch(final UnsupportedOperationException uoe) {
         }
     }
 
@@ -129,7 +129,7 @@ public class SwappedDataInputStreamTest 
         try {
             this.sdis.readUTF();
             fail("readUTF should be unsupported. ");
-        } catch(UnsupportedOperationException uoe) {
+        } catch(final UnsupportedOperationException uoe) {
         }
     }
 

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TaggedInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TaggedInputStreamTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TaggedInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TaggedInputStreamTest.java Fri Nov 30 20:51:39 2012
@@ -32,50 +32,50 @@ public class TaggedInputStreamTest exten
 
     public void testEmptyStream() {
         try {
-            InputStream stream = new TaggedInputStream(new ClosedInputStream());
+            final InputStream stream = new TaggedInputStream(new ClosedInputStream());
             assertEquals(0, stream.available());
             assertEquals(-1, stream.read());
             assertEquals(-1, stream.read(new byte[1]));
             assertEquals(-1, stream.read(new byte[1], 0, 1));
             stream.close();
-        } catch (IOException e) {
+        } catch (final IOException e) {
             fail("Unexpected exception thrown");
         }
     }
 
     public void testNormalStream() {
         try {
-            InputStream stream = new TaggedInputStream(
+            final InputStream stream = new TaggedInputStream(
                     new ByteArrayInputStream(new byte[] { 'a', 'b', 'c' }));
             assertEquals(3, stream.available());
             assertEquals('a', stream.read());
-            byte[] buffer = new byte[1];
+            final byte[] buffer = new byte[1];
             assertEquals(1, stream.read(buffer));
             assertEquals('b', buffer[0]);
             assertEquals(1, stream.read(buffer, 0, 1));
             assertEquals('c', buffer[0]);
             assertEquals(-1, stream.read());
             stream.close();
-        } catch (IOException e) {
+        } catch (final IOException e) {
             fail("Unexpected exception thrown");
         }
     }
 
     public void testBrokenStream() {
-        IOException exception = new IOException("test exception");
-        TaggedInputStream stream =
+        final IOException exception = new IOException("test exception");
+        final TaggedInputStream stream =
             new TaggedInputStream(new BrokenInputStream(exception));
 
         // Test the available() method
         try {
             stream.available();
             fail("Expected exception not thrown.");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertTrue(stream.isCauseOf(e));
             try {
                 stream.throwIfCauseOf(e);
                 fail("Expected exception not thrown.");
-            } catch (IOException e2) {
+            } catch (final IOException e2) {
                 assertEquals(exception, e2);
             }
         }
@@ -84,12 +84,12 @@ public class TaggedInputStreamTest exten
         try {
             stream.read();
             fail("Expected exception not thrown.");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertTrue(stream.isCauseOf(e));
             try {
                 stream.throwIfCauseOf(e);
                 fail("Expected exception not thrown.");
-            } catch (IOException e2) {
+            } catch (final IOException e2) {
                 assertEquals(exception, e2);
             }
         }
@@ -98,21 +98,21 @@ public class TaggedInputStreamTest exten
         try {
             stream.close();
             fail("Expected exception not thrown.");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertTrue(stream.isCauseOf(e));
             try {
                 stream.throwIfCauseOf(e);
                 fail("Expected exception not thrown.");
-            } catch (IOException e2) {
+            } catch (final IOException e2) {
                 assertEquals(exception, e2);
             }
         }
     }
 
     public void testOtherException() {
-        IOException exception = new IOException("test exception");
-        InputStream closed = new ClosedInputStream();
-        TaggedInputStream stream = new TaggedInputStream(closed);
+        final IOException exception = new IOException("test exception");
+        final InputStream closed = new ClosedInputStream();
+        final TaggedInputStream stream = new TaggedInputStream(closed);
 
         assertFalse(stream.isCauseOf(exception));
         assertFalse(stream.isCauseOf(
@@ -120,14 +120,14 @@ public class TaggedInputStreamTest exten
 
         try {
             stream.throwIfCauseOf(exception);
-        } catch (IOException e) {
+        } catch (final IOException e) {
             fail("Unexpected exception thrown");
         }
 
         try {
             stream.throwIfCauseOf(
                     new TaggedIOException(exception, UUID.randomUUID()));
-        } catch (IOException e) {
+        } catch (final IOException e) {
             fail("Unexpected exception thrown");
         }
     }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TailerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TailerTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TailerTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TailerTest.java Fri Nov 30 20:51:39 2012
@@ -41,7 +41,7 @@ public class TailerTest extends FileBase
 
     private Tailer tailer;
 
-    public TailerTest(String name) {
+    public TailerTest(final String name) {
         super(name);
     }
 
@@ -56,23 +56,23 @@ public class TailerTest extends FileBase
     }
 
     public void testLongFile() throws Exception {
-        long delay = 50;
+        final long delay = 50;
         
-        File file = new File(getTestDirectory(), "testLongFile.txt");
+        final File file = new File(getTestDirectory(), "testLongFile.txt");
         createFile(file, 0);
-        Writer writer = new FileWriter(file, true);
+        final Writer writer = new FileWriter(file, true);
         for (int i = 0; i < 100000; i++) {
             writer.write("LineLineLineLineLineLineLineLineLineLine\n");
         }
         writer.write("SBTOURIST\n");
         IOUtils.closeQuietly(writer);
 
-        TestTailerListener listener = new TestTailerListener();
+        final TestTailerListener listener = new TestTailerListener();
         tailer = new Tailer(file, listener, delay, false);
 
-        long start = System.currentTimeMillis();
+        final long start = System.currentTimeMillis();
 
-        Thread thread = new Thread(tailer);
+        final Thread thread = new Thread(tailer);
         thread.start();
 
         List<String> lines = listener.getLines();
@@ -85,16 +85,16 @@ public class TailerTest extends FileBase
     }
 
     public void testBufferBreak() throws Exception {
-        long delay = 50;
+        final long delay = 50;
 
-        File file = new File(getTestDirectory(), "testBufferBreak.txt");
+        final File file = new File(getTestDirectory(), "testBufferBreak.txt");
         createFile(file, 0);
         writeString(file, "SBTOURIST\n");
 
-        TestTailerListener listener = new TestTailerListener();
+        final TestTailerListener listener = new TestTailerListener();
         tailer = new Tailer(file, listener, delay, false, 1);
 
-        Thread thread = new Thread(tailer);
+        final Thread thread = new Thread(tailer);
         thread.start();
 
         List<String> lines = listener.getLines();
@@ -107,7 +107,7 @@ public class TailerTest extends FileBase
 
     public void testTailerEof() throws Exception {
         // Create & start the Tailer
-        long delay = 50;
+        final long delay = 50;
         final File file = new File(getTestDirectory(), "tailer2-test.txt");
         createFile(file, 0);
         final TestTailerListener listener = new TestTailerListener();
@@ -116,7 +116,7 @@ public class TailerTest extends FileBase
         thread.start();
 
         // Write some lines to the file
-        FileWriter writer = null;
+        final FileWriter writer = null;
         try {
             writeString(file, "Line");
 
@@ -142,12 +142,12 @@ public class TailerTest extends FileBase
     public void testTailer() throws Exception {
 
         // Create & start the Tailer
-        long delayMillis = 50;
+        final long delayMillis = 50;
         final File file = new File(getTestDirectory(), "tailer1-test.txt");
         createFile(file, 0);
         final TestTailerListener listener = new TestTailerListener();
-        String osname = System.getProperty("os.name");
-        boolean isWindows = osname.startsWith("Windows");
+        final String osname = System.getProperty("os.name");
+        final boolean isWindows = osname.startsWith("Windows");
         tailer = new Tailer(file, listener, delayMillis, false, isWindows);
         final Thread thread = new Thread(tailer);
         thread.start();
@@ -179,7 +179,7 @@ public class TailerTest extends FileBase
 
         // Delete & re-create
         file.delete();
-        boolean exists = file.exists();
+        final boolean exists = file.exists();
         assertFalse("File should not exist", exists);
         createFile(file, 0);
         Thread.sleep(testDelayMillis);
@@ -207,7 +207,7 @@ public class TailerTest extends FileBase
     }
 
     @Override
-    protected void createFile(File file, long size)
+    protected void createFile(final File file, final long size)
         throws IOException {
         super.createFile(file, size);
 
@@ -218,11 +218,11 @@ public class TailerTest extends FileBase
             while (reader == null) {
                 try {
                     reader = new RandomAccessFile(file.getPath(), "r");
-                } catch (FileNotFoundException e) {
+                } catch (final FileNotFoundException e) {
                 }
                 try {
                     Thread.sleep(200L);
-                } catch (InterruptedException e) {
+                } catch (final InterruptedException e) {
                     // ignore
                 }
             }
@@ -232,11 +232,11 @@ public class TailerTest extends FileBase
     }
 
     /** Append some lines to a file */
-    private void write(File file, String... lines) throws Exception {
+    private void write(final File file, final String... lines) throws Exception {
         FileWriter writer = null;
         try {
             writer = new FileWriter(file, true);
-            for (String line : lines) {
+            for (final String line : lines) {
                 writer.write(line + "\n");
             }
         } finally {
@@ -245,11 +245,11 @@ public class TailerTest extends FileBase
     }
 
     /** Append a string to a file */
-    private void writeString(File file, String ... strings) throws Exception {
+    private void writeString(final File file, final String ... strings) throws Exception {
         FileWriter writer = null;
         try {
             writer = new FileWriter(file, true);
-            for (String string : strings) {
+            for (final String string : strings) {
                 writer.write(string);
             }
         } finally {
@@ -261,8 +261,8 @@ public class TailerTest extends FileBase
         final File file = new File(getTestDirectory(),"nosuchfile");
         assertFalse("nosuchfile should not exist", file.exists());
         final TestTailerListener listener = new TestTailerListener();
-        int delay = 100;
-        int idle = 50; // allow time for thread to work
+        final int delay = 100;
+        final int idle = 50; // allow time for thread to work
         tailer = Tailer.create(file, listener, delay, false);
         Thread.sleep(idle);
         tailer.stop();
@@ -284,10 +284,10 @@ public class TailerTest extends FileBase
         assertFalse("nosuchfile should not exist", file.exists());
         final TestTailerListener listener = new TestTailerListener();
         // Use a long delay to try to make sure the test thread calls interrupt() while the tailer thread is sleeping.
-        int delay = 1000;
-        int idle = 50; // allow time for thread to work
+        final int delay = 1000;
+        final int idle = 50; // allow time for thread to work
         Tailer tailer = new Tailer(file, listener, delay, false, 4096);
-        Thread thread = new Thread(tailer);
+        final Thread thread = new Thread(tailer);
         thread.setDaemon(true);
         thread.start();
         Thread.sleep(idle);
@@ -304,11 +304,11 @@ public class TailerTest extends FileBase
     public void testStopWithNoFileUsingExecutor() throws Exception {
         final File file = new File(getTestDirectory(),"nosuchfile");
         assertFalse("nosuchfile should not exist", file.exists());
-        TestTailerListener listener = new TestTailerListener();
-        int delay = 100;
-        int idle = 50; // allow time for thread to work
+        final TestTailerListener listener = new TestTailerListener();
+        final int delay = 100;
+        final int idle = 50; // allow time for thread to work
         tailer = new Tailer(file, listener, delay, false);
-        Executor exec = new ScheduledThreadPoolExecutor(1);
+        final Executor exec = new ScheduledThreadPoolExecutor(1);
         exec.execute(tailer);
         Thread.sleep(idle);
         tailer.stop();
@@ -322,7 +322,7 @@ public class TailerTest extends FileBase
 
     public void testIO335() throws Exception { // test CR behaviour
         // Create & start the Tailer
-        long delayMillis = 50;
+        final long delayMillis = 50;
         final File file = new File(getTestDirectory(), "tailer-testio334.txt");
         createFile(file, 0);
         final TestTailerListener listener = new TestTailerListener();
@@ -334,7 +334,7 @@ public class TailerTest extends FileBase
         writeString(file, "CRLF\r\n", "LF\n", "CR\r", "CRCR\r\r", "trail");
         final long testDelayMillis = delayMillis * 10;
         Thread.sleep(testDelayMillis);
-        List<String> lines = listener.getLines();
+        final List<String> lines = listener.getLines();
         assertEquals("line count", 4, lines.size());
         assertEquals("line 1", "CRLF", lines.get(0));
         assertEquals("line 2", "LF", lines.get(1));
@@ -364,7 +364,7 @@ public class TailerTest extends FileBase
 
         volatile int initialised = 0;
 
-        public void handle(String line) {
+        public void handle(final String line) {
             lines.add(line);
         }
 
@@ -376,11 +376,11 @@ public class TailerTest extends FileBase
             lines.clear();
         }
 
-        public void handle(Exception e) {
+        public void handle(final Exception e) {
             exception = e;
         }
 
-        public void init(Tailer tailer) {
+        public void init(final Tailer tailer) {
             initialised++; // not atomic, but OK because only updated here.
         }
 

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TeeInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TeeInputStreamTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TeeInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TeeInputStreamTest.java Fri Nov 30 20:51:39 2012
@@ -35,7 +35,7 @@ public class TeeInputStreamTest extends 
 
     @Override
     protected void setUp() throws Exception {
-        InputStream input = new ByteArrayInputStream("abc".getBytes(ASCII));
+        final InputStream input = new ByteArrayInputStream("abc".getBytes(ASCII));
         output = new ByteArrayOutputStream();
         tee = new TeeInputStream(input, output);
     }
@@ -58,7 +58,7 @@ public class TeeInputStreamTest extends 
     }
 
     public void testReadToArray() throws Exception {
-        byte[] buffer = new byte[8];
+        final byte[] buffer = new byte[8];
         assertEquals(3, tee.read(buffer));
         assertEquals('a', buffer[0]);
         assertEquals('b', buffer[1]);
@@ -68,7 +68,7 @@ public class TeeInputStreamTest extends 
     }
 
     public void testReadToArrayWithOffset() throws Exception {
-        byte[] buffer = new byte[8];
+        final byte[] buffer = new byte[8];
         assertEquals(3, tee.read(buffer, 4, 4));
         assertEquals('a', buffer[4]);
         assertEquals('b', buffer[5]);

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java Fri Nov 30 20:51:39 2012
@@ -42,7 +42,7 @@ public class XmlStreamReaderTest {
     private static final String XML2 = "xml-prolog";
     private static final String XML1 = "xml";
 
-    protected void _testRawNoBomValid(String encoding) throws Exception {
+    protected void _testRawNoBomValid(final String encoding) throws Exception {
         InputStream is = getXmlStream("no-bom", XML1, encoding, encoding);
         XmlStreamReader xmlReader = new XmlStreamReader(is, false);
         assertEquals(xmlReader.getEncoding(), "UTF-8");
@@ -64,12 +64,12 @@ public class XmlStreamReaderTest {
         assertEquals(xmlReader.getEncoding(), encoding);
     }
 
-    protected void _testRawNoBomInvalid(String encoding) throws Exception {
-        InputStream is = getXmlStream("no-bom", XML3, encoding, encoding);
+    protected void _testRawNoBomInvalid(final String encoding) throws Exception {
+        final InputStream is = getXmlStream("no-bom", XML3, encoding, encoding);
         try {
             new XmlStreamReader(is, false);
             fail("It should have failed");
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             assertTrue(ex.getMessage().indexOf("Invalid encoding,") > -1);
         }
     }
@@ -114,10 +114,10 @@ public class XmlStreamReaderTest {
         _testRawNoBomValid("CP1047");
     }
 
-    protected void _testRawBomValid(String encoding) throws Exception {
-        InputStream is = getXmlStream(encoding + "-bom", XML3, encoding,
+    protected void _testRawBomValid(final String encoding) throws Exception {
+        final InputStream is = getXmlStream(encoding + "-bom", XML3, encoding,
                 encoding);
-        XmlStreamReader xmlReader = new XmlStreamReader(is, false);
+        final XmlStreamReader xmlReader = new XmlStreamReader(is, false);
         if (!encoding.equals("UTF-16") && !encoding.equals("UTF-32")) {
             assertEquals(xmlReader.getEncoding(), encoding);
         } else {
@@ -126,16 +126,16 @@ public class XmlStreamReaderTest {
         }
     }
 
-    protected void _testRawBomInvalid(String bomEnc, String streamEnc,
-            String prologEnc) throws Exception {
-        InputStream is = getXmlStream(bomEnc, XML3, streamEnc, prologEnc);
+    protected void _testRawBomInvalid(final String bomEnc, final String streamEnc,
+            final String prologEnc) throws Exception {
+        final InputStream is = getXmlStream(bomEnc, XML3, streamEnc, prologEnc);
         try {
-            XmlStreamReader xmlReader = new XmlStreamReader(is, false);
-            String foundEnc = xmlReader.getEncoding();
+            final XmlStreamReader xmlReader = new XmlStreamReader(is, false);
+            final String foundEnc = xmlReader.getEncoding();
             fail("Expected IOException for BOM " + bomEnc + ", streamEnc "
                     + streamEnc + " and prologEnc " + prologEnc + ": found "
                     + foundEnc);
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             assertTrue(ex.getMessage().indexOf("Invalid encoding,") > -1);
         }
     }
@@ -271,35 +271,35 @@ public class XmlStreamReaderTest {
     
     @Test
     public void testRawContent() throws Exception {
-        String encoding = "UTF-8";
-        String xml = getXML("no-bom", XML3, encoding, encoding);
-        ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes(encoding));
-        XmlStreamReader xmlReader = new XmlStreamReader(is);
+        final String encoding = "UTF-8";
+        final String xml = getXML("no-bom", XML3, encoding, encoding);
+        final ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes(encoding));
+        final XmlStreamReader xmlReader = new XmlStreamReader(is);
         assertEquals("Check encoding", xmlReader.getEncoding(), encoding);
         assertEquals("Check content", xml, IOUtils.toString(xmlReader));
     }
 
     @Test
     public void testHttpContent() throws Exception {
-        String encoding = "UTF-8";
-        String xml = getXML("no-bom", XML3, encoding, encoding);
-        ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes(encoding));
-        XmlStreamReader xmlReader = new XmlStreamReader(is, encoding);
+        final String encoding = "UTF-8";
+        final String xml = getXML("no-bom", XML3, encoding, encoding);
+        final ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes(encoding));
+        final XmlStreamReader xmlReader = new XmlStreamReader(is, encoding);
         assertEquals("Check encoding", xmlReader.getEncoding(), encoding);
         assertEquals("Check content", xml, IOUtils.toString(xmlReader));
     }
 
-    public void _testAlternateDefaultEncoding(String cT, String bomEnc,
-            String streamEnc, String prologEnc, String alternateEnc)
+    public void _testAlternateDefaultEncoding(final String cT, final String bomEnc,
+            final String streamEnc, final String prologEnc, final String alternateEnc)
             throws Exception {
-        InputStream is = getXmlStream(bomEnc, prologEnc == null ? XML1
+        final InputStream is = getXmlStream(bomEnc, prologEnc == null ? XML1
                 : XML3, streamEnc, prologEnc);
-        XmlStreamReader xmlReader = new XmlStreamReader(is, cT, false, alternateEnc);
+        final XmlStreamReader xmlReader = new XmlStreamReader(is, cT, false, alternateEnc);
         if (!streamEnc.equals("UTF-16")) {
             // we can not assert things here because UTF-8, US-ASCII and
             // ISO-8859-1 look alike for the chars used for detection
             // (niallp 2010-10-06 - I re-instated the check below - the tests(6) passed)
-            String enc = alternateEnc != null ? alternateEnc : streamEnc;
+            final String enc = alternateEnc != null ? alternateEnc : streamEnc;
             assertEquals(xmlReader.getEncoding(), enc);
         } else {
             //String enc = (alternateEnc != null) ? alternateEnc : streamEnc;
@@ -308,11 +308,11 @@ public class XmlStreamReaderTest {
         }
     }
 
-    public void _testHttpValid(String cT, String bomEnc, String streamEnc,
-            String prologEnc) throws Exception {
-        InputStream is = getXmlStream(bomEnc,
+    public void _testHttpValid(final String cT, final String bomEnc, final String streamEnc,
+            final String prologEnc) throws Exception {
+        final InputStream is = getXmlStream(bomEnc,
                 prologEnc == null ? XML1 : XML3, streamEnc, prologEnc);
-        XmlStreamReader xmlReader = new XmlStreamReader(is, cT, false);
+        final XmlStreamReader xmlReader = new XmlStreamReader(is, cT, false);
         if (!streamEnc.equals("UTF-16")) {
             // we can not assert things here because UTF-8, US-ASCII and
             // ISO-8859-1 look alike for the chars used for detection
@@ -324,25 +324,25 @@ public class XmlStreamReaderTest {
         }
     }
 
-    protected void _testHttpInvalid(String cT, String bomEnc, String streamEnc,
-            String prologEnc) throws Exception {
-        InputStream is = getXmlStream(bomEnc,
+    protected void _testHttpInvalid(final String cT, final String bomEnc, final String streamEnc,
+            final String prologEnc) throws Exception {
+        final InputStream is = getXmlStream(bomEnc,
                 prologEnc == null ? XML2 : XML3, streamEnc, prologEnc);
         try {
             new XmlStreamReader(is, cT, false);
             fail("It should have failed for HTTP Content-type " + cT + ", BOM "
                     + bomEnc + ", streamEnc " + streamEnc + " and prologEnc "
                     + prologEnc);
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             assertTrue(ex.getMessage().indexOf("Invalid encoding,") > -1);
         }
     }
 
-    protected void _testHttpLenient(String cT, String bomEnc, String streamEnc,
-            String prologEnc, String shouldbe) throws Exception {
-        InputStream is = getXmlStream(bomEnc,
+    protected void _testHttpLenient(final String cT, final String bomEnc, final String streamEnc,
+            final String prologEnc, final String shouldbe) throws Exception {
+        final InputStream is = getXmlStream(bomEnc,
                 prologEnc == null ? XML2 : XML3, streamEnc, prologEnc);
-        XmlStreamReader xmlReader = new XmlStreamReader(is, cT, true);
+        final XmlStreamReader xmlReader = new XmlStreamReader(is, cT, true);
         assertEquals(xmlReader.getEncoding(), shouldbe);
     }
 
@@ -355,9 +355,9 @@ public class XmlStreamReaderTest {
 
     @Test
     public void testEncodingAttributeXML() throws Exception {
-        InputStream is = new ByteArrayInputStream(ENCODING_ATTRIBUTE_XML
+        final InputStream is = new ByteArrayInputStream(ENCODING_ATTRIBUTE_XML
                 .getBytes("UTF-8"));
-        XmlStreamReader xmlReader = new XmlStreamReader(is, "", true);
+        final XmlStreamReader xmlReader = new XmlStreamReader(is, "", true);
         assertEquals(xmlReader.getEncoding(), "UTF-8");
     }
 
@@ -412,18 +412,18 @@ public class XmlStreamReaderTest {
      * @param xmlType xml, xml-prolog, xml-prolog-charset
      * @return XML stream
      */
-    protected InputStream getXmlStream(String bomType, String xmlType,
-            String streamEnc, String prologEnc) throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+    protected InputStream getXmlStream(final String bomType, final String xmlType,
+            final String streamEnc, final String prologEnc) throws IOException {
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
         int[] bom = BOMs.get(bomType);
         if (bom == null) {
             bom = new int[0];
         }
-        for (int element : bom) {
+        for (final int element : bom) {
             baos.write(element);
         }
-        Writer writer = new OutputStreamWriter(baos, streamEnc);
-        String xmlDoc = getXML(bomType, xmlType, streamEnc, prologEnc);
+        final Writer writer = new OutputStreamWriter(baos, streamEnc);
+        final String xmlDoc = getXML(bomType, xmlType, streamEnc, prologEnc);
         writer.write(xmlDoc);
 
         // PADDDING TO TEST THINGS WORK BEYOND PUSHBACK_SIZE
@@ -440,11 +440,11 @@ public class XmlStreamReaderTest {
     /**
      * Create the XML.
      */
-    private String getXML(String bomType, String xmlType,
-            String streamEnc, String prologEnc) {
-        MessageFormat xml = XMLs.get(xmlType);
-        String info = INFO.format(new Object[] { bomType, xmlType, prologEnc });
-        String xmlDoc = xml.format(new Object[] { streamEnc, prologEnc, info });
+    private String getXML(final String bomType, final String xmlType,
+            final String streamEnc, final String prologEnc) {
+        final MessageFormat xml = XMLs.get(xmlType);
+        final String info = INFO.format(new Object[] { bomType, xmlType, prologEnc });
+        final String xmlDoc = xml.format(new Object[] { streamEnc, prologEnc, info });
         return xmlDoc;
     }
 }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java Fri Nov 30 20:51:39 2012
@@ -67,7 +67,7 @@ public class XmlStreamReaderUtilitiesTes
         checkContentTypeEncoding("UTF-32", "application/xml;charset=\"UTF-32\"");
     }
 
-    private void checkContentTypeEncoding(String expected, String httpContentType) {
+    private void checkContentTypeEncoding(final String expected, final String httpContentType) {
         assertEquals("ContentTypeEncoding=[" + httpContentType + "]", expected, XmlStreamReader.getContentTypeEncoding(httpContentType));
     }
 
@@ -82,7 +82,7 @@ public class XmlStreamReaderUtilitiesTes
         checkContentTypeMime("application/xml", "application/xml;charset=utf-32");
     }
     
-    private void checkContentTypeMime(String expected, String httpContentType) {
+    private void checkContentTypeMime(final String expected, final String httpContentType) {
         assertEquals("ContentTypeMime=[" + httpContentType + "]", expected, XmlStreamReader.getContentTypeMime(httpContentType));
     }
 
@@ -103,7 +103,7 @@ public class XmlStreamReaderUtilitiesTes
         checkAppXml(true,  "application/xml-external-parsed-entity");
     }
     
-    private void checkAppXml(boolean expected, String mime) {
+    private void checkAppXml(final boolean expected, final String mime) {
         assertEquals("Mime=[" + mime + "]", expected, XmlStreamReader.isAppXml(mime));
     }
 
@@ -121,7 +121,7 @@ public class XmlStreamReaderUtilitiesTes
         checkTextXml(false, "application/atom+xml");
     }
     
-    private void checkTextXml(boolean expected, String mime) {
+    private void checkTextXml(final boolean expected, final String mime) {
         assertEquals("Mime=[" + mime + "]", expected, XmlStreamReader.isTextXml(mime));
     }
 
@@ -163,7 +163,7 @@ public class XmlStreamReaderUtilitiesTes
         testCalculateRawEncodingStandard("UTF-32LE", "UTF-8",    "UTF-32BE");
 }
     
-    private void testCalculateRawEncodingStandard(String bomEnc, String otherEnc, String defaultEnc) throws IOException {
+    private void testCalculateRawEncodingStandard(final String bomEnc, final String otherEnc, final String defaultEnc) throws IOException {
         //               Expected   BOM        Guess     XMLEnc    Default
         checkRawEncoding(bomEnc,    bomEnc,    null,     null,     defaultEnc);
         checkRawEncoding(bomEnc,    bomEnc,    bomEnc,   null,     defaultEnc);
@@ -208,30 +208,30 @@ public class XmlStreamReaderUtilitiesTes
         checkRawError(RAWMGS1,       "UTF-32LE", "UTF-32LE", "UTF-32BE", null);
     }
     
-    private void checkRawEncoding(String expected,
-            String bomEnc, String xmlGuessEnc, String xmlEnc, String defaultEncoding) throws IOException {
-        StringBuilder builder = new StringBuilder();
+    private void checkRawEncoding(final String expected,
+            final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final String defaultEncoding) throws IOException {
+        final StringBuilder builder = new StringBuilder();
         builder.append("RawEncoding: ").append(bomEnc).append("], ");
         builder.append("bomEnc=[").append(bomEnc).append("], ");
         builder.append("xmlGuessEnc=[").append(xmlGuessEnc).append("], ");
         builder.append("xmlEnc=[").append(xmlEnc).append("], ");
         builder.append("defaultEncoding=[").append(defaultEncoding).append("],");
-        String encoding = calculateRawEncoding(bomEnc,xmlGuessEnc,xmlEnc, defaultEncoding);
+        final String encoding = calculateRawEncoding(bomEnc,xmlGuessEnc,xmlEnc, defaultEncoding);
         assertEquals(builder.toString(), expected, encoding);
     }
     
-    protected String calculateRawEncoding(String bomEnc, String xmlGuessEnc, String xmlEnc,
-            String defaultEncoding) throws IOException {
-        MockXmlStreamReader mock = new MockXmlStreamReader(defaultEncoding);
+    protected String calculateRawEncoding(final String bomEnc, final String xmlGuessEnc, final String xmlEnc,
+            final String defaultEncoding) throws IOException {
+        final MockXmlStreamReader mock = new MockXmlStreamReader(defaultEncoding);
         return mock.calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc);
     }
     
-    private void checkRawError(String msgSuffix,
-            String bomEnc, String xmlGuessEnc, String xmlEnc, String defaultEncoding) {
+    private void checkRawError(final String msgSuffix,
+            final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final String defaultEncoding) {
         try {
             checkRawEncoding("XmlStreamReaderException", bomEnc, xmlGuessEnc, xmlEnc, defaultEncoding);
             fail("Expected XmlStreamReaderException");
-        } catch (XmlStreamReaderException e) {
+        } catch (final XmlStreamReaderException e) {
             assertTrue("Msg Start: " + e.getMessage(), e.getMessage().startsWith("Invalid encoding"));
             assertTrue("Msg End: "   + e.getMessage(), e.getMessage().endsWith(msgSuffix));
             assertEquals("bomEnc",      bomEnc,      e.getBomEncoding());
@@ -239,7 +239,7 @@ public class XmlStreamReaderUtilitiesTes
             assertEquals("xmlEnc",      xmlEnc,      e.getXmlEncoding());
             assertNull("ContentTypeEncoding", e.getContentTypeEncoding());
             assertNull("ContentTypeMime",     e.getContentTypeMime());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             fail("Expected XmlStreamReaderException, but threw " + e);
         }
     }
@@ -289,9 +289,9 @@ public class XmlStreamReaderUtilitiesTes
         checkHttpEncoding("UTF-8",    false,  APPXML_UTF8,    "UTF-32BE", "UTF-32BE", "UTF-32BE", "UTF-32BE");
     }
     
-    private void checkHttpEncoding(String expected, boolean lenient, String httpContentType,
-            String bomEnc, String xmlGuessEnc, String xmlEnc, String defaultEncoding) throws IOException {
-        StringBuilder builder = new StringBuilder();
+    private void checkHttpEncoding(final String expected, final boolean lenient, final String httpContentType,
+            final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final String defaultEncoding) throws IOException {
+        final StringBuilder builder = new StringBuilder();
         builder.append("HttpEncoding=[").append(bomEnc).append("], ");
         builder.append("lenient=[").append(lenient).append("], ");
         builder.append("httpContentType=[").append(httpContentType).append("], ");
@@ -299,22 +299,22 @@ public class XmlStreamReaderUtilitiesTes
         builder.append("xmlGuessEnc=[").append(xmlGuessEnc).append("], ");
         builder.append("xmlEnc=[").append(xmlEnc).append("], ");
         builder.append("defaultEncoding=[").append(defaultEncoding).append("],");
-        String encoding = calculateHttpEncoding(httpContentType, bomEnc, xmlGuessEnc, xmlEnc, lenient, defaultEncoding);
+        final String encoding = calculateHttpEncoding(httpContentType, bomEnc, xmlGuessEnc, xmlEnc, lenient, defaultEncoding);
         assertEquals(builder.toString(), expected, encoding);
     }
     
-    protected String calculateHttpEncoding(String httpContentType, String bomEnc, String xmlGuessEnc,
-            String xmlEnc, boolean lenient, String defaultEncoding) throws IOException {
-        MockXmlStreamReader mock = new MockXmlStreamReader(defaultEncoding);
+    protected String calculateHttpEncoding(final String httpContentType, final String bomEnc, final String xmlGuessEnc,
+            final String xmlEnc, final boolean lenient, final String defaultEncoding) throws IOException {
+        final MockXmlStreamReader mock = new MockXmlStreamReader(defaultEncoding);
         return mock.calculateHttpEncoding(httpContentType, bomEnc, xmlGuessEnc, xmlEnc, lenient);
     }
     
-    private void checkHttpError(String msgSuffix, boolean lenient, String httpContentType,
-            String bomEnc, String xmlGuessEnc, String xmlEnc, String defaultEncoding) {
+    private void checkHttpError(final String msgSuffix, final boolean lenient, final String httpContentType,
+            final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final String defaultEncoding) {
         try {
             checkHttpEncoding("XmlStreamReaderException", lenient, httpContentType, bomEnc, xmlGuessEnc, xmlEnc, defaultEncoding);
             fail("Expected XmlStreamReaderException");
-        } catch (XmlStreamReaderException e) {
+        } catch (final XmlStreamReaderException e) {
             assertTrue("Msg Start: " + e.getMessage(), e.getMessage().startsWith("Invalid encoding"));
             assertTrue("Msg End: "   + e.getMessage(), e.getMessage().endsWith(msgSuffix));
             assertEquals("bomEnc",      bomEnc,      e.getBomEncoding());
@@ -324,14 +324,14 @@ public class XmlStreamReaderUtilitiesTes
                                                 e.getContentTypeEncoding());
             assertEquals("ContentTypeMime", XmlStreamReader.getContentTypeMime(httpContentType),
                                             e.getContentTypeMime());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             fail("Expected XmlStreamReaderException, but threw " + e);
         }
     }
 
     /** Mock {@link XmlStreamReader} implementation */
     private static class MockXmlStreamReader extends XmlStreamReader {
-        MockXmlStreamReader(String defaultEncoding) throws IOException {
+        MockXmlStreamReader(final String defaultEncoding) throws IOException {
             super(new ByteArrayInputStream("".getBytes()), null, true, defaultEncoding);
         }
     }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java Fri Nov 30 20:51:39 2012
@@ -88,7 +88,7 @@ public class XmlStreamReader extends Rea
 
     private String encoding;
 
-    private String defaultEncoding;
+    private final String defaultEncoding;
 
     /**
      * Sets the default encoding to use if none is set in HTTP content-type, XML
@@ -100,7 +100,7 @@ public class XmlStreamReader extends Rea
      *
      * @param encoding charset encoding to default to.
      */
-    public static void setDefaultEncoding(String encoding) {
+    public static void setDefaultEncoding(final String encoding) {
         staticDefaultEncoding = encoding;
     }
 
@@ -128,7 +128,7 @@ public class XmlStreamReader extends Rea
      * @param file File to create a Reader from.
      * @throws IOException thrown if there is a problem reading the file.
      */
-    public XmlStreamReader(File file) throws IOException {
+    public XmlStreamReader(final File file) throws IOException {
         this(new FileInputStream(file));
     }
 
@@ -143,7 +143,7 @@ public class XmlStreamReader extends Rea
      * @param is InputStream to create a Reader from.
      * @throws IOException thrown if there is a problem reading the stream.
      */
-    public XmlStreamReader(InputStream is) throws IOException {
+    public XmlStreamReader(final InputStream is) throws IOException {
         this(is, true);
     }
 
@@ -174,12 +174,12 @@ public class XmlStreamReader extends Rea
      * @throws XmlStreamReaderException thrown if the charset encoding could not
      *         be determined according to the specs.
      */
-    public XmlStreamReader(InputStream is, boolean lenient) throws IOException,
+    public XmlStreamReader(final InputStream is, final boolean lenient) throws IOException,
             XmlStreamReaderException {
         defaultEncoding = staticDefaultEncoding;
         try {
             doRawStream(is, lenient);
-        } catch (XmlStreamReaderException ex) {
+        } catch (final XmlStreamReaderException ex) {
             if (!lenient) {
                 throw ex;
             } else {
@@ -205,7 +205,7 @@ public class XmlStreamReader extends Rea
      * @throws IOException thrown if there is a problem reading the stream of
      *         the URL.
      */
-    public XmlStreamReader(URL url) throws IOException {
+    public XmlStreamReader(final URL url) throws IOException {
         this(url.openConnection());
     }
 
@@ -227,27 +227,27 @@ public class XmlStreamReader extends Rea
      * @throws IOException thrown if there is a problem reading the stream of
      *         the URLConnection.
      */
-    public XmlStreamReader(URLConnection conn) throws IOException {
+    public XmlStreamReader(final URLConnection conn) throws IOException {
         defaultEncoding = staticDefaultEncoding;
-        boolean lenient = true;
+        final boolean lenient = true;
         if (conn instanceof HttpURLConnection) {
             try {
                 doHttpStream(conn.getInputStream(), conn.getContentType(),
                         lenient);
-            } catch (XmlStreamReaderException ex) {
+            } catch (final XmlStreamReaderException ex) {
                 doLenientDetection(conn.getContentType(), ex);
             }
         } else if (conn.getContentType() != null) {
             try {
                 doHttpStream(conn.getInputStream(), conn.getContentType(),
                         lenient);
-            } catch (XmlStreamReaderException ex) {
+            } catch (final XmlStreamReaderException ex) {
                 doLenientDetection(conn.getContentType(), ex);
             }
         } else {
             try {
                 doRawStream(conn.getInputStream(), lenient);
-            } catch (XmlStreamReaderException ex) {
+            } catch (final XmlStreamReaderException ex) {
                 doLenientDetection(null, ex);
             }
         }
@@ -270,7 +270,7 @@ public class XmlStreamReader extends Rea
      *        the charset encoding.
      * @throws IOException thrown if there is a problem reading the file.
      */
-    public XmlStreamReader(InputStream is, String httpContentType)
+    public XmlStreamReader(final InputStream is, final String httpContentType)
             throws IOException {
         this(is, httpContentType, true);
     }
@@ -308,14 +308,14 @@ public class XmlStreamReader extends Rea
      * @throws XmlStreamReaderException thrown if the charset encoding could not
      *         be determined according to the specs.
      */
-    public XmlStreamReader(InputStream is, String httpContentType,
-            boolean lenient, String defaultEncoding) throws IOException,
+    public XmlStreamReader(final InputStream is, final String httpContentType,
+            final boolean lenient, final String defaultEncoding) throws IOException,
             XmlStreamReaderException {
         this.defaultEncoding = defaultEncoding == null ? staticDefaultEncoding
                 : defaultEncoding;
         try {
             doHttpStream(is, httpContentType, lenient);
-        } catch (XmlStreamReaderException ex) {
+        } catch (final XmlStreamReaderException ex) {
             if (!lenient) {
                 throw ex;
             } else {
@@ -357,8 +357,8 @@ public class XmlStreamReader extends Rea
      * @throws XmlStreamReaderException thrown if the charset encoding could not
      *         be determined according to the specs.
      */
-    public XmlStreamReader(InputStream is, String httpContentType,
-            boolean lenient) throws IOException, XmlStreamReaderException {
+    public XmlStreamReader(final InputStream is, final String httpContentType,
+            final boolean lenient) throws IOException, XmlStreamReaderException {
         this(is, httpContentType, lenient, null);
     }
 
@@ -372,7 +372,7 @@ public class XmlStreamReader extends Rea
                 try {
                     doHttpStream(ex.getInputStream(), httpContentType, true);
                     ex = null;
-                } catch (XmlStreamReaderException ex2) {
+                } catch (final XmlStreamReaderException ex2) {
                     ex = ex2;
                 }
             }
@@ -399,7 +399,7 @@ public class XmlStreamReader extends Rea
     }
 
     @Override
-    public int read(char[] buf, int offset, int len) throws IOException {
+    public int read(final char[] buf, final int offset, final int len) throws IOException {
         return reader.read(buf, offset, len);
     }
 
@@ -413,38 +413,38 @@ public class XmlStreamReader extends Rea
         reader.close();
     }
 
-    private void doRawStream(InputStream is, boolean lenient)
+    private void doRawStream(final InputStream is, final boolean lenient)
             throws IOException {
-        BufferedInputStream pis = new BufferedInputStream(is, BUFFER_SIZE);
-        String bomEnc = getBOMEncoding(pis);
-        String xmlGuessEnc = getXMLGuessEncoding(pis);
-        String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
-        String encoding = calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc, pis);
+        final BufferedInputStream pis = new BufferedInputStream(is, BUFFER_SIZE);
+        final String bomEnc = getBOMEncoding(pis);
+        final String xmlGuessEnc = getXMLGuessEncoding(pis);
+        final String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
+        final String encoding = calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc, pis);
         prepareReader(pis, encoding);
     }
 
-    private void doHttpStream(InputStream is, String httpContentType,
-            boolean lenient) throws IOException {
-        BufferedInputStream pis = new BufferedInputStream(is, BUFFER_SIZE);
-        String cTMime = getContentTypeMime(httpContentType);
-        String cTEnc = getContentTypeEncoding(httpContentType);
-        String bomEnc = getBOMEncoding(pis);
-        String xmlGuessEnc = getXMLGuessEncoding(pis);
-        String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
-        String encoding = calculateHttpEncoding(cTMime, cTEnc, bomEnc,
+    private void doHttpStream(final InputStream is, final String httpContentType,
+            final boolean lenient) throws IOException {
+        final BufferedInputStream pis = new BufferedInputStream(is, BUFFER_SIZE);
+        final String cTMime = getContentTypeMime(httpContentType);
+        final String cTEnc = getContentTypeEncoding(httpContentType);
+        final String bomEnc = getBOMEncoding(pis);
+        final String xmlGuessEnc = getXMLGuessEncoding(pis);
+        final String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
+        final String encoding = calculateHttpEncoding(cTMime, cTEnc, bomEnc,
                 xmlGuessEnc, xmlEnc, pis, lenient);
         prepareReader(pis, encoding);
     }
 
-    private void prepareReader(InputStream is, String encoding)
+    private void prepareReader(final InputStream is, final String encoding)
             throws IOException {
         reader = new InputStreamReader(is, encoding);
         this.encoding = encoding;
     }
 
     // InputStream is passed for XmlStreamReaderException creation only
-    String calculateRawEncoding(String bomEnc, String xmlGuessEnc,
-            String xmlEnc, InputStream is) throws IOException {
+    String calculateRawEncoding(final String bomEnc, final String xmlGuessEnc,
+            final String xmlEnc, final InputStream is) throws IOException {
         String encoding;
         if (bomEnc == null) {
             if (xmlGuessEnc == null || xmlEnc == null) {
@@ -505,15 +505,15 @@ public class XmlStreamReader extends Rea
     }
 
     // InputStream is passed for XmlStreamReaderException creation only
-    String calculateHttpEncoding(String cTMime, String cTEnc,
-            String bomEnc, String xmlGuessEnc, String xmlEnc, InputStream is,
-            boolean lenient) throws IOException {
+    String calculateHttpEncoding(final String cTMime, final String cTEnc,
+            final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final InputStream is,
+            final boolean lenient) throws IOException {
         String encoding;
         if (lenient & xmlEnc != null) {
             encoding = xmlEnc;
         } else {
-            boolean appXml = isAppXml(cTMime);
-            boolean textXml = isTextXml(cTMime);
+            final boolean appXml = isAppXml(cTMime);
+            final boolean textXml = isTextXml(cTMime);
             if (appXml || textXml) {
                 if (cTEnc == null) {
                     if (appXml) {
@@ -567,10 +567,10 @@ public class XmlStreamReader extends Rea
     }
 
     // returns MIME type or NULL if httpContentType is NULL
-    static String getContentTypeMime(String httpContentType) {
+    static String getContentTypeMime(final String httpContentType) {
         String mime = null;
         if (httpContentType != null) {
-            int i = httpContentType.indexOf(";");
+            final int i = httpContentType.indexOf(";");
             mime = (i == -1 ? httpContentType : httpContentType.substring(0,
                     i)).trim();
         }
@@ -582,13 +582,13 @@ public class XmlStreamReader extends Rea
 
     // returns charset parameter value, NULL if not present, NULL if
     // httpContentType is NULL
-    static String getContentTypeEncoding(String httpContentType) {
+    static String getContentTypeEncoding(final String httpContentType) {
         String encoding = null;
         if (httpContentType != null) {
-            int i = httpContentType.indexOf(";");
+            final int i = httpContentType.indexOf(";");
             if (i > -1) {
-                String postMime = httpContentType.substring(i + 1);
-                Matcher m = CHARSET_PATTERN.matcher(postMime);
+                final String postMime = httpContentType.substring(i + 1);
+                final Matcher m = CHARSET_PATTERN.matcher(postMime);
                 encoding = m.find() ? m.group(1) : null;
                 encoding = encoding != null ? encoding.toUpperCase() : null;
             }
@@ -598,10 +598,10 @@ public class XmlStreamReader extends Rea
 
     // returns the BOM in the stream, NULL if not present,
     // if there was BOM the in the stream it is consumed
-    static String getBOMEncoding(BufferedInputStream is)
+    static String getBOMEncoding(final BufferedInputStream is)
             throws IOException {
         String encoding = null;
-        int[] bytes = new int[3];
+        final int[] bytes = new int[3];
         is.mark(3);
         bytes[0] = is.read();
         bytes[1] = is.read();
@@ -627,10 +627,10 @@ public class XmlStreamReader extends Rea
 
     // returns the best guess for the encoding by looking the first bytes of the
     // stream, '<?'
-    private static String getXMLGuessEncoding(BufferedInputStream is)
+    private static String getXMLGuessEncoding(final BufferedInputStream is)
             throws IOException {
         String encoding = null;
-        int[] bytes = new int[4];
+        final int[] bytes = new int[4];
         is.mark(4);
         bytes[0] = is.read();
         bytes[1] = is.read();
@@ -659,11 +659,11 @@ public class XmlStreamReader extends Rea
             Pattern.MULTILINE);
 
     // returns the encoding declared in the <?xml encoding=...?>, NULL if none
-    private static String getXmlProlog(BufferedInputStream is, String guessedEnc)
+    private static String getXmlProlog(final BufferedInputStream is, final String guessedEnc)
             throws IOException {
         String encoding = null;
         if (guessedEnc != null) {
-            byte[] bytes = new byte[BUFFER_SIZE];
+            final byte[] bytes = new byte[BUFFER_SIZE];
             is.mark(BUFFER_SIZE);
             int offset = 0;
             int max = BUFFER_SIZE;
@@ -686,18 +686,18 @@ public class XmlStreamReader extends Rea
                                     + offset + " bytes");
                 }
             }
-            int bytesRead = offset;
+            final int bytesRead = offset;
             if (bytesRead > 0) {
                 is.reset();
-                BufferedReader bReader = new BufferedReader(new StringReader(
+                final BufferedReader bReader = new BufferedReader(new StringReader(
                         xmlProlog.substring(0, firstGT + 1)));
-                StringBuffer prolog = new StringBuffer();
+                final StringBuffer prolog = new StringBuffer();
                 String line = bReader.readLine();
                 while (line != null) {
                     prolog.append(line);
                     line = bReader.readLine();
                 }
-                Matcher m = ENCODING_PATTERN.matcher(prolog);
+                final Matcher m = ENCODING_PATTERN.matcher(prolog);
                 if (m.find()) {
                     encoding = m.group(1).toUpperCase();
                     encoding = encoding.substring(1, encoding.length() - 1);
@@ -708,7 +708,7 @@ public class XmlStreamReader extends Rea
     }
 
     // indicates if the MIME type belongs to the APPLICATION XML family
-    static boolean isAppXml(String mime) {
+    static boolean isAppXml(final String mime) {
         return mime != null
                 && (mime.equals("application/xml")
                         || mime.equals("application/xml-dtd")
@@ -718,7 +718,7 @@ public class XmlStreamReader extends Rea
     }
 
     // indicates if the MIME type belongs to the TEXT XML family
-    static boolean isTextXml(String mime) {
+    static boolean isTextXml(final String mime) {
         return mime != null
                 && (mime.equals("text/xml")
                         || mime.equals("text/xml-external-parsed-entity") || mime

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderException.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderException.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderException.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderException.java Fri Nov 30 20:51:39 2012
@@ -48,8 +48,8 @@ public class XmlStreamReaderException ex
      * @param xmlEnc XML prolog encoding.
      * @param is the unconsumed InputStream.
      */
-    public XmlStreamReaderException(String msg, String bomEnc,
-            String xmlGuessEnc, String xmlEnc, InputStream is) {
+    public XmlStreamReaderException(final String msg, final String bomEnc,
+            final String xmlGuessEnc, final String xmlEnc, final InputStream is) {
         this(msg, null, null, bomEnc, xmlGuessEnc, xmlEnc, is);
     }
 
@@ -67,8 +67,8 @@ public class XmlStreamReaderException ex
      * @param xmlEnc XML prolog encoding.
      * @param is the unconsumed InputStream.
      */
-    public XmlStreamReaderException(String msg, String ctMime, String ctEnc,
-            String bomEnc, String xmlGuessEnc, String xmlEnc, InputStream is) {
+    public XmlStreamReaderException(final String msg, final String ctMime, final String ctEnc,
+            final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final InputStream is) {
         super(msg, ctMime, ctEnc, bomEnc, xmlGuessEnc, xmlEnc);
         this.is = is;
     }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderUtilitiesCompatibilityTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderUtilitiesCompatibilityTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderUtilitiesCompatibilityTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderUtilitiesCompatibilityTest.java Fri Nov 30 20:51:39 2012
@@ -27,15 +27,15 @@ import org.apache.commons.io.input.XmlSt
 public class XmlStreamReaderUtilitiesCompatibilityTest extends XmlStreamReaderUtilitiesTest {
 
     @Override
-    protected String calculateRawEncoding(String bomEnc, String xmlGuessEnc, String xmlEnc,
-            String defaultEncoding) throws IOException {
-        MockXmlStreamReader mock = new MockXmlStreamReader(defaultEncoding);
+    protected String calculateRawEncoding(final String bomEnc, final String xmlGuessEnc, final String xmlEnc,
+            final String defaultEncoding) throws IOException {
+        final MockXmlStreamReader mock = new MockXmlStreamReader(defaultEncoding);
         return mock.calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc, null);
     }
     @Override
-    protected String calculateHttpEncoding(String httpContentType, String bomEnc, String xmlGuessEnc,
-            String xmlEnc, boolean lenient, String defaultEncoding) throws IOException {
-        MockXmlStreamReader mock = new MockXmlStreamReader(defaultEncoding);
+    protected String calculateHttpEncoding(final String httpContentType, final String bomEnc, final String xmlGuessEnc,
+            final String xmlEnc, final boolean lenient, final String defaultEncoding) throws IOException {
+        final MockXmlStreamReader mock = new MockXmlStreamReader(defaultEncoding);
         return mock.calculateHttpEncoding(
                 XmlStreamReader.getContentTypeMime(httpContentType),
                 XmlStreamReader.getContentTypeEncoding(httpContentType),
@@ -44,7 +44,7 @@ public class XmlStreamReaderUtilitiesCom
 
     /** Mock {@link XmlStreamReader} implementation */
     private static class MockXmlStreamReader extends XmlStreamReader {
-        MockXmlStreamReader(String defaultEncoding) throws IOException {
+        MockXmlStreamReader(final String defaultEncoding) throws IOException {
             super(new ByteArrayInputStream("".getBytes()), null, true, defaultEncoding);
         }
     }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java Fri Nov 30 20:51:39 2012
@@ -51,7 +51,7 @@ public abstract class AbstractMonitorTes
      *
      * @param name The name of the test
      */
-    public AbstractMonitorTestCase(String name) {
+    public AbstractMonitorTestCase(final String name) {
         super(name);
     }
 
@@ -64,15 +64,15 @@ public abstract class AbstractMonitorTes
             testDir.mkdir();
         }
 
-        IOFileFilter files = FileFilterUtils.fileFileFilter();
-        IOFileFilter javaSuffix = FileFilterUtils.suffixFileFilter(".java");
-        IOFileFilter fileFilter = FileFilterUtils.and(files, javaSuffix);
+        final IOFileFilter files = FileFilterUtils.fileFileFilter();
+        final IOFileFilter javaSuffix = FileFilterUtils.suffixFileFilter(".java");
+        final IOFileFilter fileFilter = FileFilterUtils.and(files, javaSuffix);
         
-        IOFileFilter directories = FileFilterUtils.directoryFileFilter();
-        IOFileFilter visible = HiddenFileFilter.VISIBLE;
-        IOFileFilter dirFilter = FileFilterUtils.and(directories, visible);
+        final IOFileFilter directories = FileFilterUtils.directoryFileFilter();
+        final IOFileFilter visible = HiddenFileFilter.VISIBLE;
+        final IOFileFilter dirFilter = FileFilterUtils.and(directories, visible);
 
-        IOFileFilter filter = FileFilterUtils.or(dirFilter, fileFilter);
+        final IOFileFilter filter = FileFilterUtils.or(dirFilter, fileFilter);
         
         createObserver(testDir, filter);
     }
@@ -83,13 +83,13 @@ public abstract class AbstractMonitorTes
      * @param file The directory to observe
      * @param fileFilter The file filter to apply
      */
-    protected void createObserver(File file, FileFilter fileFilter) {
+    protected void createObserver(final File file, final FileFilter fileFilter) {
         observer = new FileAlterationObserver(file, fileFilter);
         observer.addListener(listener);
         observer.addListener(new FileAlterationListenerAdaptor());
         try {
             observer.initialize();
-        } catch (Exception e) {
+        } catch (final Exception e) {
             fail("Observer init() threw " + e);
         }
     }
@@ -102,14 +102,14 @@ public abstract class AbstractMonitorTes
     /**
      * Check all the Collections are empty
      */
-    protected void checkCollectionsEmpty(String label) {
+    protected void checkCollectionsEmpty(final String label) {
         checkCollectionSizes("EMPTY-" + label, 0, 0, 0, 0, 0, 0);
     }
 
     /**
      * Check all the Collections have the expected sizes.
      */
-    protected void checkCollectionSizes(String label, int dirCreate, int dirChange, int dirDelete, int fileCreate, int fileChange, int fileDelete) {
+    protected void checkCollectionSizes(String label, final int dirCreate, final int dirChange, final int dirDelete, final int fileCreate, final int fileChange, final int fileDelete) {
         label = label + "[" + listener.getCreatedDirectories().size() +
                         " " + listener.getChangedDirectories().size() +
                         " " + listener.getDeletedDirectories().size() +
@@ -132,7 +132,7 @@ public abstract class AbstractMonitorTes
      * @return The file
      */
     protected File touch(File file) {
-        long lastModified = file.exists() ? file.lastModified() : 0;
+        final long lastModified = file.exists() ? file.lastModified() : 0;
         try {
             FileUtils.touch(file);
             file = new File(file.getParent(), file.getName());
@@ -141,7 +141,7 @@ public abstract class AbstractMonitorTes
                 FileUtils.touch(file);
                 file = new File(file.getParent(), file.getName());
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             fail("Touching " + file + ": " + e);
         }
         sleepHandleInterruped(pauseTime);
@@ -151,10 +151,10 @@ public abstract class AbstractMonitorTes
     /**
      * Thread.sleep(timeInMilliseconds) - ignore InterruptedException
      */
-    protected void sleepHandleInterruped(long timeInMilliseconds) {
+    protected void sleepHandleInterruped(final long timeInMilliseconds) {
         try {
             Thread.sleep(timeInMilliseconds);
-        } catch(InterruptedException ie) {
+        } catch(final InterruptedException ie) {
             // ignore
         }
     }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFileListener.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFileListener.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFileListener.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFileListener.java Fri Nov 30 20:51:39 2012
@@ -40,7 +40,7 @@ public class CollectionFileListener impl
      *
      * @param clearOnStart true if clear() should be called by onStart().
      */
-    public CollectionFileListener(boolean clearOnStart) {
+    public CollectionFileListener(final boolean clearOnStart) {
         this.clearOnStart = clearOnStart;
     }
 

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationMonitorTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationMonitorTestCase.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationMonitorTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationMonitorTestCase.java Fri Nov 30 20:51:39 2012
@@ -31,7 +31,7 @@ public class FileAlterationMonitorTestCa
      *
      * @param name The name of the test
      */
-    public FileAlterationMonitorTestCase(String name) {
+    public FileAlterationMonitorTestCase(final String name) {
         super(name);
         testDirName = "test-monitor";
     }
@@ -46,7 +46,7 @@ public class FileAlterationMonitorTestCa
      * Test default constructor.
      */
     public void testDefaultConstructor() {
-        FileAlterationMonitor monitor = new FileAlterationMonitor();
+        final FileAlterationMonitor monitor = new FileAlterationMonitor();
         assertEquals("Interval", 10000, monitor.getInterval());
     }
 
@@ -73,9 +73,9 @@ public class FileAlterationMonitorTestCa
         monitor.removeObserver(null);
 
         // Add Observer
-        FileAlterationObserver observer = new FileAlterationObserver("foo");
+        final FileAlterationObserver observer = new FileAlterationObserver("foo");
         monitor.addObserver(observer);
-        Iterator<FileAlterationObserver> it = monitor.getObservers().iterator();
+        final Iterator<FileAlterationObserver> it = monitor.getObservers().iterator();
         assertTrue("Observers[4]", it.hasNext());
         assertEquals("Added", observer, it.next());
         assertFalse("Observers[5]", it.hasNext());
@@ -90,15 +90,15 @@ public class FileAlterationMonitorTestCa
      */
     public void testMonitor() {
         try {
-            long interval = 100;
+            final long interval = 100;
             listener.clear();
-            FileAlterationMonitor monitor = new FileAlterationMonitor(interval, observer);
+            final FileAlterationMonitor monitor = new FileAlterationMonitor(interval, observer);
             assertEquals("Interval", interval, monitor.getInterval());
             monitor.start();
 
             try {
                 monitor.start(); // try and start again
-            } catch (IllegalStateException e) {
+            } catch (final IllegalStateException e) {
                 // expected result, monitor already running
             }
 
@@ -125,10 +125,10 @@ public class FileAlterationMonitorTestCa
 
             try {
                 monitor.stop(); // try and stop again
-            } catch (IllegalStateException e) {
+            } catch (final IllegalStateException e) {
                 // expected result, monitor already stopped
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             e.printStackTrace();
             fail("Threw " + e);
         }
@@ -139,16 +139,16 @@ public class FileAlterationMonitorTestCa
      */
     public void testThreadFactory() {
         try {
-            long interval = 100;
+            final long interval = 100;
             listener.clear();
-            FileAlterationMonitor monitor = new FileAlterationMonitor(interval, observer);
+            final FileAlterationMonitor monitor = new FileAlterationMonitor(interval, observer);
             monitor.setThreadFactory(Executors.defaultThreadFactory());
             assertEquals("Interval", interval, monitor.getInterval());
             monitor.start();
 
             // Create a File
             checkCollectionsEmpty("A");
-            File file2 = touch(new File(testDir, "file2.java"));
+            final File file2 = touch(new File(testDir, "file2.java"));
             checkFile("Create", file2, listener.getCreatedFiles());
             listener.clear();
 
@@ -161,7 +161,7 @@ public class FileAlterationMonitorTestCa
             // Stop monitoring
             monitor.stop();
 
-        } catch (Exception e) {
+        } catch (final Exception e) {
             e.printStackTrace();
             fail("Threw " + e);
         }
@@ -170,7 +170,7 @@ public class FileAlterationMonitorTestCa
     /**
      * Check all the File Collections have the expected sizes.
      */
-    private void checkFile(String label, File file, Collection<File> files) {
+    private void checkFile(final String label, final File file, final Collection<File> files) {
         for (int i = 0; i < 20; i++) {
             if (files.contains(file)) {
                 return; // found, test passes