summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2019-01-21 13:57:46 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2019-01-21 13:59:21 +0900
commit95d74f22fb1f4040a6c7526c76d3e6bdcba6c2ad (patch)
tree3f98d41ab6dbe894c1987722cd54d8d4fd03af2f /org.eclipse.jgit.test/tst
parentd11a40a14c945ca7a0ef51f89b6a03dfd6b0f0e6 (diff)
downloadjgit-95d74f22fb1f4040a6c7526c76d3e6bdcba6c2ad.tar.gz
jgit-95d74f22fb1f4040a6c7526c76d3e6bdcba6c2ad.zip
TemporaryBufferTest: Open TemporaryBuffer in try-with-resource
Except the cases where the warning was suppressed in bf757cd because they are explicitly testing functionality that is not possible in t-w-r. Change-Id: I6c66eb31a2314028e09a9213dc695cd163f907e9 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
index edcce126bb..9f1395b58a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
@@ -404,16 +404,16 @@ public class TemporaryBufferTest {
@Test
public void testHeap() throws IOException {
- @SuppressWarnings("resource" /* java 7 */)
- final TemporaryBuffer b = new TemporaryBuffer.Heap(2 * 8 * 1024);
- final byte[] r = new byte[8 * 1024];
- b.write(r);
- b.write(r);
- try {
- b.write(1);
- fail("accepted too many bytes of data");
- } catch (IOException e) {
- assertEquals("In-memory buffer limit exceeded", e.getMessage());
+ try (TemporaryBuffer b = new TemporaryBuffer.Heap(2 * 8 * 1024)) {
+ final byte[] r = new byte[8 * 1024];
+ b.write(r);
+ b.write(r);
+ try {
+ b.write(1);
+ fail("accepted too many bytes of data");
+ } catch (IOException e) {
+ assertEquals("In-memory buffer limit exceeded", e.getMessage());
+ }
}
}