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 40c26b58bd
commit 759156c71b

View File

@ -211,7 +211,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)) {