3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-15 03:35:52 +00:00

BlockFileLoader: On an unexpected problem, wrap exception with additional information.

This commit is contained in:
Andreas Schildbach 2018-04-06 20:47:16 +02:00
parent 11d7f15322
commit 7c270c23e6

View File

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