Skip to content

Preserve read-ahead exceptions in SingleItemPeekableItemReader - #5603

Open
nippyclouding wants to merge 1 commit into
spring-projects:mainfrom
nippyclouding:GH-1234
Open

nippyclouding wants to merge 1 commit into
spring-projects:mainfrom
nippyclouding:GH-1234

Conversation

@nippyclouding

Copy link
Copy Markdown

When the delegate throws during peek(), a subsequent peek() or read() advances past the failed item. A checkpoint taken before consuming that failure can also skip the item on restart.

Cache the read-ahead exception until read() consumes it, and preserve the pre-peek checkpoint while the exception is pending. Clear the cached exception on open() and close(). Add regression coverage for repeated peeks, exception consumption, lifecycle resets, and restart positions using a FlatFileItemReader.

Closes #1234

Validation on Temurin JDK 25:

  • The new regression tests fail against the original implementation (3 failures).
  • ./mvnw -B -ntp -pl spring-batch-infrastructure -Dtest=SingleItemPeekableItemReaderTests,SingleItemPeekableItemReaderBuilderTests test passes (12 tests).
  • ./mvnw -B -ntp package passes for all modules.
  • Docker-based integration tests were not run because the local Docker daemon is unavailable.

Cache delegate read failures until read consumes them and retain the pre-peek checkpoint while a failure is pending.

Closes spring-projectsgh-1234

Signed-off-by: Lee Sang Won <nippyclouding@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SingleItemPeekableItemReader repeated peek issue with reader exceptions [BATCH-2370]

1 participant