From 4bae608e8444e6a69ebb218f6a954700ba7173a6 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Fri, 3 Apr 2015 00:38:42 +0200 Subject: [PATCH] Use try-with-resource to close resources in CloneCommand Change-Id: I9536bc208a5f3ec34f0a82fb565b4253be38e074 Signed-off-by: Matthias Sohn --- org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java index f058f799d..53901f589 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java @@ -322,12 +322,9 @@ public class CloneCommand extends TransportCommand { private RevCommit parseCommit(final Repository clonedRepo, final Ref ref) throws MissingObjectException, IncorrectObjectTypeException, IOException { - final RevWalk rw = new RevWalk(clonedRepo); final RevCommit commit; - try { + try (final RevWalk rw = new RevWalk(clonedRepo)) { commit = rw.parseCommit(ref.getObjectId()); - } finally { - rw.release(); } return commit; }