diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java index 960c25bc59..3cd65b483b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java @@ -54,6 +54,7 @@ * @author Mahmoud Ben Hassine * @author Baris Cubukcuoglu * @author Parikshit Dutta + * @author Mark John Moreno * @see JobRepository * @see JobInstanceDao * @see JobExecutionDao @@ -152,13 +153,15 @@ public JobExecution createJobExecution(String jobName, JobParameters jobParamete + "so it may be dangerous to proceed. Manual intervention is probably necessary."); } Collection> allJobParameters = execution.getJobParameters().getParameters().values(); - long identifyingJobParametersCount = allJobParameters.stream().filter(JobParameter::isIdentifying) - .count(); + Collection> identifyingJobParameters = allJobParameters.stream() + .filter(JobParameter::isIdentifying).toList(); + long identifyingJobParametersCount = identifyingJobParameters.size(); if (identifyingJobParametersCount > 0 && (status == BatchStatus.COMPLETED || status == BatchStatus.ABANDONED)) { throw new JobInstanceAlreadyCompleteException( - "A job instance already exists and is complete for parameters=" + jobParameters - + ". If you want to run this job again, change the parameters."); + "A job instance already exists and is complete for identifying parameters=" + + identifyingJobParameters + ". If you want to run this job again, " + + "change the parameters."); } } executionContext = ecDao.getExecutionContext(jobExecutionDao.getLastJobExecution(jobInstance));