Skip to content

Commit

Permalink
BlockFileLoader: On an unexpected problem, wrap exception with additi…
Browse files Browse the repository at this point in the history
…onal information.
  • Loading branch information
Andreas Schildbach committed Apr 6, 2018
1 parent 11d7f15 commit 7c270c2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/main/java/org/bitcoinj/utils/BlockFileLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public static File defaultBlocksDir() {
}

private Iterator<File> fileIt;
private File file = null;
private FileInputStream currentFileStream = null;
private Block nextBlock = null;
private NetworkParameters params;
Expand Down Expand Up @@ -136,8 +137,9 @@ private void loadNextBlock() {
currentFileStream = null;
return;
}
file = fileIt.next();
try {
currentFileStream = new FileInputStream(fileIt.next());
currentFileStream = new FileInputStream(file);
} catch (FileNotFoundException e) {
currentFileStream = null;
}
Expand Down Expand Up @@ -172,6 +174,8 @@ private void loadNextBlock() {
} catch (ProtocolException e) {
nextBlock = null;
continue;
} catch (Exception e) {
throw new RuntimeException("unexpected problem with block in " + file, e);
}
break;
} catch (IOException e) {
Expand Down

0 comments on commit 7c270c2

Please sign in to comment.