From d4380a9c819ffe598b53778fe1444aab7f32076c Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 2 Apr 2015 01:25:46 +0200 Subject: [PATCH] Use try-with-resource to close resources in BundleWriter Change-Id: I5341973737f6d21c04982bcbefc2ed672ac9bcff Signed-off-by: Matthias Sohn --- .../src/org/eclipse/jgit/transport/BundleWriter.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java index d0f005cde..81ad98191 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java @@ -194,8 +194,7 @@ public class BundleWriter { PackConfig pc = packConfig; if (pc == null) pc = new PackConfig(db); - PackWriter packWriter = new PackWriter(pc, db.newObjectReader()); - try { + try (PackWriter packWriter = new PackWriter(pc, db.newObjectReader())) { final HashSet inc = new HashSet(); final HashSet exc = new HashSet(); inc.addAll(include.values()); @@ -233,8 +232,6 @@ public class BundleWriter { w.write('\n'); w.flush(); packWriter.writePack(monitor, monitor, os); - } finally { - packWriter.release(); } } }