Skip to content

Revisit exception declaration in public APIs #5013

@fmbenhassine

Description

@fmbenhassine

As of v5.2, several public APIs declare exceptions that are not thrown, or thrown at the wrong level of abstraction. Here are a few examples:

  • JobRestartException is currently defined in the data access layer (ie the org.springframework.batch.core.repository package where it is thrown by JobRepository#createJobExecution) while it should be at the job operator level (thrown by JobOperator#restart(JobExecution jobExecution))
  • JobOperator#start(Job job, JobParameters jobParameters) throws a NoSuchJobException even if the job is passed as a parameter (ie it is not just an id that should be fetched from the registry and which might result in a NoSuchJobException if the job is not recognised)
  • JobOperator#restart(JobExecution jobExecution) throws a NoSuchJobExecutionException even if the exception is passed as a parameter (similar to the previous point)
  • org.springframework.batch.item.file.transform.ConversionException is not used
  • org.springframework.batch.item.validator.ValidationException currently extends ItemReaderException but it is not related to item reading, it is used by the item processor when validating items

This should be reviewed in v6

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions