TestRepository: Fix resource leak flagged by Eclipse

Since [1], included in JGit 5.3.0, TestRepository is AutoCloseable and
should be managed by try-with-resource.

[1] https://git.eclipse.org/r/#/c/134912
Change-Id: Id5fa8a47e1557ee2a5765aa13fc317f2f73ef5d1
This commit is contained in:
David Ostrovsky
2019-05-26 12:31:31 +02:00
committed by David Pursehouse
parent 9cbb372690
commit 3b2df0674b
23 changed files with 96 additions and 86 deletions

View File

@@ -106,8 +106,8 @@ public class TestChanges {
// Change doesn't exist yet. NoteDb requires that there be a commit for the
// first patch set, so create one.
GitRepositoryManager repoManager = injector.getInstance(GitRepositoryManager.class);
try (Repository repo = repoManager.openRepository(c.getProject())) {
TestRepository<Repository> tr = new TestRepository<>(repo);
try (Repository repo = repoManager.openRepository(c.getProject());
TestRepository<Repository> tr = new TestRepository<>(repo)) {
PersonIdent ident =
user.asIdentifiedUser().newCommitterIdent(update.getWhen(), TimeZone.getDefault());
TestRepository<Repository>.CommitBuilder cb =