summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-10-02 01:17:37 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2020-10-02 01:18:18 +0200
commitdcc6c8a261415bd53490734d1e36dcb8a2d69404 (patch)
treec201c30aab2428a8126ba55245e1cbc0201bf7da /org.eclipse.jgit.test
parent7fbc0e02a01bd91c90b404e3c1b0d22dcf296fb9 (diff)
downloadjgit-dcc6c8a261415bd53490734d1e36dcb8a2d69404.tar.gz
jgit-dcc6c8a261415bd53490734d1e36dcb8a2d69404.zip
UploadPackTest#testUploadRedundantBytes: ensure test repo is closed
This fixes a resource leak warning. Change-Id: I65166eeefc719ea577963c84ce2059e2d7e6c1d7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
index 55caa64d87..ce546e357e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
@@ -1117,13 +1117,16 @@ public class UploadPackTest {
RevCommit child = remote.commit(remote.tree(remote.file("foo", childBlob)), parent);
remote.update("branch1", child);
- TestRepository<InMemoryRepository> local = new TestRepository<>(client);
- RevBlob localParentBlob = local.blob(commonInBlob + "a");
- RevCommit localParent = local.commit(local.tree(local.file("foo", localParentBlob)));
- RevBlob localChildBlob = local.blob(commonInBlob + "b");
- RevCommit localChild = local.commit(
- local.tree(local.file("foo", localChildBlob)), localParent);
- local.update("branch1", localChild);
+ try (TestRepository<InMemoryRepository> local = new TestRepository<>(
+ client)) {
+ RevBlob localParentBlob = local.blob(commonInBlob + "a");
+ RevCommit localParent = local
+ .commit(local.tree(local.file("foo", localParentBlob)));
+ RevBlob localChildBlob = local.blob(commonInBlob + "b");
+ RevCommit localChild = local.commit(
+ local.tree(local.file("foo", localChildBlob)), localParent);
+ local.update("branch1", localChild);
+ }
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",