diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2015-04-02 01:25:46 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2015-04-02 01:25:46 +0200 |
commit | d4380a9c819ffe598b53778fe1444aab7f32076c (patch) | |
tree | fb98e85366f5b21e752bb3925cb8e41a083d21a9 | |
parent | d94ce9c754b740defbd75230663d323f64cc9648 (diff) | |
download | jgit-d4380a9c819ffe598b53778fe1444aab7f32076c.tar.gz jgit-d4380a9c819ffe598b53778fe1444aab7f32076c.zip |
Use try-with-resource to close resources in BundleWriter
Change-Id: I5341973737f6d21c04982bcbefc2ed672ac9bcff
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java | 5 |
1 files changed, 1 insertions, 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 d0f005cde8..81ad981918 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<ObjectId> inc = new HashSet<ObjectId>(); final HashSet<ObjectId> exc = new HashSet<ObjectId>(); inc.addAll(include.values()); @@ -233,8 +232,6 @@ public class BundleWriter { w.write('\n'); w.flush(); packWriter.writePack(monitor, monitor, os); - } finally { - packWriter.release(); } } } |