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(); } } }