Browse Source

Merge "Use try-with-resource to close resources in DirCache"

stable-4.1
Shawn Pearce 10 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
f3a44db491
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java

5
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java vendored

@ -961,9 +961,8 @@ public class DirCache {
* @throws IOException * @throws IOException
*/ */
private void updateSmudgedEntries() throws IOException { private void updateSmudgedEntries() throws IOException {
TreeWalk walk = new TreeWalk(repository);
List<String> paths = new ArrayList<String>(128); List<String> paths = new ArrayList<String>(128);
try { try (TreeWalk walk = new TreeWalk(repository)) {
for (int i = 0; i < entryCnt; i++) for (int i = 0; i < entryCnt; i++)
if (sortedEntries[i].isSmudged()) if (sortedEntries[i].isSmudged())
paths.add(sortedEntries[i].getPathString()); paths.add(sortedEntries[i].getPathString());
@ -989,8 +988,6 @@ public class DirCache {
entry.setLastModified(fIter.getEntryLastModified()); entry.setLastModified(fIter.getEntryLastModified());
} }
} }
} finally {
walk.release();
} }
} }
} }

Loading…
Cancel
Save