aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2015-04-03 01:25:45 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2015-04-03 01:25:45 +0200
commitb84623ac64dff1821c4255d7495042e50bb8d890 (patch)
tree6d80756aa1eb72129618f5661d84b2a089efdfcb /org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
parent81c84c088f85e5babe73e1799fe786bf32750a5a (diff)
downloadjgit-b84623ac64dff1821c4255d7495042e50bb8d890.tar.gz
jgit-b84623ac64dff1821c4255d7495042e50bb8d890.zip
Use try-with-resource to close resources in DirCache
Change-Id: I7dd3fd38784689816a1a8e9d8ccb499ae2138a8a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java5
1 files changed, 1 insertions, 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 98a1c8ca4b..6d9a32db92 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<String> paths = new ArrayList<String>(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();
}
}
}