aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2012-01-24 07:13:59 (EST)
committerRobin Stocker2012-01-24 07:13:59 (EST)
commitd54df5ad323bf4569167a300fb66ae6a49763b36 (patch)
treeee54c1391efb3e8af16c492436f61f812d2469df
parent2f53bccc6ba60b9c3c1ec0ea6ae16df614e192ef (diff)
downloadegit-d54df5ad323bf4569167a300fb66ae6a49763b36.zip
egit-d54df5ad323bf4569167a300fb66ae6a49763b36.tar.gz
egit-d54df5ad323bf4569167a300fb66ae6a49763b36.tar.bz2
Ensure that repo is closed in ProjectReferenceImporterrefs/changes/87/4987/1
Change-Id: I4b3c7da117402e67a306fed074426707cf73a756 Signed-off-by: Robin Stocker <robin@nibor.org>
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/internal/ProjectReferenceImporter.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/ProjectReferenceImporter.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/ProjectReferenceImporter.java
index b030c74..3cb8d78 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/ProjectReferenceImporter.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/ProjectReferenceImporter.java
@@ -191,17 +191,20 @@ public class ProjectReferenceImporter {
private static boolean repositoryAlreadyExistsForUrl(File repositoryPath,
URIish gitUrl) {
if (repositoryPath.exists()) {
+ FileRepository existingRepository;
+ try {
+ existingRepository = new FileRepository(repositoryPath);
+ } catch (IOException e) {
+ return false;
+ }
try {
- FileRepository existingRepository = new FileRepository(
- repositoryPath);
boolean exists = containsRemoteForUrl(
existingRepository.getConfig(), gitUrl);
- existingRepository.close();
return exists;
- } catch (IOException e) {
- return false;
} catch (URISyntaxException e) {
return false;
+ } finally {
+ existingRepository.close();
}
}
return false;