Browse Source

DfsPackCompactor: Open PackWriter in try-with-resource

Change-Id: I2c7b3fdf6a51471c35434a6176865d622b13653d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.0
David Pursehouse 7 years ago
parent
commit
a9bbbc0965
  1. 9
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java

9
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java

@ -268,8 +268,7 @@ public class DfsPackCompactor {
pc.setReuseDeltas(true);
pc.setReuseObjects(true);
PackWriter pw = new PackWriter(pc, ctx);
try {
try (PackWriter pw = new PackWriter(pc, ctx)) {
pw.setDeltaBaseAsOffset(true);
pw.setReuseDeltaCommits(false);
@ -285,8 +284,6 @@ public class DfsPackCompactor {
writeIndex(objdb, outDesc, pw);
PackStatistics stats = pw.getStatistics();
pw.close();
pw = null;
outDesc.setPackStats(stats);
newStats = stats;
@ -296,10 +293,6 @@ public class DfsPackCompactor {
objdb.rollbackPack(Collections.singletonList(outDesc));
}
}
} finally {
if (pw != null) {
pw.close();
}
}
}

Loading…
Cancel
Save