From b7df7d1fd38d6eba77514b0cd4154c530dfa1098 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sa=C5=A1a=20=C5=BDivkov?= Date: Wed, 21 Sep 2016 11:32:36 +0200 Subject: [PATCH] Unconditionally close repository in unregisterAndCloseRepository Repository.close() method is used when reference counting and expiration needs to be honored. The RepositoryCache.unregisterAndCloseRepository method should close the repository unconditionally. This is also indicated from its javadoc. Change-Id: I19392d1eaa17f27ae44b55eea49dcff05a52f298 --- .../src/org/eclipse/jgit/lib/RepositoryCache.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java index 29ef084830..2e0ed16a55 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java @@ -305,11 +305,9 @@ public class RepositoryCache { private void unregisterAndCloseRepository(final Key location, Repository db) { synchronized (lockFor(location)) { - if (isExpired(db)) { - Repository oldDb = unregisterRepository(location); - if (oldDb != null) { - oldDb.close(); - } + Repository oldDb = unregisterRepository(location); + if (oldDb != null) { + oldDb.doClose(); } } } -- 2.39.5