mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 09:20:04 +01:00
Wallet: extract local variables tempParentFile
and destParentFile
in method saveToFile()
This is meant to make it a bit clearer why a NullPointerException would occur.
This commit is contained in:
parent
87a2892bca
commit
5c5b2969d7
1 changed files with 6 additions and 4 deletions
|
@ -1692,11 +1692,13 @@ public class Wallet extends BaseTaggableObject
|
||||||
* @throws IOException if an error occurs while saving
|
* @throws IOException if an error occurs while saving
|
||||||
*/
|
*/
|
||||||
public void saveToFile(File tempFile, File destFile) throws IOException {
|
public void saveToFile(File tempFile, File destFile) throws IOException {
|
||||||
if (!tempFile.getParentFile().exists()) {
|
File tempParentFile = tempFile.getParentFile();
|
||||||
throw new FileNotFoundException(tempFile.getParentFile().getPath() + " (wallet directory not found)");
|
if (!tempParentFile.exists()) {
|
||||||
|
throw new FileNotFoundException(tempParentFile.getPath() + " (wallet directory not found)");
|
||||||
}
|
}
|
||||||
if (!destFile.getParentFile().exists()) {
|
File destParentFile = destFile.getParentFile();
|
||||||
throw new FileNotFoundException(destFile.getParentFile().getPath() + " (wallet directory not found)");
|
if (!destParentFile.exists()) {
|
||||||
|
throw new FileNotFoundException(destParentFile.getPath() + " (wallet directory not found)");
|
||||||
}
|
}
|
||||||
FileOutputStream stream = null;
|
FileOutputStream stream = null;
|
||||||
lock.lock();
|
lock.lock();
|
||||||
|
|
Loading…
Add table
Reference in a new issue