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 f7ce835d5..a83814eb4 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(); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java index 735eef7ed..e34db38fd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java @@ -85,7 +85,7 @@ public class BlameResult { String path = gen.getResultPath(); RawText contents = gen.getResultContents(); if (contents == null) { - gen.release(); + gen.close(); return null; } return new BlameResult(gen, path, contents); @@ -239,7 +239,7 @@ public class BlameResult { while (gen.next()) loadFrom(gen); } finally { - gen.release(); + gen.close(); generator = null; } } @@ -265,7 +265,7 @@ public class BlameResult { lastLength = gen.getRegionLength(); return gen.getResultStart(); } else { - gen.release(); + gen.close(); generator = null; return -1; } @@ -300,7 +300,7 @@ public class BlameResult { return; if (!gen.next()) { - gen.release(); + gen.close(); generator = null; return; }