3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-11 17:55:53 +00:00

Always close the FileOutputStream in Wallet.saveToFile(). Cleans up a FindBugs warning.

This commit is contained in:
Mike Hearn 2011-08-05 20:03:24 +00:00
parent 20adfd9965
commit 67aa0ae4a3

View File

@ -149,7 +149,13 @@ public class Wallet implements Serializable {
* Uses Java serialization to save the wallet to the given file.
*/
public synchronized void saveToFile(File f) throws IOException {
saveToFileStream(new FileOutputStream(f));
FileOutputStream stream = null;
try {
stream = new FileOutputStream(f);
saveToFileStream(stream);
} finally {
if (stream != null) stream.close();
}
}
/**