You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2017/02/27 23:20:41 UTC

commons-compress git commit: Avoid some resource leak warnings

Repository: commons-compress
Updated Branches:
  refs/heads/master 03cb05ceb -> f4b675664


Avoid some resource leak warnings

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

Branch: refs/heads/master
Commit: f4b675664a7c633bdd62d5f85fcf3f95d11ade9b
Parents: 03cb05c
Author: Sebb <se...@apache.org>
Authored: Mon Feb 27 23:20:38 2017 +0000
Committer: Sebb <se...@apache.org>
Committed: Mon Feb 27 23:20:38 2017 +0000

----------------------------------------------------------------------
 .../compress/utils/SeekableInMemoryByteChannelTest.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/f4b67566/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java b/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
index 3e055b2..32af308 100644
--- a/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
@@ -45,6 +45,7 @@ public class SeekableInMemoryByteChannelTest {
         assertEquals(testData.length, readCount);
         assertArrayEquals(testData, readBuffer.array());
         assertEquals(testData.length, c.position());
+        c.close();
     }
 
     @Test
@@ -58,6 +59,7 @@ public class SeekableInMemoryByteChannelTest {
         assertEquals(testData.length, readCount);
         assertArrayEquals(testData, Arrays.copyOf(readBuffer.array(), testData.length));
         assertEquals(testData.length, c.position());
+        c.close();
     }
 
     @Test
@@ -72,6 +74,7 @@ public class SeekableInMemoryByteChannelTest {
         assertEquals(4L, readCount);
         assertEquals("data", new String(readBuffer.array(), Charset.forName(UTF_8)));
         assertEquals(testData.length, c.position());
+        c.close();
     }
 
     @Test
@@ -85,6 +88,7 @@ public class SeekableInMemoryByteChannelTest {
         //then
         assertEquals(0L, readBuffer.position());
         assertEquals(-1, readCount);
+        c.close();
     }
 
     @Test(expected = ClosedChannelException.class)
@@ -107,6 +111,7 @@ public class SeekableInMemoryByteChannelTest {
         assertEquals(testData.length, writeCount);
         assertArrayEquals(testData, Arrays.copyOf(c.array(), (int) c.size()));
         assertEquals(testData.length, c.position());
+        c.close();
     }
 
     @Test
@@ -123,6 +128,7 @@ public class SeekableInMemoryByteChannelTest {
         assertEquals(testData.length, writeCount);
         assertArrayEquals(expectedData.array(), Arrays.copyOf(c.array(), (int) c.size()));
         assertEquals(testData.length + 5, c.position());
+        c.close();
     }
 
 
@@ -144,6 +150,7 @@ public class SeekableInMemoryByteChannelTest {
         //then
         byte[] bytes = Arrays.copyOf(c.array(), (int) c.size());
         assertEquals("Some", new String(bytes, Charset.forName(UTF_8)));
+        c.close();
     }
 
     @Test
@@ -156,6 +163,7 @@ public class SeekableInMemoryByteChannelTest {
         //then
         assertEquals(4L, c.position());
         assertEquals(4L, c.size());
+        c.close();
     }
 
     @Test
@@ -170,6 +178,7 @@ public class SeekableInMemoryByteChannelTest {
         assertEquals(4L, posAtFour);
         assertEquals(c.size(), posAtTheEnd);
         assertEquals(posPastTheEnd, posPastTheEnd);
+        c.close();
     }
 
     @Test(expected = IllegalArgumentException.class)
@@ -178,6 +187,7 @@ public class SeekableInMemoryByteChannelTest {
         SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel();
         //when
         c.position(Integer.MAX_VALUE + 1L);
+        c.close();
     }
 
     @Test(expected = ClosedChannelException.class)