Browse Source

Use try-with-resource to close resources in DirCache

Change-Id: I7dd3fd38784689816a1a8e9d8ccb499ae2138a8a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.1
Matthias Sohn 10 years ago
parent
commit
b84623ac64
  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