DfsPackCompactor: Open PackWriter in try-with-resource

Change-Id: I2c7b3fdf6a51471c35434a6176865d622b13653d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2018-03-14 13:01:59 +09:00
parent 280b2bfe52
commit a9bbbc0965
1 changed files with 1 additions and 8 deletions

View File

@ -268,8 +268,7 @@ private void compactPacks(DfsReader ctx, ProgressMonitor pm)
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 @@ private void compactPacks(DfsReader ctx, ProgressMonitor pm)
writeIndex(objdb, outDesc, pw);
PackStatistics stats = pw.getStatistics();
pw.close();
pw = null;
outDesc.setPackStats(stats);
newStats = stats;
@ -296,10 +293,6 @@ private void compactPacks(DfsReader ctx, ProgressMonitor pm)
objdb.rollbackPack(Collections.singletonList(outDesc));
}
}
} finally {
if (pw != null) {
pw.close();
}
}
}