spring-projects / spring-projects/spring-batch
MethodInvokingTaskletAdapter should store exception string in ExitStatus description [BATCH-1901]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 2.5k
- Avg merge
- 6d 53m
- Merged PRs (30d)
- 3
Description
Eric Quilantang opened BATCH-1901 and commented
I don't see exceptions details when the tasklet fails.
I extended MethodInvokingTaskletAdapter to make them show up in spring batch admin.
/**
- MyMethodInvokingTaskletAdapter
- on exception, this stores exception string in {
@linkExitStatus}. - {
@linkMethodInvokingTaskletAdapter} does not do this. @authoreric.quilantang
*/
public class JqingMethodInvokingTaskletAdapter extends MethodInvokingTaskletAdapter {
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
try {
return super.execute(contribution, chunkContext);
} catch (Exception e) {
ExitStatus status = new ExitStatus(ExitStatus.FAILED.getExitCode(), e.toString());
contribution.setExitStatus(status);
}
return RepeatStatus.FINISHED;
}
}
Affects: 2.1.9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at MethodInvokingTaskletAdapter and inspect its execute path, especially how a tasklet failure sets ExitStatus. Confirm that the failure status exposes the exception string in its description, and verify the behavior with the relevant existing tests or a focused test if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100