Fix for BATCH-146:Unclear error message and possible inappropriate exception type in SimpleJobRepository. Changed the exception type to BatchRestartException, and added additional unit tests.

This commit is contained in:
lucasward
2007-09-28 16:03:02 +00:00
parent 09862eaa97
commit 735603c59e
2 changed files with 58 additions and 1 deletions

View File

@@ -85,6 +85,8 @@ public class SimpleJobRepository implements JobRepository {
* </p>
*
* @see JobRepository#findOrCreateJob(JobConfiguration, JobIdentifier)
* @throws BatchRestartException if more than one JobInstance if found
* or if JobInstance.getJobExecutionCount() is greater than JobConfiguration.getStartLimit()
*/
public JobInstance findOrCreateJob(JobConfiguration jobConfiguration, JobIdentifier runtimeInformation) {
@@ -115,7 +117,7 @@ public class SimpleJobRepository implements JobRepository {
}
else {
// More than one job found, throw exception
throw new NoSuchBatchDomainObjectException("Error obtaining" + "previous job run: "
throw new BatchRestartException("Error restarting job, more than one JobInstance found for: "
+ jobConfiguration.toString());
}
}