Thanks for the quick response.
This is my understanding of the code in StaxEventItemReader:
Code:
do {
currentRecordCount++;
if (moveCursorToNextFragment(fragmentReader)) {
fragmentReader.markStartFragment();
item = eventReaderDeserializer.deserializeFragment(fragmentReader);
fragmentReader.markFragmentProcessed();
}
} while (skipRecords.contains(new Long(currentRecordCount)));
Now keep in mind this is called after an exception was thrown in the middle of a fragment, so moveCursorToNextFragment will read all events from the stream until it reaches the end of the fragment and will return false (since the fragmentReader has a fake end of document there - its peek() returns null).
The while loop could have helped if the skipRecords list would still contain the record number, because it will loop again and seek to the next fragment.
I'm not entirely sure if that's how it's supposed to work.
Maybe markFragmentProcessed() should be called explicitly?