Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DDC12200C3D for ; Tue, 28 Feb 2017 00:20:42 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id DC5B3160B6C; Mon, 27 Feb 2017 23:20:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2F672160B60 for ; Tue, 28 Feb 2017 00:20:42 +0100 (CET) Received: (qmail 69184 invoked by uid 500); 27 Feb 2017 23:20:41 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 69175 invoked by uid 99); 27 Feb 2017 23:20:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2017 23:20:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2994ADFDE6; Mon, 27 Feb 2017 23:20:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sebb@apache.org To: commits@commons.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: commons-compress git commit: Avoid some resource leak warnings Date: Mon, 27 Feb 2017 23:20:41 +0000 (UTC) archived-at: Mon, 27 Feb 2017 23:20:43 -0000 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 Authored: Mon Feb 27 23:20:38 2017 +0000 Committer: Sebb 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)