commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject [1/9] commons-compress git commit: Add final modifier to local variables.
Date Sat, 09 Apr 2016 17:10:36 GMT
Repository: commons-compress
Updated Branches:
  refs/heads/master bf85a64aa -> 3f2c760a4


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
b/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
index d15d74a..0a2a3b5 100644
--- a/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
@@ -31,7 +31,7 @@ public class BZip2CompressorInputStreamTest {
 
     @Test(expected = IOException.class)
     public void shouldThrowAnIOExceptionWhenAppliedToAZipFile() throws Exception {
-        FileInputStream in = new FileInputStream(getFile("bla.zip"));
+        final FileInputStream in = new FileInputStream(getFile("bla.zip"));
         try {
             new BZip2CompressorInputStream(in);
         } finally {
@@ -45,14 +45,14 @@ public class BZip2CompressorInputStreamTest {
     @Test
     public void readOfLength0ShouldReturn0() throws Exception {
         // Create a big random piece of data
-        byte[] rawData = new byte[1048576];
+        final byte[] rawData = new byte[1048576];
         for (int i=0; i < rawData.length; ++i) {
             rawData[i] = (byte) Math.floor(Math.random()*256);
         }
 
         // Compress it
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        BZip2CompressorOutputStream bzipOut = new BZip2CompressorOutputStream(baos);
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final BZip2CompressorOutputStream bzipOut = new BZip2CompressorOutputStream(baos);
         bzipOut.write(rawData);
         bzipOut.flush();
         bzipOut.close();
@@ -60,9 +60,9 @@ public class BZip2CompressorInputStreamTest {
         baos.close();
 
         // Try to read it back in
-        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-        BZip2CompressorInputStream bzipIn = new BZip2CompressorInputStream(bais);
-        byte[] buffer = new byte[1024];
+        final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+        final BZip2CompressorInputStream bzipIn = new BZip2CompressorInputStream(bais);
+        final byte[] buffer = new byte[1024];
         Assert.assertEquals(1024, bzipIn.read(buffer, 0, 1024));
         Assert.assertEquals(0, bzipIn.read(buffer, 1024, 0));
         Assert.assertEquals(1024, bzipIn.read(buffer, 0, 1024));

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
b/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
index c69b2d0..ee30d37 100644
--- a/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/bzip2/BlockSortTest.java
@@ -79,7 +79,7 @@ public class BlockSortTest {
 
     @Test
     public void testSortFixture() {
-        DS ds = setUpFixture();
+        final DS ds = setUpFixture();
         ds.s.blockSort(ds.data, FIXTURE.length - 1);
         assertFixtureSorted(ds.data);
         assertEquals(0, ds.data.origPtr);
@@ -87,21 +87,21 @@ public class BlockSortTest {
 
     @Test
     public void testSortFixtureMainSort() {
-        DS ds = setUpFixture();
+        final DS ds = setUpFixture();
         ds.s.mainSort(ds.data, FIXTURE.length - 1);
         assertFixtureSorted(ds.data);
     }
 
     @Test
     public void testSortFixtureFallbackSort() {
-        DS ds = setUpFixture();
+        final DS ds = setUpFixture();
         ds.s.fallbackSort(ds.data, FIXTURE.length - 1);
         assertFixtureSorted(ds.data);
     }
 
     @Test
     public void testSortFixture2() {
-        DS ds = setUpFixture2();
+        final DS ds = setUpFixture2();
         ds.s.blockSort(ds.data, FIXTURE2.length - 1);
         assertFixture2Sorted(ds.data);
         assertEquals(1, ds.data.origPtr);
@@ -109,23 +109,23 @@ public class BlockSortTest {
 
     @Test
     public void testSortFixture2MainSort() {
-        DS ds = setUpFixture2();
+        final DS ds = setUpFixture2();
         ds.s.mainSort(ds.data, FIXTURE2.length - 1);
         assertFixture2Sorted(ds.data);
     }
 
     @Test
     public void testSortFixture2FallbackSort() {
-        DS ds = setUpFixture2();
+        final DS ds = setUpFixture2();
         ds.s.fallbackSort(ds.data, FIXTURE2.length - 1);
         assertFixture2Sorted(ds.data);
     }
 
     @Test
     public void testFallbackSort() {
-        BZip2CompressorOutputStream.Data data = new BZip2CompressorOutputStream.Data(1);
-        BlockSort s = new BlockSort(data);
-        int[] fmap = new int[FIXTURE.length];
+        final BZip2CompressorOutputStream.Data data = new BZip2CompressorOutputStream.Data(1);
+        final BlockSort s = new BlockSort(data);
+        final int[] fmap = new int[FIXTURE.length];
         s.fallbackSort(fmap, FIXTURE, FIXTURE.length);
         assertArrayEquals(FIXTURE_SORTED, fmap);
     }
@@ -147,7 +147,7 @@ public class BlockSortTest {
     }
 
     private DS setUpFixture(final byte[] fixture) {
-        BZip2CompressorOutputStream.Data data = new BZip2CompressorOutputStream.Data(1);
+        final BZip2CompressorOutputStream.Data data = new BZip2CompressorOutputStream.Data(1);
         System.arraycopy(fixture, 0, data.block, 1, fixture.length);
         return new DS(data, new BlockSort(data));
     }

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
b/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
index cf06ade..2bdd014 100644
--- a/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
+++ b/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
@@ -48,8 +48,8 @@ public class PythonTruncatedBzip2Test {
 
     @BeforeClass
     public static void initializeTestData() throws IOException {
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        BZip2CompressorOutputStream bz2out = new BZip2CompressorOutputStream(out);
+        final ByteArrayOutputStream out = new ByteArrayOutputStream();
+        final BZip2CompressorOutputStream bz2out = new BZip2CompressorOutputStream(out);
         bz2out.write(TEXT.getBytes(), 0, TEXT.getBytes().length);
         bz2out.close();
         DATA = out.toByteArray();
@@ -60,7 +60,7 @@ public class PythonTruncatedBzip2Test {
 
     @Before
     public void initializeChannel() throws IOException {
-        InputStream source = new ByteArrayInputStream(TRUNCATED_DATA);
+        final InputStream source = new ByteArrayInputStream(TRUNCATED_DATA);
         this.bz2Channel = makeBZ2C(source);
     }
 
@@ -75,7 +75,7 @@ public class PythonTruncatedBzip2Test {
         //with BZ2File(self.filename) as f:
         //    self.assertRaises(EOFError, f.read)
         System.out.println("Attempt to read the whole thing in, should throw ...");
-        ByteBuffer buffer = ByteBuffer.allocate(8192);
+        final ByteBuffer buffer = ByteBuffer.allocate(8192);
         bz2Channel.read(buffer);
     }
 
@@ -97,14 +97,14 @@ public class PythonTruncatedBzip2Test {
         try {
             bz2Channel.read(buffer);
             Assert.fail("The read should have thrown.");
-        } catch (IOException e) {
+        } catch (final IOException e) {
             // pass
         }
     }
 
     private static ReadableByteChannel makeBZ2C(final InputStream source) throws IOException
{
-        BufferedInputStream bin = new BufferedInputStream(source);
-        BZip2CompressorInputStream bZin = new BZip2CompressorInputStream(bin, true);
+        final BufferedInputStream bin = new BufferedInputStream(source);
+        final BZip2CompressorInputStream bZin = new BZip2CompressorInputStream(bin, true);
 
         return Channels.newChannel(bZin);
     }
@@ -112,8 +112,8 @@ public class PythonTruncatedBzip2Test {
     // Helper method since Arrays#copyOfRange is Java 1.6+
     // Does not check parameters, so may fail if they are incompatible
     private static byte[] copyOfRange(final byte[] original, final int from, final int to)
{
-        int length = to - from;
-        byte buff[] = new byte[length];
+        final int length = to - from;
+        final byte buff[] = new byte[length];
         System.arraycopy(original, from, buff, 0, length);
         return buff;
     }

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStreamTest.java
b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStreamTest.java
index 8cfeb29..e17b6a0 100644
--- a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStreamTest.java
@@ -35,7 +35,7 @@ public class DeflateCompressorInputStreamTest {
         final File input = AbstractTestCase.getFile("bla.tar.deflatez");
         final InputStream is = new FileInputStream(input);
         try {
-            DeflateCompressorInputStream in =
+            final DeflateCompressorInputStream in =
                 new DeflateCompressorInputStream(is);
             Assert.assertTrue(in.available() > 0);
             in.close();
@@ -49,7 +49,7 @@ public class DeflateCompressorInputStreamTest {
         final File input = AbstractTestCase.getFile("bla.tar.deflatez");
         final InputStream is = new FileInputStream(input);
         try {
-            DeflateCompressorInputStream in =
+            final DeflateCompressorInputStream in =
                 new DeflateCompressorInputStream(is);
             Assert.assertEquals(1, in.skip(1));
             in.close();
@@ -63,7 +63,7 @@ public class DeflateCompressorInputStreamTest {
         final File input = AbstractTestCase.getFile("bla.tar.deflatez");
         final InputStream is = new FileInputStream(input);
         try {
-            DeflateCompressorInputStream in =
+            final DeflateCompressorInputStream in =
                 new DeflateCompressorInputStream(is);
             // tar header starts with filename "test1.xml"
             Assert.assertEquals('t', in.read());
@@ -78,7 +78,7 @@ public class DeflateCompressorInputStreamTest {
         final File input = AbstractTestCase.getFile("bla.tar.deflatez");
         final InputStream is = new FileInputStream(input);
         try {
-            DeflateCompressorInputStream in =
+            final DeflateCompressorInputStream in =
                 new DeflateCompressorInputStream(is);
             IOUtils.toByteArray(in);
             Assert.assertEquals(-1, in.read());

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStreamTest.java
b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStreamTest.java
index 658bd8f..c606615 100644
--- a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStreamTest.java
@@ -28,8 +28,8 @@ public class DeflateCompressorOutputStreamTest {
 
     @Test
     public void canReadASingleByteFlushAndFinish() throws IOException {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        DeflateCompressorOutputStream cos = new DeflateCompressorOutputStream(bos);
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final DeflateCompressorOutputStream cos = new DeflateCompressorOutputStream(bos);
         cos.write(99);
         cos.flush();
         cos.finish();

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateParametersTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateParametersTest.java
b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateParametersTest.java
index 6b20146..0a43798 100644
--- a/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateParametersTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/deflate/DeflateParametersTest.java
@@ -25,20 +25,20 @@ public class DeflateParametersTest {
 
     @Test
     public void shouldBeAbleToSetCompressionLevel() {
-        DeflateParameters p = new DeflateParameters();
+        final DeflateParameters p = new DeflateParameters();
         p.setCompressionLevel(5);
         Assert.assertEquals(5, p.getCompressionLevel());
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void shouldNotBeAbleToSetCompressionLevelToANegativeValue() {
-        DeflateParameters p = new DeflateParameters();
+        final DeflateParameters p = new DeflateParameters();
         p.setCompressionLevel(-2);
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void shouldNotBeAbleToSetCompressionLevelToADoubleDigitValue() {
-        DeflateParameters p = new DeflateParameters();
+        final DeflateParameters p = new DeflateParameters();
         p.setCompressionLevel(12);
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/lzma/LZMAUtilsTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/lzma/LZMAUtilsTestCase.java
b/src/test/java/org/apache/commons/compress/compressors/lzma/LZMAUtilsTestCase.java
index 357c9fb..17b3806 100644
--- a/src/test/java/org/apache/commons/compress/compressors/lzma/LZMAUtilsTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/lzma/LZMAUtilsTestCase.java
@@ -66,7 +66,7 @@ public class LZMAUtilsTestCase {
 
     @Test
     public void testMatches() {
-        byte[] data = {
+        final byte[] data = {
             (byte) 0x5D, 0, 0,
         };
         assertFalse(LZMAUtils.matches(data, 2));

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200UtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200UtilsTest.java
b/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200UtilsTest.java
index 2a75a08..83f8d32 100644
--- a/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200UtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200UtilsTest.java
@@ -47,14 +47,14 @@ public final class Pack200UtilsTest extends AbstractTestCase {
 
                 ArchiveEntry entry = in.getNextEntry();
                 while (entry != null) {
-                    File archiveEntry = new File(dir, entry.getName());
+                    final File archiveEntry = new File(dir, entry.getName());
                     archiveEntry.getParentFile().mkdirs();
                     if (entry.isDirectory()) {
                         archiveEntry.mkdir();
                         entry = in.getNextEntry();
                         continue;
                     }
-                    OutputStream out = new FileOutputStream(archiveEntry);
+                    final OutputStream out = new FileOutputStream(archiveEntry);
                     IOUtils.copy(in, out);
                     out.close();
                     entry = in.getNextEntry();
@@ -95,14 +95,14 @@ public final class Pack200UtilsTest extends AbstractTestCase {
 
                 ArchiveEntry entry = in.getNextEntry();
                 while (entry != null) {
-                    File archiveEntry = new File(dir, entry.getName());
+                    final File archiveEntry = new File(dir, entry.getName());
                     archiveEntry.getParentFile().mkdirs();
                     if (entry.isDirectory()) {
                         archiveEntry.mkdir();
                         entry = in.getNextEntry();
                         continue;
                     }
-                    OutputStream out = new FileOutputStream(archiveEntry);
+                    final OutputStream out = new FileOutputStream(archiveEntry);
                     IOUtils.copy(in, out);
                     out.close();
                     entry = in.getNextEntry();

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
b/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
index ec4eb2f..3126c4d 100644
--- a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
@@ -38,9 +38,9 @@ public final class FramedSnappyCompressorInputStreamTest
     @Test
     public void testMatches() throws IOException {
         assertFalse(FramedSnappyCompressorInputStream.matches(new byte[10], 10));
-        byte[] b = new byte[12];
+        final byte[] b = new byte[12];
         final File input = getFile("bla.tar.sz");
-        FileInputStream in = new FileInputStream(input);
+        final FileInputStream in = new FileInputStream(input);
         try {
             IOUtils.readFully(in, b);
         } finally {
@@ -92,7 +92,7 @@ public final class FramedSnappyCompressorInputStreamTest
 
         final FileInputStream sz = new FileInputStream(outputSz);
         try {
-            FileInputStream gz = new FileInputStream(outputGz);
+            final FileInputStream gz = new FileInputStream(outputGz);
             try {
                 assertArrayEquals(IOUtils.toByteArray(sz),
                                   IOUtils.toByteArray(gz));
@@ -107,9 +107,9 @@ public final class FramedSnappyCompressorInputStreamTest
     @Test
     public void testRemainingChunkTypes() throws Exception {
         final FileInputStream isSz = new FileInputStream(getFile("mixed.txt.sz"));
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        final ByteArrayOutputStream out = new ByteArrayOutputStream();
         try {
-            FramedSnappyCompressorInputStream in = new FramedSnappyCompressorInputStream(isSz);
+            final FramedSnappyCompressorInputStream in = new FramedSnappyCompressorInputStream(isSz);
             IOUtils.copy(in, out);
             out.close();
         } finally {
@@ -131,7 +131,7 @@ public final class FramedSnappyCompressorInputStreamTest
     public void testAvailable() throws Exception {
         final FileInputStream isSz = new FileInputStream(getFile("mixed.txt.sz"));
         try {
-            FramedSnappyCompressorInputStream in = new FramedSnappyCompressorInputStream(isSz);
+            final FramedSnappyCompressorInputStream in = new FramedSnappyCompressorInputStream(isSz);
             assertEquals(0, in.available()); // no chunk read so far
             assertEquals('1', in.read());
             assertEquals(3, in.available()); // remainder of first uncompressed block
@@ -149,17 +149,17 @@ public final class FramedSnappyCompressorInputStreamTest
 
     @Test
     public void testUnskippableChunk() {
-        byte[] input = new byte[] {
+        final byte[] input = new byte[] {
             (byte) 0xff, 6, 0, 0, 's', 'N', 'a', 'P', 'p', 'Y',
             2, 2, 0, 0, 1, 1
         };
         try {
-            FramedSnappyCompressorInputStream in =
+            final FramedSnappyCompressorInputStream in =
                 new FramedSnappyCompressorInputStream(new ByteArrayInputStream(input));
             in.read();
             fail("expected an exception");
             in.close();
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             assertTrue(ex.getMessage().contains("unskippable chunk"));
         }
     }

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java
b/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java
index 7279a95..6b8ab13 100644
--- a/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java
@@ -24,7 +24,7 @@ import org.junit.Test;
 public class XZCompressorInputStreamTest {
     @Test
     public void redundantTestOfAlmostDeprecatedMatchesMethod() {
-        byte[] data = {
+        final byte[] data = {
             (byte) 0xFD, '7', 'z', 'X', 'Z', '\0'
         };
         Assert.assertFalse(XZCompressorInputStream.matches(data, 5));

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/compressors/xz/XZUtilsTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/xz/XZUtilsTestCase.java
b/src/test/java/org/apache/commons/compress/compressors/xz/XZUtilsTestCase.java
index f5867d6..e706961 100644
--- a/src/test/java/org/apache/commons/compress/compressors/xz/XZUtilsTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/xz/XZUtilsTestCase.java
@@ -70,7 +70,7 @@ public class XZUtilsTestCase {
 
     @Test
     public void testMatches() {
-        byte[] data = {
+        final byte[] data = {
             (byte) 0xFD, '7', 'z', 'X', 'Z', '\0'
         };
         assertFalse(XZUtils.matches(data, 5));

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/utils/BitInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/utils/BitInputStreamTest.java b/src/test/java/org/apache/commons/compress/utils/BitInputStreamTest.java
index 793d6fa..6f90af3 100644
--- a/src/test/java/org/apache/commons/compress/utils/BitInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/BitInputStreamTest.java
@@ -30,42 +30,42 @@ public class BitInputStreamTest {
 
     @Test(expected = IllegalArgumentException.class)
     public void shouldNotAllowReadingOfANegativeAmountOfBits() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
         bis.readBits(-1);
         bis.close();
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void shouldNotAllowReadingOfMoreThan63BitsAtATime() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
         bis.readBits(64);
         bis.close();
     }
 
     @Test
     public void testReading24BitsInLittleEndian() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
         assertEquals(0x000140f8, bis.readBits(24));
         bis.close();
     }
 
     @Test
     public void testReading24BitsInBigEndian() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
         assertEquals(0x00f84001, bis.readBits(24));
         bis.close();
     }
 
     @Test
     public void testReading17BitsInLittleEndian() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
         assertEquals(0x000140f8, bis.readBits(17));
         bis.close();
     }
 
     @Test
     public void testReading17BitsInBigEndian() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
         // 1-11110000-10000000
         assertEquals(0x0001f080, bis.readBits(17));
         bis.close();
@@ -73,14 +73,14 @@ public class BitInputStreamTest {
 
     @Test
     public void testReading30BitsInLittleEndian() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
         assertEquals(0x2f0140f8, bis.readBits(30));
         bis.close();
     }
 
     @Test
     public void testReading30BitsInBigEndian() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
         // 111110-00010000-00000000-01001011
         assertEquals(0x3e10004b, bis.readBits(30));
         bis.close();
@@ -88,14 +88,14 @@ public class BitInputStreamTest {
 
     @Test
     public void testReading31BitsInLittleEndian() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
         assertEquals(0x2f0140f8, bis.readBits(31));
         bis.close();
     }
 
     @Test
     public void testReading31BitsInBigEndian() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.BIG_ENDIAN);
         // 1111100-00100000-00000000-10010111
         assertEquals(0x7c200097, bis.readBits(31));
         bis.close();
@@ -103,7 +103,7 @@ public class BitInputStreamTest {
 
     @Test
     public void testClearBitCache() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
         assertEquals(0x08, bis.readBits(4));
         bis.clearBitCache();
         assertEquals(0, bis.readBits(1));
@@ -112,7 +112,7 @@ public class BitInputStreamTest {
 
     @Test
     public void testEOF() throws IOException {
-        BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
+        final BitInputStream bis = new BitInputStream(getStream(), ByteOrder.LITTLE_ENDIAN);
         assertEquals(0x2f0140f8, bis.readBits(30));
         assertEquals(-1, bis.readBits(3));
         bis.close();

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/utils/CountingStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/utils/CountingStreamTest.java b/src/test/java/org/apache/commons/compress/utils/CountingStreamTest.java
index 82e06de..70e70b7 100644
--- a/src/test/java/org/apache/commons/compress/utils/CountingStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/CountingStreamTest.java
@@ -32,8 +32,8 @@ public class CountingStreamTest {
     public void output() throws Exception {
         // I don't like "test all at once" tests either, but the class
         // is so trivial
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        CountingOutputStream o = new CountingOutputStream(bos);
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final CountingOutputStream o = new CountingOutputStream(bos);
         o.write(1);
         assertEquals(1, o.getBytesWritten());
         o.write(new byte[] { 2, 3 });
@@ -52,9 +52,9 @@ public class CountingStreamTest {
     public void input() throws Exception {
         // I don't like "test all at once" tests either, but the class
         // is so trivial
-        ByteArrayInputStream bis =
+        final ByteArrayInputStream bis =
             new ByteArrayInputStream(new byte[] { 1, 2, 3, 4 });
-        CountingInputStream i = new CountingInputStream(bis);
+        final CountingInputStream i = new CountingInputStream(bis);
         assertEquals(1, i.read());
         assertEquals(1, i.getBytesRead());
         byte[] b = new byte[2];

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3f2c760a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
index 33ef7b9..47bd0b0 100644
--- a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
@@ -78,10 +78,10 @@ public class IOUtilsTest {
     }
 
     private void skip(final StreamWrapper wrapper) throws Exception {
-        ByteArrayInputStream in = new ByteArrayInputStream(new byte[] {
+        final ByteArrayInputStream in = new ByteArrayInputStream(new byte[] {
                 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
             });
-        InputStream sut = wrapper.wrap(in);
+        final InputStream sut = wrapper.wrap(in);
         Assert.assertEquals(10, IOUtils.skip(sut, 10));
         Assert.assertEquals(11, sut.read());
     }


Mime
View raw message