Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
* @author Mahmoud Ben Hassine
* @author Baris Cubukcuoglu
* @author Parikshit Dutta
* @author Mark John Moreno
* @see JobRepository
* @see JobInstanceDao
* @see JobExecutionDao
Expand Down Expand Up @@ -152,13 +153,15 @@ public JobExecution createJobExecution(String jobName, JobParameters jobParamete
+ "so it may be dangerous to proceed. Manual intervention is probably necessary.");
}
Collection<JobParameter<?>> allJobParameters = execution.getJobParameters().getParameters().values();
long identifyingJobParametersCount = allJobParameters.stream().filter(JobParameter::isIdentifying)
.count();
Collection<JobParameter<?>> 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, "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will slightly modify the exception's message as it now uses Collection#toString rather than JobParameters#toString. I will update this on merge by wrapping the identifying job parameters in a JobParameters instance.

+ "change the parameters.");
}
}
executionContext = ecDao.getExecutionContext(jobExecutionDao.getLastJobExecution(jobInstance));
Expand Down