]> source.dussan.org Git - jgit.git/commitdiff
Use try-with-resource to close BlameGenerator 95/45095/1
authorMatthias Sohn <matthias.sohn@sap.com>
Wed, 1 Apr 2015 23:15:59 +0000 (01:15 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 1 Apr 2015 23:15:59 +0000 (01:15 +0200)
Change-Id: Id4cb9a236dddfc674b55e9e7037329a885455288
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java

index f7ce835d51fa00010b47f9c2fa9a873ef7c2635b..a83814eb46a13e5fc2c36bd9249cf6e2ef0fc277 100644 (file)
@@ -200,8 +200,7 @@ public class BlameCommand extends GitCommand<BlameResult> {
         */
        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<BlameResult> {
                        return gen.computeBlameResult();
                } catch (IOException e) {
                        throw new JGitInternalException(e.getMessage(), e);
-               } finally {
-                       gen.release();
                }
        }