Use try-with-resources

This commit is contained in:
Oscar Guindzberg 2020-10-05 17:40:42 -03:00
parent 3554e19084
commit 499d7b7d35
No known key found for this signature in database
GPG key ID: 209796BF2E1D4F75

View file

@ -341,8 +341,7 @@ public class WalletConfig extends AbstractIdleService {
private Wallet loadWallet(boolean shouldReplayWallet, File walletFile, boolean isBsqWallet) throws Exception {
Wallet wallet;
FileInputStream walletStream = new FileInputStream(walletFile);
try {
try (FileInputStream walletStream = new FileInputStream(walletFile)) {
WalletExtension[] extArray = new WalletExtension[]{};
Protos.Wallet proto = WalletProtobufSerializer.parseToProto(walletStream);
final WalletProtobufSerializer serializer;
@ -360,8 +359,6 @@ public class WalletConfig extends AbstractIdleService {
.accountPath(new BisqKeyChainGroupStructure(isBsqWallet).accountPathFor(Script.ScriptType.P2WPKH)).build();
wallet.addAndActivateHDChain(nativeSegwitKeyChain);
}
} finally {
walletStream.close();
}
return wallet;
}