From b84623ac64dff1821c4255d7495042e50bb8d890 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Fri, 3 Apr 2015 01:25:45 +0200 Subject: [PATCH] Use try-with-resource to close resources in DirCache Change-Id: I7dd3fd38784689816a1a8e9d8ccb499ae2138a8a Signed-off-by: Matthias Sohn --- org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java index 98a1c8ca4..6d9a32db9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java @@ -961,9 +961,8 @@ public class DirCache { * @throws IOException */ private void updateSmudgedEntries() throws IOException { - TreeWalk walk = new TreeWalk(repository); List paths = new ArrayList(128); - try { + try (TreeWalk walk = new TreeWalk(repository)) { for (int i = 0; i < entryCnt; i++) if (sortedEntries[i].isSmudged()) paths.add(sortedEntries[i].getPathString()); @@ -989,8 +988,6 @@ public class DirCache { entry.setLastModified(fIter.getEntryLastModified()); } } - } finally { - walk.release(); } } }