Skip to content

Add missing StepListenerMetaData entry for @OnChunkError - #5469

Open
benelog wants to merge 1 commit into
spring-projects:mainfrom
benelog:GH-5468
Open

Add missing StepListenerMetaData entry for @OnChunkError#5469
benelog wants to merge 1 commit into
spring-projects:mainfrom
benelog:GH-5468

Conversation

@benelog

@benelog benelog commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Resolves #5468

The parameter types follow ON_WRITE_ERROR, which has the same (Exception, Chunk) shape. No other change was needed: ChunkOrientedStepBuilder#listener(Object) already scans for the annotation and StepListenerFactoryBean reads StepListenerMetaData.values().

Points for review

  • The new constant sits after AFTER_CHUNK_ERROR to keep the chunk callbacks together, which shifts the ordinals below it. Nothing reads the ordinal, but say the word if you would rather have it appended at the end.
  • taskletListenerMetaData() is untouched. It feeds the XML namespace for TaskletStep, which calls afterChunkError(ChunkContext) and not onChunkError. Happy to expose on-chunk-error-method there too if you want it in the namespace.
  • @AfterChunkError on a chunk-oriented step stays broken: listener(Object) does not scan for it. Since it maps to a method deprecated for removal in 6.2 that ChunkOrientedStep never calls, wiring it up seemed like the wrong direction. Noted in the issue rather than fixed here.

Verification

Besides the unit test in the diff, the reproducer from #5468 was re-run against a locally built 6.0.5-SNAPSHOT:

[DIAG] @OnChunkError = [annotation:beforeChunk, annotation:afterChunk, annotation:beforeChunk, annotation:onChunkError]

@OnChunkError was introduced in 6.0 and ChunkOrientedStepBuilder#listener(Object)
scans for it, but StepListenerMetaData had no corresponding constant. The proxy
returned by StepListenerFactoryBean therefore had nothing bound to
onChunkError(Exception, Chunk), so an annotated method was registered and never
invoked. No exception was thrown and no warning was logged.

AFTER_CHUNK_ERROR does not cover this case: it maps to the deprecated
ChunkListener#afterChunkError(ChunkContext), which only TaskletStep calls.
ChunkOrientedStep calls onChunkError(Exception, Chunk) exclusively.

Add ON_CHUNK_ERROR with the signature documented on the annotation, following
ON_WRITE_ERROR which has the same (Exception, Chunk) shape.

Resolves spring-projects#5468

Signed-off-by: Sanghyuk Jung <sanghyuk.jung@navercorp.com>
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.

@OnChunkError is never invoked on a chunk-oriented step

1 participant