From d11a40a14c945ca7a0ef51f89b6a03dfd6b0f0e6 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 21 Jan 2019 13:45:58 +0900 Subject: [PATCH] Scanner: Open RevWalk in try-with-resource Change-Id: Ieeec292c1346edbda2b26f021e75cbc1435bb9f9 Signed-off-by: David Pursehouse --- .../org/eclipse/jgit/internal/storage/reftree/Scanner.java | 5 +++-- 1 file 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 2ef0f20d8..2fa59f3cd 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) {