summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2019-01-21 13:45:58 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2019-01-21 13:45:58 +0900
commitd11a40a14c945ca7a0ef51f89b6a03dfd6b0f0e6 (patch)
tree77aaf28dbfcd74cf445461bb2553ec9d62dcadab /org.eclipse.jgit
parent6503a67e46108ebd6bc07a518ea28310f7223038 (diff)
downloadjgit-d11a40a14c945ca7a0ef51f89b6a03dfd6b0f0e6.tar.gz
jgit-d11a40a14c945ca7a0ef51f89b6a03dfd6b0f0e6.zip
Scanner: Open RevWalk in try-with-resource
Change-Id: Ieeec292c1346edbda2b26f021e75cbc1435bb9f9 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/Scanner.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/Scanner.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/Scanner.java
index 2ef0f20d8d..2fa59f3cd3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/Scanner.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/Scanner.java
@@ -221,10 +221,11 @@ class Scanner {
return new SymbolicRef(ref.getName(), dst);
}
- @SuppressWarnings("resource")
private static RevTree toTree(ObjectReader reader, AnyObjectId id)
throws IOException {
- return new RevWalk(reader).parseTree(id);
+ try (RevWalk rw = new RevWalk(reader)) {
+ return rw.parseTree(id);
+ }
}
private static boolean curElementHasPeelSuffix(AbstractTreeIterator itr) {