INT-4067: Cover empty file case in FileSplitter

JIRA: https://jira.spring.io/browse/INT-4067

When `FileSplitter` is configured with `markers = true` and file is empty, an `iterator` for file throws `IOException: Stream closed`,
because we close the `buffer` just after the first `readLine()` attempt, but still return `true` from the first `hasNext()` call
where the `this.sof` and `this.eof` are `true` for markers.

Add logic to mark internal splitter `iterator` as `done` where we don't have content and still in `sof` state.
This commit is contained in:
Artem Bilan
2016-07-07 13:05:23 -04:00
committed by Gary Russell
parent 2cb5a0704a
commit 4cef58bc86
4 changed files with 38 additions and 8 deletions

View File

@@ -820,7 +820,8 @@ Markers are messages with `FileSplitter.FileMarker` payloads (with `START` and `
Markers might be used when sequentially processing files in a downstream flow where some lines are filtered.
They enable the downstream processing to know when a file has been completely processed.
In addition, a header `file_marker` containing `START` or `END` are added to these messages.
The 'END' marker includes a line count.
The `END` marker includes a line count.
If the file is empty, only `START` and `END` markers are emitted with `0` as the `lineCount`.
Default: `false`.
When `true`, `apply-sequence` is `false` by default.
Also see `markers-json`.