Browse Source

Merge "Use try-with-resource to close resources in BundleWriter"

stable-4.1
Shawn Pearce 10 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
7810d9bc42
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java

5
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();
}
}
}

Loading…
Cancel
Save