From: Matthias Sohn Date: Wed, 1 Apr 2015 23:15:59 +0000 (+0200) Subject: Use try-with-resource to close BlameGenerator X-Git-Tag: v4.0.0.201505050340-m2~1^2~19^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e03b6c5cf86c7bcaef8ec40cd9e07193709aad8a;p=jgit.git Use try-with-resource to close BlameGenerator Change-Id: Id4cb9a236dddfc674b55e9e7037329a885455288 Signed-off-by: Matthias Sohn --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java index f7ce835d51..a83814eb46 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java @@ -200,8 +200,7 @@ public class BlameCommand extends GitCommand { */ public BlameResult call() throws GitAPIException { checkCallable(); - BlameGenerator gen = new BlameGenerator(repo, path); - try { + try (BlameGenerator gen = new BlameGenerator(repo, path)) { if (diffAlgorithm != null) gen.setDiffAlgorithm(diffAlgorithm); if (textComparator != null) @@ -231,8 +230,6 @@ public class BlameCommand extends GitCommand { return gen.computeBlameResult(); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); - } finally { - gen.release(); } }