3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-16 04:05:50 +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 Iterator<File> fileIt;
private File file = null;
private FileInputStream currentFileStream = null; private FileInputStream currentFileStream = null;
private Block nextBlock = null; private Block nextBlock = null;
private NetworkParameters params; private NetworkParameters params;
@ -136,8 +137,9 @@ public class BlockFileLoader implements Iterable<Block>, Iterator<Block> {
currentFileStream = null; currentFileStream = null;
return; return;
} }
file = fileIt.next();
try { try {
currentFileStream = new FileInputStream(fileIt.next()); currentFileStream = new FileInputStream(file);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
currentFileStream = null; currentFileStream = null;
} }
@ -172,6 +174,8 @@ public class BlockFileLoader implements Iterable<Block>, Iterator<Block> {
} catch (ProtocolException e) { } catch (ProtocolException e) {
nextBlock = null; nextBlock = null;
continue; continue;
} catch (Exception e) {
throw new RuntimeException("unexpected problem with block in " + file, e);
} }
break; break;
} catch (IOException e) { } catch (IOException e) {