commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1415850 [13/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...
Date Fri, 30 Nov 2012 20:52:08 GMT
Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java Fri Nov 30 20:51:39 2012
@@ -72,7 +72,7 @@ public class BOMInputStreamTest {
         }
     }
 
-    private void assertData(byte[] expected, byte[] actual, int len)
+    private void assertData(final byte[] expected, final byte[] actual, final int len)
         throws Exception {
         assertEquals("length", expected.length, len);
         for (int ii = 0; ii < expected.length; ii++) {
@@ -83,7 +83,7 @@ public class BOMInputStreamTest {
     /**
      *  Creates the underlying data stream, with or without BOM.
      */
-    private InputStream createUtf16BeDataStream(byte[] baseData, boolean addBOM) {
+    private InputStream createUtf16BeDataStream(final byte[] baseData, final boolean addBOM) {
         byte[] data = baseData;
         if (addBOM) {
             data = new byte[baseData.length + 2];
@@ -97,7 +97,7 @@ public class BOMInputStreamTest {
     /**
      *  Creates the underlying data stream, with or without BOM.
      */
-    private InputStream createUtf16LeDataStream(byte[] baseData, boolean addBOM) {
+    private InputStream createUtf16LeDataStream(final byte[] baseData, final boolean addBOM) {
         byte[] data = baseData;
         if (addBOM) {
             data = new byte[baseData.length + 2];
@@ -111,7 +111,7 @@ public class BOMInputStreamTest {
     /**
      *  Creates the underlying data stream, with or without BOM.
      */
-    private InputStream createUtf32BeDataStream(byte[] baseData, boolean addBOM) {
+    private InputStream createUtf32BeDataStream(final byte[] baseData, final boolean addBOM) {
         byte[] data = baseData;
         if (addBOM) {
             data = new byte[baseData.length + 4];
@@ -127,7 +127,7 @@ public class BOMInputStreamTest {
     /**
      *  Creates the underlying data stream, with or without BOM.
      */
-    private InputStream createUtf32LeDataStream(byte[] baseData, boolean addBOM) {
+    private InputStream createUtf32LeDataStream(final byte[] baseData, final boolean addBOM) {
         byte[] data = baseData;
         if (addBOM) {
             data = new byte[baseData.length + 4];
@@ -143,7 +143,7 @@ public class BOMInputStreamTest {
     /**
      *  Creates the underlying data stream, with or without BOM.
      */
-    private InputStream createUtf8DataStream(byte[] baseData, boolean addBOM) {
+    private InputStream createUtf8DataStream(final byte[] baseData, final boolean addBOM) {
         byte[] data = baseData;
         if (addBOM) {
             data = new byte[baseData.length + 3];
@@ -159,22 +159,22 @@ public class BOMInputStreamTest {
     //  Test cases
     //----------------------------------------------------------------------------
 
-    private void parseXml(InputStream in) throws SAXException, IOException, ParserConfigurationException {
+    private void parseXml(final InputStream in) throws SAXException, IOException, ParserConfigurationException {
         final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(in));
         assertNotNull(doc);
         assertEquals("X", doc.getFirstChild().getNodeName());
     }
 
-    private void parseXml(Reader in) throws SAXException, IOException, ParserConfigurationException {
+    private void parseXml(final Reader in) throws SAXException, IOException, ParserConfigurationException {
         final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(in));
         assertNotNull(doc);
         assertEquals("X", doc.getFirstChild().getNodeName());
     }
 
-    private void readBOMInputStreamTwice(String resource) throws Exception {
-        InputStream inputStream = this.getClass().getResourceAsStream(resource);
+    private void readBOMInputStreamTwice(final String resource) throws Exception {
+        final InputStream inputStream = this.getClass().getResourceAsStream(resource);
         Assert.assertNotNull(inputStream);
-        BOMInputStream bomInputStream = new BOMInputStream(inputStream);
+        final BOMInputStream bomInputStream = new BOMInputStream(inputStream);
         bomInputStream.mark(1000000);
 
         this.readFile(bomInputStream);
@@ -182,9 +182,9 @@ public class BOMInputStreamTest {
         this.readFile(bomInputStream);
     }
 
-    private void readFile(BOMInputStream bomInputStream) throws Exception {
+    private void readFile(final BOMInputStream bomInputStream) throws Exception {
         int bytes = 0;
-        byte[] bytesFromStream = new byte[100];
+        final byte[] bytesFromStream = new byte[100];
         do {
             bytes = bomInputStream.read(bytesFromStream);
         } while (bytes > 0);
@@ -192,23 +192,23 @@ public class BOMInputStreamTest {
 
     @Test
     public void testAvailableWithBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
+        final byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
         assertEquals(7, in.available());
     }
 
     @Test
     public void testAvailableWithoutBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
         assertEquals(4, in.available());
     }
 
     @Test
     // this is here for coverage
     public void testClose() throws Exception {
-        ExpectCloseInputStream del = new ExpectCloseInputStream();
-        InputStream in = new BOMInputStream(del);
+        final ExpectCloseInputStream del = new ExpectCloseInputStream();
+        final InputStream in = new BOMInputStream(del);
 
         in.close();
         del.assertCloseCalled();
@@ -216,24 +216,24 @@ public class BOMInputStreamTest {
 
     @Test
     public void testEmptyBufferWithBOM() throws Exception {
-        byte[] data = new byte[] {};
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
-        byte[] buf = new byte[1024];
+        final byte[] data = new byte[] {};
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
+        final byte[] buf = new byte[1024];
         assertEquals(-1, in.read(buf));
     }
 
     @Test
     public void testEmptyBufferWithoutBOM() throws Exception {
-        byte[] data = new byte[] {};
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
-        byte[] buf = new byte[1024];
+        final byte[] data = new byte[] {};
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] buf = new byte[1024];
         assertEquals(-1, in.read(buf));
     }
 
     @Test
     public void testGetBOMFirstThenRead() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C' };
-        BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, true));
+        final byte[] data = new byte[] { 'A', 'B', 'C' };
+        final BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, true));
         assertEquals("getBOM", ByteOrderMark.UTF_8, in.getBOM());
         assertTrue("hasBOM()", in.hasBOM());
         assertTrue("hasBOM(UTF-8)", in.hasBOM(ByteOrderMark.UTF_8));
@@ -245,8 +245,8 @@ public class BOMInputStreamTest {
 
     @Test
     public void testGetBOMFirstThenReadInclude() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C' };
-        BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, true), true);
+        final byte[] data = new byte[] { 'A', 'B', 'C' };
+        final BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, true), true);
         assertTrue("hasBOM()", in.hasBOM());
         assertTrue("hasBOM(UTF-8)", in.hasBOM(ByteOrderMark.UTF_8));
         assertEquals("getBOM", ByteOrderMark.UTF_8, in.getBOM());
@@ -261,32 +261,32 @@ public class BOMInputStreamTest {
 
     @Test
     public void testLargeBufferWithBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
-        byte[] buf = new byte[1024];
+        final byte[] data = new byte[] { 'A', 'B', 'C' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
+        final byte[] buf = new byte[1024];
         assertData(data, buf, in.read(buf));
     }
 
     @Test
     public void testLargeBufferWithoutBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
-        byte[] buf = new byte[1024];
+        final byte[] data = new byte[] { 'A', 'B', 'C' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] buf = new byte[1024];
         assertData(data, buf, in.read(buf));
     }
 
     @Test
     public void testLeadingNonBOMBufferedRead() throws Exception {
-        byte[] data = new byte[] { (byte) 0xEF, (byte) 0xAB, (byte) 0xCD };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
-        byte[] buf = new byte[1024];
+        final byte[] data = new byte[] { (byte) 0xEF, (byte) 0xAB, (byte) 0xCD };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] buf = new byte[1024];
         assertData(data, buf, in.read(buf));
     }
 
     @Test
     public void testLeadingNonBOMSingleRead() throws Exception {
-        byte[] data = new byte[] { (byte) 0xEF, (byte) 0xAB, (byte) 0xCD };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] data = new byte[] { (byte) 0xEF, (byte) 0xAB, (byte) 0xCD };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
         assertEquals(0xEF, in.read());
         assertEquals(0xAB, in.read());
         assertEquals(0xCD, in.read());
@@ -295,8 +295,8 @@ public class BOMInputStreamTest {
 
     @Test
     public void testMarkResetAfterReadWithBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
+        final byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
         assertTrue(in.markSupported());
 
         in.read();
@@ -310,8 +310,8 @@ public class BOMInputStreamTest {
 
     @Test
     public void testMarkResetAfterReadWithoutBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
         assertTrue(in.markSupported());
 
         in.read();
@@ -325,8 +325,8 @@ public class BOMInputStreamTest {
 
     @Test
     public void testMarkResetBeforeReadWithBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
+        final byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
         assertTrue(in.markSupported());
 
         in.mark(10);
@@ -339,8 +339,8 @@ public class BOMInputStreamTest {
 
     @Test
     public void testMarkResetBeforeReadWithoutBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
         assertTrue(in.markSupported());
 
         in.mark(10);
@@ -353,25 +353,25 @@ public class BOMInputStreamTest {
 
     @Test
     public void testNoBoms() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C' };
+        final byte[] data = new byte[] { 'A', 'B', 'C' };
         try {
             new BOMInputStream(createUtf8DataStream(data, true), false, (ByteOrderMark[])null);
             fail("Null BOMs, expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected
         }
         try {
             new BOMInputStream(createUtf8DataStream(data, true), false, new ByteOrderMark[0]);
             fail("Null BOMs, expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected
         }
     }
 
     @Test
     public void testReadEmpty() throws Exception {
-        byte[] data = new byte[] {};
-        BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] data = new byte[] {};
+        final BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, false));
         assertEquals(-1, in.read());
         assertFalse("hasBOM()", in.hasBOM());
         assertFalse("hasBOM(UTF-8)", in.hasBOM(ByteOrderMark.UTF_8));
@@ -380,8 +380,8 @@ public class BOMInputStreamTest {
 
     @Test
     public void testReadSmall() throws Exception {
-        byte[] data = new byte[] { 'A', 'B' };
-        BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] data = new byte[] { 'A', 'B' };
+        final BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, false));
         assertEquals('A', in.read());
         assertEquals('B', in.read());
         assertEquals(-1, in.read());
@@ -402,8 +402,8 @@ public class BOMInputStreamTest {
 
     @Test
     public void testReadWithBOMInclude() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C' };
-        BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, true), true);
+        final byte[] data = new byte[] { 'A', 'B', 'C' };
+        final BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, true), true);
         assertEquals(0xEF, in.read());
         assertEquals(0xBB, in.read());
         assertEquals(0xBF, in.read());
@@ -418,8 +418,8 @@ public class BOMInputStreamTest {
 
     @Test
     public void testReadWithBOMUtf16Be() throws Exception {
-        byte[] data = "ABC".getBytes(Charsets.UTF_16BE);
-        BOMInputStream in = new BOMInputStream(createUtf16BeDataStream(data, true), ByteOrderMark.UTF_16BE);
+        final byte[] data = "ABC".getBytes(Charsets.UTF_16BE);
+        final BOMInputStream in = new BOMInputStream(createUtf16BeDataStream(data, true), ByteOrderMark.UTF_16BE);
         assertEquals(0, in.read());
         assertEquals('A', in.read());
         assertEquals(0, in.read());
@@ -433,15 +433,15 @@ public class BOMInputStreamTest {
         try {
             in.hasBOM(ByteOrderMark.UTF_16LE);
             fail("Expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected - not configured for UTF-16LE
         }
     }
 
     @Test
     public void testReadWithBOMUtf16Le() throws Exception {
-        byte[] data = "ABC".getBytes(Charsets.UTF_16LE);
-        BOMInputStream in = new BOMInputStream(createUtf16LeDataStream(data, true), ByteOrderMark.UTF_16LE);
+        final byte[] data = "ABC".getBytes(Charsets.UTF_16LE);
+        final BOMInputStream in = new BOMInputStream(createUtf16LeDataStream(data, true), ByteOrderMark.UTF_16LE);
         assertEquals('A', in.read());
         assertEquals(0, in.read());
         assertEquals('B', in.read());
@@ -455,7 +455,7 @@ public class BOMInputStreamTest {
         try {
             in.hasBOM(ByteOrderMark.UTF_16BE);
             fail("Expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected - not configured for UTF-16BE
         }
     }
@@ -463,8 +463,8 @@ public class BOMInputStreamTest {
     @Test
     public void testReadWithBOMUtf32Be() throws Exception {
         Assume.assumeTrue(Charset.isSupported("UTF_32BE"));
-        byte[] data = "ABC".getBytes("UTF_32BE");
-        BOMInputStream in = new BOMInputStream(createUtf32BeDataStream(data, true), ByteOrderMark.UTF_32BE);
+        final byte[] data = "ABC".getBytes("UTF_32BE");
+        final BOMInputStream in = new BOMInputStream(createUtf32BeDataStream(data, true), ByteOrderMark.UTF_32BE);
         assertEquals(0, in.read());
         assertEquals(0, in.read());
         assertEquals(0, in.read());
@@ -484,7 +484,7 @@ public class BOMInputStreamTest {
         try {
             in.hasBOM(ByteOrderMark.UTF_32LE);
             fail("Expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected - not configured for UTF-32LE
         }
     }
@@ -492,8 +492,8 @@ public class BOMInputStreamTest {
     @Test
     public void testReadWithBOMUtf32Le() throws Exception {
         Assume.assumeTrue(Charset.isSupported("UTF_32LE"));
-        byte[] data = "ABC".getBytes("UTF_32LE");
-        BOMInputStream in = new BOMInputStream(createUtf32LeDataStream(data, true), ByteOrderMark.UTF_32LE);
+        final byte[] data = "ABC".getBytes("UTF_32LE");
+        final BOMInputStream in = new BOMInputStream(createUtf32LeDataStream(data, true), ByteOrderMark.UTF_32LE);
         assertEquals('A', in.read());
         assertEquals(0, in.read());
         assertEquals(0, in.read());
@@ -513,15 +513,15 @@ public class BOMInputStreamTest {
         try {
             in.hasBOM(ByteOrderMark.UTF_32BE);
             fail("Expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected - not configured for UTF-32BE
         }
     }
 
     @Test
     public void testReadWithBOMUtf8() throws Exception {
-        byte[] data = "ABC".getBytes(Charsets.UTF_8);
-        BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, true), ByteOrderMark.UTF_8);
+        final byte[] data = "ABC".getBytes(Charsets.UTF_8);
+        final BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, true), ByteOrderMark.UTF_8);
         assertEquals('A', in.read());
         assertEquals('B', in.read());
         assertEquals('C', in.read());
@@ -532,15 +532,15 @@ public class BOMInputStreamTest {
         try {
             in.hasBOM(ByteOrderMark.UTF_16BE);
             fail("Expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected - not configured for UTF-16BE
         }
     }
 
     @Test
     public void testReadWithMultipleBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C' };
-        BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, true), 
+        final byte[] data = new byte[] { 'A', 'B', 'C' };
+        final BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, true), 
                                             ByteOrderMark.UTF_16BE, ByteOrderMark.UTF_8);
         assertEquals('A', in.read());
         assertEquals('B', in.read());
@@ -554,8 +554,8 @@ public class BOMInputStreamTest {
 
     @Test
     public void testReadWithoutBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C' };
-        BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] data = new byte[] { 'A', 'B', 'C' };
+        final BOMInputStream in = new BOMInputStream(createUtf8DataStream(data, false));
         assertEquals('A', in.read());
         assertEquals('B', in.read());
         assertEquals('C', in.read());
@@ -569,7 +569,7 @@ public class BOMInputStreamTest {
     public void testReadXmlWithBOMUcs2() throws Exception {
         // UCS-2 is BE.
         Assume.assumeTrue(Charset.isSupported("ISO-10646-UCS-2"));
-        byte[] data = "<?xml version=\"1.0\" encoding=\"ISO-10646-UCS-2\"?><X/>".getBytes("ISO-10646-UCS-2");
+        final byte[] data = "<?xml version=\"1.0\" encoding=\"ISO-10646-UCS-2\"?><X/>".getBytes("ISO-10646-UCS-2");
         parseXml(new BOMInputStream(createUtf16BeDataStream(data, true), ByteOrderMark.UTF_16BE));
         parseXml(createUtf16BeDataStream(data, true));
     }
@@ -579,7 +579,7 @@ public class BOMInputStreamTest {
         // UCS-4 is BE or LE?
         // Hm: ISO-10646-UCS-4 is not supported on Oracle 1.6.0_31
         Assume.assumeTrue(Charset.isSupported("ISO-10646-UCS-4"));
-        byte[] data = "<?xml version=\"1.0\" encoding=\"ISO-10646-UCS-4\"?><X/>".getBytes("ISO-10646-UCS-4");
+        final byte[] data = "<?xml version=\"1.0\" encoding=\"ISO-10646-UCS-4\"?><X/>".getBytes("ISO-10646-UCS-4");
         // XML parser does not know what to do with UTF-32
         parseXml(new BOMInputStream(createUtf32BeDataStream(data, true), ByteOrderMark.UTF_32BE));
         // XML parser does not know what to do with UTF-32
@@ -588,14 +588,14 @@ public class BOMInputStreamTest {
 
     @Test
     public void testReadXmlWithBOMUtf16Be() throws Exception {
-        byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-16BE\"?><X/>".getBytes(Charsets.UTF_16BE);
+        final byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-16BE\"?><X/>".getBytes(Charsets.UTF_16BE);
         parseXml(new BOMInputStream(createUtf16BeDataStream(data, true), ByteOrderMark.UTF_16BE));
         parseXml(createUtf16BeDataStream(data, true));
     }
 
     @Test
     public void testReadXmlWithBOMUtf16Le() throws Exception {
-        byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-16LE\"?><X/>".getBytes(Charsets.UTF_16LE);
+        final byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-16LE\"?><X/>".getBytes(Charsets.UTF_16LE);
         parseXml(new BOMInputStream(createUtf16LeDataStream(data, true), ByteOrderMark.UTF_16LE));
         parseXml(createUtf16LeDataStream(data, true));
     }
@@ -603,7 +603,7 @@ public class BOMInputStreamTest {
     @Test
     public void testReadXmlWithBOMUtf32Be() throws Exception {
         Assume.assumeTrue(Charset.isSupported("UTF_32BE"));
-        byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-32BE\"?><X/>".getBytes("UTF_32BE");
+        final byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-32BE\"?><X/>".getBytes("UTF_32BE");
         parseXml(new BOMInputStream(createUtf32BeDataStream(data, true), ByteOrderMark.UTF_32BE));
         // XML parser does not know what to do with UTF-32, so we warp the input stream with a XmlStreamReader
         parseXml(new XmlStreamReader(createUtf32BeDataStream(data, true)));
@@ -612,7 +612,7 @@ public class BOMInputStreamTest {
     @Test
     public void testReadXmlWithBOMUtf32Le() throws Exception {
         Assume.assumeTrue(Charset.isSupported("UTF_32LE"));
-        byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-32LE\"?><X/>".getBytes("UTF_32LE");
+        final byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-32LE\"?><X/>".getBytes("UTF_32LE");
         parseXml(new BOMInputStream(createUtf32LeDataStream(data, true), ByteOrderMark.UTF_32LE));
         // XML parser does not know what to do with UTF-32, so we warp the input stream with a XmlStreamReader
         parseXml(new XmlStreamReader(createUtf32LeDataStream(data, true)));
@@ -620,7 +620,7 @@ public class BOMInputStreamTest {
 
     @Test
     public void testReadXmlWithBOMUtf8() throws Exception {
-        byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><X/>".getBytes(Charsets.UTF_8);
+        final byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><X/>".getBytes(Charsets.UTF_8);
         parseXml(new BOMInputStream(createUtf8DataStream(data, true)));
         parseXml(createUtf8DataStream(data, true));
     }
@@ -628,7 +628,7 @@ public class BOMInputStreamTest {
     @Test
     public void testReadXmlWithoutBOMUtf32Be() throws Exception {
         Assume.assumeTrue(Charset.isSupported("UTF_32BE"));
-        byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-32BE\"?><X/>".getBytes("UTF_32BE");
+        final byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-32BE\"?><X/>".getBytes("UTF_32BE");
         parseXml(new BOMInputStream(createUtf32BeDataStream(data, false)));
         parseXml(createUtf32BeDataStream(data, false));
     }
@@ -636,41 +636,41 @@ public class BOMInputStreamTest {
     @Test
     public void testReadXmlWithoutBOMUtf32Le() throws Exception {
         Assume.assumeTrue(Charset.isSupported("UTF_32LE"));
-        byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-32LE\"?><X/>".getBytes("UTF_32LE");
+        final byte[] data = "<?xml version=\"1.0\" encoding=\"UTF-32LE\"?><X/>".getBytes("UTF_32LE");
         parseXml(new BOMInputStream(createUtf32LeDataStream(data, false)));
         parseXml(createUtf32BeDataStream(data, false));
     }
 
     @Test
     public void testSkipWithBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
+        final byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
         in.skip(2L);
         assertEquals('C', in.read());
     }
 
     @Test
     public void testSkipWithoutBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
         in.skip(2L);
         assertEquals('C', in.read());
     }
 
     @Test
     public void testSmallBufferWithBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
-        byte[] buf = new byte[1024];
+        final byte[] data = new byte[] { 'A', 'B', 'C' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, true));
+        final byte[] buf = new byte[1024];
         assertData(new byte[] { 'A', 'B' }, buf, in.read(buf, 0, 2));
         assertData(new byte[] { 'C' }, buf, in.read(buf, 0, 2));
     }
 
     @Test
     public void testSmallBufferWithoutBOM() throws Exception {
-        byte[] data = new byte[] { 'A', 'B', 'C' };
-        InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
-        byte[] buf = new byte[1024];
+        final byte[] data = new byte[] { 'A', 'B', 'C' };
+        final InputStream in = new BOMInputStream(createUtf8DataStream(data, false));
+        final byte[] buf = new byte[1024];
         assertData(new byte[] { 'A', 'B' }, buf, in.read(buf, 0, 2));
         assertData(new byte[] { 'C' }, buf, in.read(buf, 0, 2));
     }
@@ -678,9 +678,9 @@ public class BOMInputStreamTest {
     @Test
     // make sure that our support code works as expected
     public void testSupportCode() throws Exception {
-        InputStream in = createUtf8DataStream(new byte[] { 'A', 'B' }, true);
-        byte[] buf = new byte[1024];
-        int len = in.read(buf);
+        final InputStream in = createUtf8DataStream(new byte[] { 'A', 'B' }, true);
+        final byte[] buf = new byte[1024];
+        final int len = in.read(buf);
         assertEquals(5, len);
         assertEquals(0xEF, buf[0] & 0xFF);
         assertEquals(0xBB, buf[1] & 0xFF);

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java Fri Nov 30 20:51:39 2012
@@ -29,7 +29,7 @@ import org.apache.commons.io.IOUtils;
  */
 public class BoundedInputStreamTest extends TestCase {
 
-    public BoundedInputStreamTest(String name) {
+    public BoundedInputStreamTest(final String name) {
         super(name);
     }
 
@@ -38,8 +38,8 @@ public class BoundedInputStreamTest exte
      */
     public void testReadSingle() throws Exception {
         BoundedInputStream bounded = null;
-        byte[] helloWorld = "Hello World".getBytes();
-        byte[] hello      = "Hello".getBytes();
+        final byte[] helloWorld = "Hello World".getBytes();
+        final byte[] hello      = "Hello".getBytes();
 
         // limit = length
         bounded = new BoundedInputStream(new ByteArrayInputStream(helloWorld), helloWorld.length);
@@ -69,8 +69,8 @@ public class BoundedInputStreamTest exte
     public void testReadArray() throws Exception {
 
         BoundedInputStream bounded = null;
-        byte[] helloWorld = "Hello World".getBytes();
-        byte[] hello      = "Hello".getBytes();
+        final byte[] helloWorld = "Hello World".getBytes();
+        final byte[] hello      = "Hello".getBytes();
 
         bounded = new BoundedInputStream(new ByteArrayInputStream(helloWorld));
         compare("limit = -1", helloWorld, IOUtils.toByteArray(bounded));
@@ -91,7 +91,7 @@ public class BoundedInputStreamTest exte
     /**
      * Compare byte arrays.
      */
-    private void compare(String msg, byte[] expected, byte[] actual) {
+    private void compare(final String msg, final byte[] expected, final byte[] actual) {
         assertEquals(msg + " length", expected.length, actual.length);
         for (int i = 0; i < expected.length; i++) {
             assertEquals(msg + " byte[" + i + "]", expected[i], actual[i]);

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BrokenInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BrokenInputStreamTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BrokenInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BrokenInputStreamTest.java Fri Nov 30 20:51:39 2012
@@ -40,21 +40,21 @@ public class BrokenInputStreamTest exten
         try {
             stream.read();
             fail("Expected exception not thrown.");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals(exception, e);
         }
 
         try {
             stream.read(new byte[1]);
             fail("Expected exception not thrown.");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals(exception, e);
         }
 
         try {
             stream.read(new byte[1], 0, 1);
             fail("Expected exception not thrown.");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals(exception, e);
         }
     }
@@ -63,7 +63,7 @@ public class BrokenInputStreamTest exten
         try {
             stream.available();
             fail("Expected exception not thrown.");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals(exception, e);
         }
     }
@@ -72,7 +72,7 @@ public class BrokenInputStreamTest exten
         try {
             stream.skip(1);
             fail("Expected exception not thrown.");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals(exception, e);
         }
     }
@@ -81,7 +81,7 @@ public class BrokenInputStreamTest exten
         try {
             stream.reset();
             fail("Expected exception not thrown.");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals(exception, e);
         }
     }
@@ -90,7 +90,7 @@ public class BrokenInputStreamTest exten
         try {
             stream.close();
             fail("Expected exception not thrown.");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals(exception, e);
         }
     }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java Fri Nov 30 20:51:39 2012
@@ -39,28 +39,28 @@ public class CharSequenceInputStreamTest
     private static final String TEST_STRING = "\u00e0 peine arriv\u00e9s nous entr\u00e2mes dans sa chambre";
 
     static {
-        StringBuilder buffer = new StringBuilder();
+        final StringBuilder buffer = new StringBuilder();
         for (int i = 0; i < 100; i++) {
             buffer.append(TEST_STRING);
         }
         LARGE_TEST_STRING = buffer.toString();
     }
 
-    private Random random = new Random();
+    private final Random random = new Random();
 
     private Set<String> getRequiredCharsetNames() {
         return Charsets.requiredCharsets().keySet();
     }
 
-    private void testBufferedRead(String testString, String charsetName) throws IOException {
-        byte[] expected = testString.getBytes(charsetName);
-        InputStream in = new CharSequenceInputStream(testString, charsetName, 512);
+    private void testBufferedRead(final String testString, final String charsetName) throws IOException {
+        final byte[] expected = testString.getBytes(charsetName);
+        final InputStream in = new CharSequenceInputStream(testString, charsetName, 512);
         try {
-            byte[] buffer = new byte[128];
+            final byte[] buffer = new byte[128];
             int offset = 0;
             while (true) {
                 int bufferOffset = random.nextInt(64);
-                int bufferLength = random.nextInt(64);
+                final int bufferLength = random.nextInt(64);
                 int read = in.read(buffer, bufferOffset, bufferLength);
                 if (read == -1) {
                     assertEquals("EOF: offset should equal length", expected.length, offset);
@@ -89,14 +89,14 @@ public class CharSequenceInputStreamTest
     @Test
     @Ignore
     public void testBufferedRead_AvailableCharset() throws IOException {
-        for (String csName : Charset.availableCharsets().keySet()) {
+        for (final String csName : Charset.availableCharsets().keySet()) {
             testBufferedRead(TEST_STRING, csName);
         }
     }
 
     @Test
     public void testBufferedRead_RequiredCharset() throws IOException {
-        for (String csName : getRequiredCharsetNames()) {
+        for (final String csName : getRequiredCharsetNames()) {
             testBufferedRead(TEST_STRING, csName);
         }
     }
@@ -106,11 +106,11 @@ public class CharSequenceInputStreamTest
         testBufferedRead(TEST_STRING, "UTF-8");
     }
 
-    private void testCharsetMismatchInfiniteLoop(String csName) throws IOException {
+    private void testCharsetMismatchInfiniteLoop(final String csName) throws IOException {
         // Input is UTF-8 bytes: 0xE0 0xB2 0xA0
-        char[] inputChars = new char[] { (char) 0xE0, (char) 0xB2, (char) 0xA0 };
-        Charset charset = Charset.forName(csName); // infinite loop for US-ASCII, UTF-8 OK
-        InputStream stream = new CharSequenceInputStream(new String(inputChars), charset, 512);
+        final char[] inputChars = new char[] { (char) 0xE0, (char) 0xB2, (char) 0xA0 };
+        final Charset charset = Charset.forName(csName); // infinite loop for US-ASCII, UTF-8 OK
+        final InputStream stream = new CharSequenceInputStream(new String(inputChars), charset, 512);
         try {
             while (stream.read() != -1) {
             }
@@ -121,28 +121,28 @@ public class CharSequenceInputStreamTest
 
     @Test
     public void testCharsetMismatchInfiniteLoop_RequiredCharsets() throws IOException {
-        for (String csName : getRequiredCharsetNames()) {
+        for (final String csName : getRequiredCharsetNames()) {
             testCharsetMismatchInfiniteLoop(csName);
         }
     }
 
-    private void testIO_356(int bufferSize, int dataSize, int readFirst, String csName) throws Exception {
-        CharSequenceInputStream is = new CharSequenceInputStream(ALPHABET, csName, bufferSize);
+    private void testIO_356(final int bufferSize, final int dataSize, final int readFirst, final String csName) throws Exception {
+        final CharSequenceInputStream is = new CharSequenceInputStream(ALPHABET, csName, bufferSize);
 
         for (int i = 0; i < readFirst; i++) {
-            int ch = is.read();
+            final int ch = is.read();
             assertFalse(ch == -1);
         }
 
         is.mark(dataSize);
 
-        byte[] data1 = new byte[dataSize];
+        final byte[] data1 = new byte[dataSize];
         final int readCount1 = is.read(data1);
         assertEquals(dataSize, readCount1);
 
         is.reset(); // should allow data to be re-read
 
-        byte[] data2 = new byte[dataSize];
+        final byte[] data2 = new byte[dataSize];
         final int readCount2 = is.read(data2);
         assertEquals(dataSize, readCount2);
 
@@ -193,7 +193,7 @@ public class CharSequenceInputStreamTest
         testIO_356(10, 20, 0, "UTF-8");
     }
 
-    private void testIO_356_Loop(String csName) throws Exception {
+    private void testIO_356_Loop(final String csName) throws Exception {
         for (int bufferSize = 1; bufferSize <= 10; bufferSize++) {
             for (int dataSize = 1; dataSize <= 20; dataSize++) {
                 testIO_356(bufferSize, dataSize, 0, csName);
@@ -216,7 +216,7 @@ public class CharSequenceInputStreamTest
 
     @Test
     public void testLargeBufferedRead_RequiredCharsets() throws IOException {
-        for (String csName : getRequiredCharsetNames()) {
+        for (final String csName : getRequiredCharsetNames()) {
             testBufferedRead(LARGE_TEST_STRING, csName);
         }
     }
@@ -228,7 +228,7 @@ public class CharSequenceInputStreamTest
 
     @Test
     public void testLargeSingleByteRead_RequiredCharsets() throws IOException {
-        for (String csName : getRequiredCharsetNames()) {
+        for (final String csName : getRequiredCharsetNames()) {
             testSingleByteRead(LARGE_TEST_STRING, csName);
         }
     }
@@ -238,8 +238,8 @@ public class CharSequenceInputStreamTest
         testSingleByteRead(LARGE_TEST_STRING, "UTF-8");
     }
 
-    private void testMarkReset(String csName) throws Exception {
-        InputStream r = new CharSequenceInputStream("test", csName);
+    private void testMarkReset(final String csName) throws Exception {
+        final InputStream r = new CharSequenceInputStream("test", csName);
         try {
             r.skip(2);
             r.mark(0);
@@ -260,7 +260,7 @@ public class CharSequenceInputStreamTest
     @Test
     @Ignore
     public void testMarkReset_RequiredCharsets() throws Exception {
-        for (String csName : getRequiredCharsetNames()) {
+        for (final String csName : getRequiredCharsetNames()) {
             testMarkReset(csName);
         }
     }
@@ -277,7 +277,7 @@ public class CharSequenceInputStreamTest
 
     @Test
     public void testMarkSupported() throws Exception {
-        InputStream r = new CharSequenceInputStream("test", "UTF-8");
+        final InputStream r = new CharSequenceInputStream("test", "UTF-8");
         try {
             assertTrue(r.markSupported());
         } finally {
@@ -285,10 +285,10 @@ public class CharSequenceInputStreamTest
         }
     }
 
-    public void testReadZero(String csName) throws Exception {
-        InputStream r = new CharSequenceInputStream("test", csName);
+    public void testReadZero(final String csName) throws Exception {
+        final InputStream r = new CharSequenceInputStream("test", csName);
         try {
-            byte[] bytes = new byte[30];
+            final byte[] bytes = new byte[30];
             assertEquals(0, r.read(bytes, 0, 0));
         } finally {
             r.close();
@@ -297,9 +297,9 @@ public class CharSequenceInputStreamTest
 
     @Test
     public void testReadZero_EmptyString() throws Exception {
-        InputStream r = new CharSequenceInputStream("", "UTF-8");
+        final InputStream r = new CharSequenceInputStream("", "UTF-8");
         try {
-            byte[] bytes = new byte[30];
+            final byte[] bytes = new byte[30];
             assertEquals(0, r.read(bytes, 0, 0));
         } finally {
             r.close();
@@ -308,17 +308,17 @@ public class CharSequenceInputStreamTest
 
     @Test
     public void testReadZero_RequiredCharsets() throws Exception {
-        for (String csName : getRequiredCharsetNames()) {
+        for (final String csName : getRequiredCharsetNames()) {
             testReadZero(csName);
         }
     }
 
-    private void testSingleByteRead(String testString, String charsetName) throws IOException {
-        byte[] bytes = testString.getBytes(charsetName);
-        InputStream in = new CharSequenceInputStream(testString, charsetName, 512);
+    private void testSingleByteRead(final String testString, final String charsetName) throws IOException {
+        final byte[] bytes = testString.getBytes(charsetName);
+        final InputStream in = new CharSequenceInputStream(testString, charsetName, 512);
         try {
-            for (byte b : bytes) {
-                int read = in.read();
+            for (final byte b : bytes) {
+                final int read = in.read();
                 assertTrue("read " + read + " >=0 ", read >= 0);
                 assertTrue("read " + read + " <= 255", read <= 255);
                 assertEquals("Should agree with input", b, (byte) read);
@@ -331,7 +331,7 @@ public class CharSequenceInputStreamTest
 
     @Test
     public void testSingleByteRead_RequiredCharsets() throws IOException {
-        for (String csName : getRequiredCharsetNames()) {
+        for (final String csName : getRequiredCharsetNames()) {
             testSingleByteRead(TEST_STRING, csName);
         }
     }
@@ -346,8 +346,8 @@ public class CharSequenceInputStreamTest
         testSingleByteRead(TEST_STRING, "UTF-8");
     }
 
-    public void testSkip(String csName) throws Exception {
-        InputStream r = new CharSequenceInputStream("test", csName);
+    public void testSkip(final String csName) throws Exception {
+        final InputStream r = new CharSequenceInputStream("test", csName);
         try {
             r.skip(1);
             r.skip(2);
@@ -362,7 +362,7 @@ public class CharSequenceInputStreamTest
     @Test
     @Ignore
     public void testSkip_RequiredCharsets() throws Exception {
-        for (String csName : getRequiredCharsetNames()) {
+        for (final String csName : getRequiredCharsetNames()) {
             testSkip(csName);
         }
     }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceReaderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceReaderTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceReaderTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceReaderTest.java Fri Nov 30 20:51:39 2012
@@ -35,7 +35,7 @@ public class CharSequenceReaderTest {
     /** Test {@link Reader#close()}. */
     @Test
     public void testClose() throws IOException {
-        Reader reader = new CharSequenceReader("FooBar");
+        final Reader reader = new CharSequenceReader("FooBar");
         checkRead(reader, "Foo");
         reader.close();
         checkRead(reader, "Foo");
@@ -44,14 +44,14 @@ public class CharSequenceReaderTest {
     /** Test {@link Reader#markSupported()}. */
     @Test
     public void testMarkSupported() {
-        Reader reader = new CharSequenceReader("FooBar");
+        final Reader reader = new CharSequenceReader("FooBar");
         assertTrue(reader.markSupported());
     }
 
     /** Test {@link Reader#mark(int)}. */
     @Test
     public void testMark() throws IOException {
-        Reader reader = new CharSequenceReader("FooBar");
+        final Reader reader = new CharSequenceReader("FooBar");
         checkRead(reader, "Foo");
         reader.mark(0);
         checkRead(reader, "Bar");
@@ -66,7 +66,7 @@ public class CharSequenceReaderTest {
     /** Test {@link Reader#skip(long)}. */
     @Test
     public void testSkip() throws IOException {
-        Reader reader = new CharSequenceReader("FooBar");
+        final Reader reader = new CharSequenceReader("FooBar");
         assertEquals(3, reader.skip(3));
         checkRead(reader, "Bar");
         assertEquals(-1, reader.skip(3));
@@ -82,7 +82,7 @@ public class CharSequenceReaderTest {
     /** Test {@link Reader#read()}. */
     @Test
     public void testRead() throws IOException {
-        Reader reader = new CharSequenceReader("Foo");
+        final Reader reader = new CharSequenceReader("Foo");
         assertEquals('F', reader.read());
         assertEquals('o', reader.read());
         assertEquals('o', reader.read());
@@ -93,7 +93,7 @@ public class CharSequenceReaderTest {
     /** Test {@link Reader#read(char[])}. */
     @Test
     public void testReadCharArray() throws IOException {
-        Reader reader = new CharSequenceReader("FooBar");
+        final Reader reader = new CharSequenceReader("FooBar");
         char[] chars = new char[2];
         assertEquals(2, reader.read(chars));
         checkArray(new char[] {'F', 'o'}, chars);
@@ -109,8 +109,8 @@ public class CharSequenceReaderTest {
     /** Test {@link Reader#read(char[], int, int)}. */
     @Test
     public void testReadCharArrayPortion() throws IOException {
-        char[] chars = new char[10];
-        Reader reader = new CharSequenceReader("FooBar");
+        final char[] chars = new char[10];
+        final Reader reader = new CharSequenceReader("FooBar");
         assertEquals(3, reader.read(chars, 3, 3));
         checkArray(new char[] {NONE, NONE, NONE, 'F', 'o', 'o'}, chars);
         assertEquals(3, reader.read(chars, 0, 3));
@@ -118,13 +118,13 @@ public class CharSequenceReaderTest {
         assertEquals(-1, reader.read(chars));
     }
 
-    private void checkRead(Reader reader, String expected) throws IOException {
+    private void checkRead(final Reader reader, final String expected) throws IOException {
         for (int i = 0; i < expected.length(); i++) {
             assertEquals("Read[" + i + "] of '" + expected + "'", 
                     expected.charAt(i), (char)reader.read());
         }
     }
-    private void checkArray(char[] expected, char[] actual) {
+    private void checkArray(final char[] expected, final char[] actual) {
         for (int i = 0; i < expected.length; i++) {
             assertEquals("Compare[" +i + "]", expected[i], actual[i]);
         }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ClassLoaderObjectInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ClassLoaderObjectInputStreamTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ClassLoaderObjectInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ClassLoaderObjectInputStreamTest.java Fri Nov 30 20:51:39 2012
@@ -30,7 +30,7 @@ import junit.framework.TestCase;
  */
 public class ClassLoaderObjectInputStreamTest extends TestCase {
 
-    public ClassLoaderObjectInputStreamTest(String name) {
+    public ClassLoaderObjectInputStreamTest(final String name) {
         super(name);
     }
 
@@ -42,30 +42,30 @@ public class ClassLoaderObjectInputStrea
     
     public void testExpected() throws Exception {
 
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream oos = new ObjectOutputStream(baos);
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final ObjectOutputStream oos = new ObjectOutputStream(baos);
 
         oos.writeObject( Boolean.FALSE );
 
-        InputStream bais = new ByteArrayInputStream(baos.toByteArray());
-        ClassLoaderObjectInputStream clois = 
+        final InputStream bais = new ByteArrayInputStream(baos.toByteArray());
+        final ClassLoaderObjectInputStream clois = 
             new ClassLoaderObjectInputStream(getClass().getClassLoader(), bais);
-        Boolean result = (Boolean) clois.readObject();
+        final Boolean result = (Boolean) clois.readObject();
 
         assertTrue( !result.booleanValue() );
     }
 
     public void testResolveProxyClass() throws Exception {
 
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream oos = new ObjectOutputStream(baos);
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final ObjectOutputStream oos = new ObjectOutputStream(baos);
         oos.writeObject( Boolean.FALSE );
-        InputStream bais = new ByteArrayInputStream(baos.toByteArray());
+        final InputStream bais = new ByteArrayInputStream(baos.toByteArray());
 
-        ClassLoaderObjectInputStream clois = 
+        final ClassLoaderObjectInputStream clois = 
             new ClassLoaderObjectInputStream(getClass().getClassLoader(), bais);
-        String[] interfaces = new String[] { Comparable.class.getName() };
-        Class<?> result = clois.resolveProxyClass(interfaces);
+        final String[] interfaces = new String[] { Comparable.class.getName() };
+        final Class<?> result = clois.resolveProxyClass(interfaces);
         assertTrue("Assignable", Comparable.class.isAssignableFrom(result));
     }
     

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CountingInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CountingInputStreamTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CountingInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CountingInputStreamTest.java Fri Nov 30 20:51:39 2012
@@ -32,27 +32,27 @@ import org.apache.commons.io.output.Null
  */
 public class CountingInputStreamTest extends TestCase {
 
-    public CountingInputStreamTest(String name) {
+    public CountingInputStreamTest(final String name) {
         super(name);
     }
 
     public void testCounting() throws Exception {
-        String text = "A piece of text";
-        byte[] bytes = text.getBytes();
-        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-        CountingInputStream cis = new CountingInputStream(bais);
+        final String text = "A piece of text";
+        final byte[] bytes = text.getBytes();
+        final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+        final CountingInputStream cis = new CountingInputStream(bais);
 
         // have to declare this larger as we're going to read 
         // off the end of the stream and input stream seems 
         // to do bounds checking
-        byte[] result = new byte[21];
+        final byte[] result = new byte[21];
 
-        byte[] ba = new byte[5];
+        final byte[] ba = new byte[5];
         int found = cis.read(ba);
         System.arraycopy(ba, 0, result, 0, 5);
         assertEquals( found, cis.getCount() );
 
-        int value = cis.read();
+        final int value = cis.read();
         found++; 
         result[5] = (byte)value;
         assertEquals( found, cis.getCount() );
@@ -64,7 +64,7 @@ public class CountingInputStreamTest ext
         assertEquals( found, cis.getCount() );
 
         // trim to get rid of the 6 empty values
-        String textResult = new String(result).trim();
+        final String textResult = new String(result).trim();
         assertEquals(textResult, text);
     }
 
@@ -73,23 +73,23 @@ public class CountingInputStreamTest ext
      * Test for files > 2GB in size - see issue IO-84
      */
     public void testLargeFiles_IO84() throws Exception {
-        long size = (long)Integer.MAX_VALUE + (long)1;
-        NullInputStream mock    = new NullInputStream(size);
-        CountingInputStream cis = new CountingInputStream(mock);
-        OutputStream out        = new NullOutputStream();
+        final long size = (long)Integer.MAX_VALUE + (long)1;
+        final NullInputStream mock    = new NullInputStream(size);
+        final CountingInputStream cis = new CountingInputStream(mock);
+        final OutputStream out        = new NullOutputStream();
 
         // Test integer methods
         IOUtils.copyLarge(cis, out);
         try {
             cis.getCount();
             fail("Expected getCount() to throw an ArithmeticException");
-        } catch (ArithmeticException ae) {
+        } catch (final ArithmeticException ae) {
             // expected result
         }
         try {
             cis.resetCount();
             fail("Expected resetCount() to throw an ArithmeticException");
-        } catch (ArithmeticException ae) {
+        } catch (final ArithmeticException ae) {
             // expected result
         }
 
@@ -102,55 +102,55 @@ public class CountingInputStreamTest ext
     }
 
     public void testResetting() throws Exception {
-        String text = "A piece of text";
-        byte[] bytes = text.getBytes();
-        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-        CountingInputStream cis = new CountingInputStream(bais);
+        final String text = "A piece of text";
+        final byte[] bytes = text.getBytes();
+        final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+        final CountingInputStream cis = new CountingInputStream(bais);
 
-        byte[] result = new byte[bytes.length];
+        final byte[] result = new byte[bytes.length];
 
         int found = cis.read(result, 0, 5);
         assertEquals( found, cis.getCount() );
 
-        int count = cis.resetCount();
+        final int count = cis.resetCount();
         found = cis.read(result, 6, 5);
         assertEquals( found, count );
     }
     
     public void testZeroLength1() throws Exception {
-        ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
-        CountingInputStream cis = new CountingInputStream(bais);
+        final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
+        final CountingInputStream cis = new CountingInputStream(bais);
 
-        int found = cis.read();
+        final int found = cis.read();
         assertEquals(-1, found);
         assertEquals(0, cis.getCount());
     }
 
     public void testZeroLength2() throws Exception {
-        ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
-        CountingInputStream cis = new CountingInputStream(bais);
+        final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
+        final CountingInputStream cis = new CountingInputStream(bais);
 
-        byte[] result = new byte[10];
+        final byte[] result = new byte[10];
 
-        int found = cis.read(result);
+        final int found = cis.read(result);
         assertEquals(-1, found);
         assertEquals(0, cis.getCount());
     }
 
     public void testZeroLength3() throws Exception {
-        ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
-        CountingInputStream cis = new CountingInputStream(bais);
+        final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
+        final CountingInputStream cis = new CountingInputStream(bais);
 
-        byte[] result = new byte[10];
+        final byte[] result = new byte[10];
 
-        int found = cis.read(result, 0, 5);
+        final int found = cis.read(result, 0, 5);
         assertEquals(-1, found);
         assertEquals(0, cis.getCount());
     }
 
     public void testEOF1() throws Exception {
-        ByteArrayInputStream bais = new ByteArrayInputStream(new byte[2]);
-        CountingInputStream cis = new CountingInputStream(bais);
+        final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[2]);
+        final CountingInputStream cis = new CountingInputStream(bais);
 
         int found = cis.read();
         assertEquals(0, found);
@@ -164,32 +164,32 @@ public class CountingInputStreamTest ext
     }
 
     public void testEOF2() throws Exception {
-        ByteArrayInputStream bais = new ByteArrayInputStream(new byte[2]);
-        CountingInputStream cis = new CountingInputStream(bais);
+        final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[2]);
+        final CountingInputStream cis = new CountingInputStream(bais);
 
-        byte[] result = new byte[10];
+        final byte[] result = new byte[10];
 
-        int found = cis.read(result);
+        final int found = cis.read(result);
         assertEquals(2, found);
         assertEquals(2, cis.getCount());
     }
 
     public void testEOF3() throws Exception {
-        ByteArrayInputStream bais = new ByteArrayInputStream(new byte[2]);
-        CountingInputStream cis = new CountingInputStream(bais);
+        final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[2]);
+        final CountingInputStream cis = new CountingInputStream(bais);
 
-        byte[] result = new byte[10];
+        final byte[] result = new byte[10];
 
-        int found = cis.read(result, 0, 5);
+        final int found = cis.read(result, 0, 5);
         assertEquals(2, found);
         assertEquals(2, cis.getCount());
     }
     
     public void testSkipping() throws IOException {
-        String text = "Hello World!";
-        byte[] bytes = text.getBytes();
-        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-        CountingInputStream cis = new CountingInputStream(bais);
+        final String text = "Hello World!";
+        final byte[] bytes = text.getBytes();
+        final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+        final CountingInputStream cis = new CountingInputStream(bais);
         
         assertEquals(6,cis.skip(6));
         assertEquals(6,cis.getCount());

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullInputStreamTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullInputStreamTest.java Fri Nov 30 20:51:39 2012
@@ -30,7 +30,7 @@ import junit.framework.TestCase;
 public class NullInputStreamTest extends TestCase {
 
     /** Constructor */
-    public NullInputStreamTest(String name) {
+    public NullInputStreamTest(final String name) {
         super(name);
     }
 
@@ -50,8 +50,8 @@ public class NullInputStreamTest extends
      * Test <code>available()</code> method.
      */
     public void testRead() throws Exception {
-        int size = 5;
-        InputStream input = new TestNullInputStream(size);
+        final int size = 5;
+        final InputStream input = new TestNullInputStream(size);
         for (int i = 0; i < size; i++) {
             assertEquals("Check Size [" + i + "]", size - i, input.available());
             assertEquals("Check Value [" + i + "]", i, input.read());
@@ -64,9 +64,9 @@ public class NullInputStreamTest extends
 
         // Test reading after the end of file
         try {
-            int result = input.read();
+            final int result = input.read();
             fail("Should have thrown an IOException, byte=[" + result + "]");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals("Read after end of file", e.getMessage());
         }
 
@@ -79,32 +79,32 @@ public class NullInputStreamTest extends
      * Test <code>read(byte[])</code> method.
      */
     public void testReadByteArray() throws Exception {
-        byte[] bytes = new byte[10];
-        InputStream input = new TestNullInputStream(15);
+        final byte[] bytes = new byte[10];
+        final InputStream input = new TestNullInputStream(15);
 
         // Read into array
-        int count1 = input.read(bytes);
+        final int count1 = input.read(bytes);
         assertEquals("Read 1", bytes.length, count1);
         for (int i = 0; i < count1; i++) {
             assertEquals("Check Bytes 1", i, bytes[i]);
         }
 
         // Read into array
-        int count2 = input.read(bytes);
+        final int count2 = input.read(bytes);
         assertEquals("Read 2", 5, count2);
         for (int i = 0; i < count2; i++) {
             assertEquals("Check Bytes 2", count1 + i, bytes[i]);
         }
 
         // End of File
-        int count3 = input.read(bytes);
+        final int count3 = input.read(bytes);
         assertEquals("Read 3 (EOF)", -1, count3);
 
         // Test reading after the end of file
         try {
-            int count4 = input.read(bytes);
+            final int count4 = input.read(bytes);
             fail("Should have thrown an IOException, byte=[" + count4 + "]");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals("Read after end of file", e.getMessage());
         }
 
@@ -112,9 +112,9 @@ public class NullInputStreamTest extends
         input.close();
     
         // Read into array using offset & length
-        int offset = 2;
-        int lth    = 4;
-        int count5 = input.read(bytes, offset, lth);
+        final int offset = 2;
+        final int lth    = 4;
+        final int count5 = input.read(bytes, offset, lth);
         assertEquals("Read 5", lth, count5);
         for (int i = offset; i < lth; i++) {
             assertEquals("Check Bytes 2", i, bytes[i]);
@@ -126,13 +126,13 @@ public class NullInputStreamTest extends
      * (rather than return -1).
      */
     public void testEOFException() throws Exception {
-        InputStream input = new TestNullInputStream(2, false, true);
+        final InputStream input = new TestNullInputStream(2, false, true);
         assertEquals("Read 1",  0, input.read());
         assertEquals("Read 2",  1, input.read());
         try {
-            int result = input.read();
+            final int result = input.read();
             fail("Should have thrown an EOFException, byte=[" + result + "]");
-        } catch (EOFException e) {
+        } catch (final EOFException e) {
             // expected
         }
     }
@@ -142,8 +142,8 @@ public class NullInputStreamTest extends
      */
     public void testMarkAndReset() throws Exception {
         int position = 0;
-        int readlimit = 10;
-        InputStream input = new TestNullInputStream(100, true, false);
+        final int readlimit = 10;
+        final InputStream input = new TestNullInputStream(100, true, false);
         
         assertTrue("Mark Should be Supported", input.markSupported());
 
@@ -151,7 +151,7 @@ public class NullInputStreamTest extends
         try {
             input.reset();
             fail("Read limit exceeded, expected IOException ");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals("No Mark IOException message",
                          "No position has been marked",
                          e.getMessage());
@@ -181,7 +181,7 @@ public class NullInputStreamTest extends
         try {
             input.reset();
             fail("Read limit exceeded, expected IOException ");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals("Read limit IOException message",
                          "Marked position [" + position
                          + "] is no longer valid - passed the read limit ["
@@ -194,20 +194,20 @@ public class NullInputStreamTest extends
      * Test <code>mark()</code> not supported.
      */
     public void testMarkNotSupported() throws Exception {
-        InputStream input = new TestNullInputStream(100, false, true);
+        final InputStream input = new TestNullInputStream(100, false, true);
         assertFalse("Mark Should NOT be Supported", input.markSupported());
 
         try {
             input.mark(5);
             fail("mark() should throw UnsupportedOperationException");
-        } catch (UnsupportedOperationException e) {
+        } catch (final UnsupportedOperationException e) {
             assertEquals("mark() error message",  "Mark not supported", e.getMessage());
         }
 
         try {
             input.reset();
             fail("reset() should throw UnsupportedOperationException");
-        } catch (UnsupportedOperationException e) {
+        } catch (final UnsupportedOperationException e) {
             assertEquals("reset() error message",  "Mark not supported", e.getMessage());
         }
     }
@@ -216,7 +216,7 @@ public class NullInputStreamTest extends
      * Test <code>skip()</code> method.
      */
    public void testSkip() throws Exception {
-        InputStream input = new TestNullInputStream(10, true, false);
+        final InputStream input = new TestNullInputStream(10, true, false);
         assertEquals("Read 1", 0, input.read());
         assertEquals("Read 2", 1, input.read());
         assertEquals("Skip 1", 5, input.skip(5));
@@ -226,7 +226,7 @@ public class NullInputStreamTest extends
         try {
             input.skip(5); //
             fail("Expected IOException for skipping after end of file");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals("Skip after EOF IOException message",
                     "Skip after end of file",
                     e.getMessage());
@@ -237,10 +237,10 @@ public class NullInputStreamTest extends
     // ------------- Test NullInputStream implementation -------------
 
     private static final class TestNullInputStream extends NullInputStream {
-        public TestNullInputStream(int size) {
+        public TestNullInputStream(final int size) {
             super(size);
         }
-        public TestNullInputStream(int size, boolean markSupported, boolean throwEofException) {
+        public TestNullInputStream(final int size, final boolean markSupported, final boolean throwEofException) {
             super(size, markSupported, throwEofException);
         }
         @Override
@@ -248,8 +248,8 @@ public class NullInputStreamTest extends
             return (int)getPosition() - 1;
         }
         @Override
-        protected void processBytes(byte[] bytes, int offset, int length) {
-            int startPos = (int)getPosition() - length;
+        protected void processBytes(final byte[] bytes, final int offset, final int length) {
+            final int startPos = (int)getPosition() - length;
             for (int i = offset; i < length; i++) {
                 bytes[i] = (byte)(startPos + i);
             }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullReaderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullReaderTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullReaderTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullReaderTest.java Fri Nov 30 20:51:39 2012
@@ -30,7 +30,7 @@ import junit.framework.TestCase;
 public class NullReaderTest extends TestCase {
 
     /** Constructor */
-    public NullReaderTest(String name) {
+    public NullReaderTest(final String name) {
         super(name);
     }
 
@@ -50,8 +50,8 @@ public class NullReaderTest extends Test
      * Test <code>available()</code> method.
      */
     public void testRead() throws Exception {
-        int size = 5;
-        TestNullReader reader = new TestNullReader(size);
+        final int size = 5;
+        final TestNullReader reader = new TestNullReader(size);
         for (int i = 0; i < size; i++) {
             assertEquals("Check Value [" + i + "]", i, reader.read());
         }
@@ -61,9 +61,9 @@ public class NullReaderTest extends Test
 
         // Test reading after the end of file
         try {
-            int result = reader.read();
+            final int result = reader.read();
             fail("Should have thrown an IOException, value=[" + result + "]");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals("Read after end of file", e.getMessage());
         }
 
@@ -76,32 +76,32 @@ public class NullReaderTest extends Test
      * Test <code>read(char[])</code> method.
      */
     public void testReadCharArray() throws Exception {
-        char[] chars = new char[10];
-        Reader reader = new TestNullReader(15);
+        final char[] chars = new char[10];
+        final Reader reader = new TestNullReader(15);
 
         // Read into array
-        int count1 = reader.read(chars);
+        final int count1 = reader.read(chars);
         assertEquals("Read 1", chars.length, count1);
         for (int i = 0; i < count1; i++) {
             assertEquals("Check Chars 1", i, chars[i]);
         }
 
         // Read into array
-        int count2 = reader.read(chars);
+        final int count2 = reader.read(chars);
         assertEquals("Read 2", 5, count2);
         for (int i = 0; i < count2; i++) {
             assertEquals("Check Chars 2", count1 + i, chars[i]);
         }
 
         // End of File
-        int count3 = reader.read(chars);
+        final int count3 = reader.read(chars);
         assertEquals("Read 3 (EOF)", -1, count3);
 
         // Test reading after the end of file
         try {
-            int count4 = reader.read(chars);
+            final int count4 = reader.read(chars);
             fail("Should have thrown an IOException, value=[" + count4 + "]");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals("Read after end of file", e.getMessage());
         }
 
@@ -109,9 +109,9 @@ public class NullReaderTest extends Test
         reader.close();
     
         // Read into array using offset & length
-        int offset = 2;
-        int lth    = 4;
-        int count5 = reader.read(chars, offset, lth);
+        final int offset = 2;
+        final int lth    = 4;
+        final int count5 = reader.read(chars, offset, lth);
         assertEquals("Read 5", lth, count5);
         for (int i = offset; i < lth; i++) {
             assertEquals("Check Chars 3", i, chars[i]);
@@ -123,13 +123,13 @@ public class NullReaderTest extends Test
      * (rather than return -1).
      */
     public void testEOFException() throws Exception {
-        Reader reader = new TestNullReader(2, false, true);
+        final Reader reader = new TestNullReader(2, false, true);
         assertEquals("Read 1",  0, reader.read());
         assertEquals("Read 2",  1, reader.read());
         try {
-            int result = reader.read();
+            final int result = reader.read();
             fail("Should have thrown an EOFException, value=[" + result + "]");
-        } catch (EOFException e) {
+        } catch (final EOFException e) {
             // expected
         }
     }
@@ -139,8 +139,8 @@ public class NullReaderTest extends Test
      */
     public void testMarkAndReset() throws Exception {
         int position = 0;
-        int readlimit = 10;
-        Reader reader = new TestNullReader(100, true, false);
+        final int readlimit = 10;
+        final Reader reader = new TestNullReader(100, true, false);
         
         assertTrue("Mark Should be Supported", reader.markSupported());
 
@@ -148,7 +148,7 @@ public class NullReaderTest extends Test
         try {
             reader.reset();
             fail("Read limit exceeded, expected IOException ");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals("No Mark IOException message",
                          "No position has been marked",
                          e.getMessage());
@@ -178,7 +178,7 @@ public class NullReaderTest extends Test
         try {
             reader.reset();
             fail("Read limit exceeded, expected IOException ");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals("Read limit IOException message",
                          "Marked position [" + position
                          + "] is no longer valid - passed the read limit ["
@@ -191,20 +191,20 @@ public class NullReaderTest extends Test
      * Test <code>mark()</code> not supported.
      */
     public void testMarkNotSupported() throws Exception {
-        Reader reader = new TestNullReader(100, false, true);
+        final Reader reader = new TestNullReader(100, false, true);
         assertFalse("Mark Should NOT be Supported", reader.markSupported());
 
         try {
             reader.mark(5);
             fail("mark() should throw UnsupportedOperationException");
-        } catch (UnsupportedOperationException e) {
+        } catch (final UnsupportedOperationException e) {
             assertEquals("mark() error message",  "Mark not supported", e.getMessage());
         }
 
         try {
             reader.reset();
             fail("reset() should throw UnsupportedOperationException");
-        } catch (UnsupportedOperationException e) {
+        } catch (final UnsupportedOperationException e) {
             assertEquals("reset() error message",  "Mark not supported", e.getMessage());
         }
     }
@@ -213,7 +213,7 @@ public class NullReaderTest extends Test
      * Test <code>skip()</code> method.
      */
    public void testSkip() throws Exception {
-        Reader reader = new TestNullReader(10, true, false);
+        final Reader reader = new TestNullReader(10, true, false);
         assertEquals("Read 1", 0, reader.read());
         assertEquals("Read 2", 1, reader.read());
         assertEquals("Skip 1", 5, reader.skip(5));
@@ -223,7 +223,7 @@ public class NullReaderTest extends Test
         try {
             reader.skip(5); //
             fail("Expected IOException for skipping after end of file");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             assertEquals("Skip after EOF IOException message",
                     "Skip after end of file",
                     e.getMessage());
@@ -234,10 +234,10 @@ public class NullReaderTest extends Test
     // ------------- Test NullReader implementation -------------
 
     private static final class TestNullReader extends NullReader {
-        public TestNullReader(int size) {
+        public TestNullReader(final int size) {
             super(size);
         }
-        public TestNullReader(int size, boolean markSupported, boolean throwEofException) {
+        public TestNullReader(final int size, final boolean markSupported, final boolean throwEofException) {
             super(size, markSupported, throwEofException);
         }
         @Override
@@ -245,8 +245,8 @@ public class NullReaderTest extends Test
             return (int)getPosition() - 1;
         }
         @Override
-        protected void processChars(char[] chars, int offset, int length) {
-            int startPos = (int)getPosition() - length;
+        protected void processChars(final char[] chars, final int offset, final int length) {
+            final int startPos = (int)getPosition() - length;
             for (int i = offset; i < length; i++) {
                 chars[i] = (char)(startPos + i);
             }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ProxyReaderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ProxyReaderTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ProxyReaderTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ProxyReaderTest.java Fri Nov 30 20:51:39 2012
@@ -29,24 +29,24 @@ import junit.framework.TestCase;
  */
 public class ProxyReaderTest extends TestCase {
 
-    public ProxyReaderTest(String name) {
+    public ProxyReaderTest(final String name) {
         super(name);
     }
 
     /** Test writing Null Char Array */
     public void testNullCharArray() {
 
-        ProxyReader proxy = new ProxyReaderImpl(new CustomNullReader(0));
+        final ProxyReader proxy = new ProxyReaderImpl(new CustomNullReader(0));
 
         try {
             proxy.read((char[])null);
-        } catch(Exception e) {
+        } catch(final Exception e) {
             fail("Writing null String threw " + e);
         }
 
         try {
             proxy.read((char[])null, 0, 0);
-        } catch(Exception e) {
+        } catch(final Exception e) {
             fail("Writing null String threw " + e);
         }
     }
@@ -54,33 +54,33 @@ public class ProxyReaderTest extends Tes
     /** Test writing Null CharBuffer */
     public void testNullCharBuffer() {
 
-        ProxyReader proxy = new ProxyReaderImpl(new CustomNullReader(0));
+        final ProxyReader proxy = new ProxyReaderImpl(new CustomNullReader(0));
 
         try {
             proxy.read((CharBuffer)null);
-        } catch(Exception e) {
+        } catch(final Exception e) {
             fail("Writing null String threw " + e);
         }
     }
 
     /** ProxyReader implementation */
     private static class ProxyReaderImpl extends ProxyReader {
-        ProxyReaderImpl(Reader proxy) {
+        ProxyReaderImpl(final Reader proxy) {
             super(proxy);
         }
     }
 
     /** Custom NullReader implementation */
     private static class CustomNullReader extends NullReader {
-        CustomNullReader(int len) {
+        CustomNullReader(final int len) {
             super(len);
         }
         @Override
-        public int read(char[] chars) throws IOException {
+        public int read(final char[] chars) throws IOException {
             return chars == null ? 0 : super.read(chars);
         }
         @Override
-        public int read(CharBuffer target) throws IOException {
+        public int read(final CharBuffer target) throws IOException {
             return target == null ? 0 : super.read(target);
         }
     }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java Fri Nov 30 20:51:39 2012
@@ -32,20 +32,20 @@ public class ReaderInputStreamTest {
     private static final String LARGE_TEST_STRING;
     
     static {
-        StringBuilder buffer = new StringBuilder();
+        final StringBuilder buffer = new StringBuilder();
         for (int i=0; i<100; i++) {
             buffer.append(TEST_STRING);
         }
         LARGE_TEST_STRING = buffer.toString();
     }
     
-    private Random random = new Random();
+    private final Random random = new Random();
     
-    private void testWithSingleByteRead(String testString, String charsetName) throws IOException {
-        byte[] bytes = testString.getBytes(charsetName);
-        ReaderInputStream in = new ReaderInputStream(new StringReader(testString), charsetName);
-        for (byte b : bytes) {
-            int read = in.read();
+    private void testWithSingleByteRead(final String testString, final String charsetName) throws IOException {
+        final byte[] bytes = testString.getBytes(charsetName);
+        final ReaderInputStream in = new ReaderInputStream(new StringReader(testString), charsetName);
+        for (final byte b : bytes) {
+            final int read = in.read();
             assertTrue(read >= 0);
             assertTrue(read <= 255);
             assertEquals(b, (byte)read);
@@ -53,14 +53,14 @@ public class ReaderInputStreamTest {
         assertEquals(-1, in.read());
     }
     
-    private void testWithBufferedRead(String testString, String charsetName) throws IOException {
-        byte[] expected = testString.getBytes(charsetName);
-        ReaderInputStream in = new ReaderInputStream(new StringReader(testString), charsetName);
-        byte[] buffer = new byte[128];
+    private void testWithBufferedRead(final String testString, final String charsetName) throws IOException {
+        final byte[] expected = testString.getBytes(charsetName);
+        final ReaderInputStream in = new ReaderInputStream(new StringReader(testString), charsetName);
+        final byte[] buffer = new byte[128];
         int offset = 0;
         while (true) {
             int bufferOffset = random.nextInt(64);
-            int bufferLength = random.nextInt(64);
+            final int bufferLength = random.nextInt(64);
             int read = in.read(buffer, bufferOffset, bufferLength);
             if (read == -1) {
                 assertEquals(offset, expected.length);
@@ -106,8 +106,8 @@ public class ReaderInputStreamTest {
     @Test
     public void testReadZero() throws Exception {
         final String inStr = "test";
-        ReaderInputStream r = new ReaderInputStream(new StringReader(inStr));
-        byte[] bytes = new byte[30];
+        final ReaderInputStream r = new ReaderInputStream(new StringReader(inStr));
+        final byte[] bytes = new byte[30];
         assertEquals(0, r.read(bytes, 0, 0));
         assertEquals(inStr.length(), r.read(bytes, 0, inStr.length()+1));
         // Should always return 0 for length == 0
@@ -116,8 +116,8 @@ public class ReaderInputStreamTest {
     
     @Test
     public void testReadZeroEmptyString() throws Exception {
-        ReaderInputStream r = new ReaderInputStream(new StringReader(""));
-        byte[] bytes = new byte[30];
+        final ReaderInputStream r = new ReaderInputStream(new StringReader(""));
+        final byte[] bytes = new byte[30];
         // Should always return 0 for length == 0
         assertEquals(0, r.read(bytes, 0, 0));
         assertEquals(-1, r.read(bytes, 0, 1));
@@ -133,10 +133,10 @@ public class ReaderInputStreamTest {
     @Test
     public void testCharsetMismatchInfiniteLoop() throws IOException {
         // Input is UTF-8 bytes: 0xE0 0xB2 0xA0
-        char[] inputChars = new char[] { (char) 0xE0, (char) 0xB2, (char) 0xA0 };
+        final char[] inputChars = new char[] { (char) 0xE0, (char) 0xB2, (char) 0xA0 };
         // Charset charset = Charset.forName("UTF-8"); // works
-        Charset charset = Charset.forName("ASCII"); // infinite loop
-        ReaderInputStream stream = new ReaderInputStream(new CharArrayReader(inputChars), charset);
+        final Charset charset = Charset.forName("ASCII"); // infinite loop
+        final ReaderInputStream stream = new ReaderInputStream(new CharArrayReader(inputChars), charset);
         try {
             while (stream.read() != -1) {
             }



Mime
View raw message