BuildCheckpoints: Fix possible resource leak.

This commit is contained in:
Bas van Schaik
2017-04-27 19:14:09 +01:00
committed by Andreas Schildbach
parent a20087eee3
commit c1abf2b7f4

View File

@@ -193,7 +193,14 @@ public class BuildCheckpoints {
}
private static void sanityCheck(File file, int expectedSize) throws IOException {
CheckpointManager manager = new CheckpointManager(params, new FileInputStream(file));
FileInputStream fis = new FileInputStream(file);
CheckpointManager manager;
try {
manager = new CheckpointManager(params, fis);
} finally {
fis.close();
}
checkState(manager.numCheckpoints() == expectedSize);
if (params.getId().equals(NetworkParameters.ID_MAINNET)) {