spring-projects / spring-projects/spring-batch

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

Open
#1,234 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core related-to: item-readers-writers status: waiting-for-triage type: bug
Dominant language
Java
Stars
3k
Forks
2.5k
Avg merge
6d 53m
Merged PRs (30d)
3

Description

Tommy opened BATCH-2370 and commented

The SingleItemPeekableItemReader behaves unexpectedly on repeated peek operation, if the underlying reader threw an exception. Repeated peek operation moves the record pointer by invoking read on the delegate, because no valid next item could be stored previously.

Probably it would be reasonable to additionally store the exception in peek, and emmit it over and over, as long no read operation will be invoked.
The reader should also respect such previously stored exception and emmit it if set by the read-ahead peek operation.


Affects: 3.0.3

Attachments:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the attached SingleItemPeekableItemReader.java and trace how repeated peek calls behave when the delegate reader throws an exception. Reproduce the case with a reader exception, then verify that repeated peeks re-emit the stored exception without advancing the record pointer until a read operation occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.