Skip to content
Merged
Show file tree
Hide file tree
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
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2025 the original author or authors.
* Copyright 2006-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -78,8 +78,7 @@ public void aggregate(StepExecution result, Collection<StepExecution> executions
return;
}
Set<Long> stepExecutionIds = executions.stream().map(stepExecution -> {
Long id = stepExecution.getId();
Assert.state(id != null, "StepExecution has null id. It must be saved first: " + stepExecution);
long id = stepExecution.getId();
return id;
}).collect(Collectors.toSet());
JobExecution jobExecution = jobRepository.getJobExecution(result.getJobExecutionId());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2025 the original author or authors.
* Copyright 2006-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -151,8 +151,7 @@ public void setCharset(Charset charset) {

@Override
public ExecutionContext getExecutionContext(JobExecution jobExecution) {
Long executionId = jobExecution.getId();
Assert.notNull(executionId, "ExecutionId must not be null.");
long executionId = jobExecution.getId();

List<ExecutionContext> results = getJdbcTemplate().query(getQuery(FIND_JOB_EXECUTION_CONTEXT),
new ExecutionContextRowMapper(), executionId);
Expand All @@ -166,8 +165,7 @@ public ExecutionContext getExecutionContext(JobExecution jobExecution) {

@Override
public ExecutionContext getExecutionContext(StepExecution stepExecution) {
Long executionId = stepExecution.getId();
Assert.notNull(executionId, "ExecutionId must not be null.");
long executionId = stepExecution.getId();

List<ExecutionContext> results = getJdbcTemplate().query(getQuery(FIND_STEP_EXECUTION_CONTEXT),
new ExecutionContextRowMapper(), executionId);
Expand All @@ -181,9 +179,8 @@ public ExecutionContext getExecutionContext(StepExecution stepExecution) {

@Override
public void updateExecutionContext(JobExecution jobExecution) {
Long executionId = jobExecution.getId();
long executionId = jobExecution.getId();
ExecutionContext executionContext = jobExecution.getExecutionContext();
Assert.notNull(executionId, "ExecutionId must not be null.");
Assert.notNull(executionContext, "The ExecutionContext must not be null.");

String serializedContext = serializeContext(executionContext);
Expand All @@ -197,9 +194,8 @@ public void updateExecutionContext(StepExecution stepExecution) {
// someone is already trying to do it.
this.lock.lock();
try {
Long executionId = stepExecution.getId();
long executionId = stepExecution.getId();
ExecutionContext executionContext = stepExecution.getExecutionContext();
Assert.notNull(executionId, "ExecutionId must not be null.");
Assert.notNull(executionContext, "The ExecutionContext must not be null.");

String serializedContext = serializeContext(executionContext);
Expand All @@ -214,9 +210,8 @@ public void updateExecutionContext(StepExecution stepExecution) {
@Override
public void saveExecutionContext(JobExecution jobExecution) {

Long executionId = jobExecution.getId();
long executionId = jobExecution.getId();
ExecutionContext executionContext = jobExecution.getExecutionContext();
Assert.notNull(executionId, "ExecutionId must not be null.");
Assert.notNull(executionContext, "The ExecutionContext must not be null.");

String serializedContext = serializeContext(executionContext);
Expand All @@ -226,9 +221,8 @@ public void saveExecutionContext(JobExecution jobExecution) {

@Override
public void saveExecutionContext(StepExecution stepExecution) {
Long executionId = stepExecution.getId();
long executionId = stepExecution.getId();
ExecutionContext executionContext = stepExecution.getExecutionContext();
Assert.notNull(executionId, "ExecutionId must not be null.");
Assert.notNull(executionContext, "The ExecutionContext must not be null.");

String serializedContext = serializeContext(executionContext);
Expand All @@ -241,9 +235,8 @@ public void saveExecutionContexts(Collection<StepExecution> stepExecutions) {
Assert.notNull(stepExecutions, "Attempt to save an null collection of step executions");
Map<Long, String> serializedContexts = CollectionUtils.newHashMap(stepExecutions.size());
for (StepExecution stepExecution : stepExecutions) {
Long executionId = stepExecution.getId();
long executionId = stepExecution.getId();
ExecutionContext executionContext = stepExecution.getExecutionContext();
Assert.notNull(executionId, "ExecutionId must not be null.");
Assert.notNull(executionContext, "The ExecutionContext must not be null.");
serializedContexts.put(executionId, serializeContext(executionContext));
}
Expand Down Expand Up @@ -279,7 +272,7 @@ public void afterPropertiesSet() throws Exception {
* @param serializedContext the serialized context to persist
* @param sql with parameters (shortContext, longContext, executionId)
*/
private void persistSerializedContext(Long executionId, String serializedContext, String sql) {
private void persistSerializedContext(long executionId, String serializedContext, String sql) {

final String shortContext;
final String longContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2025 the original author or authors.
* Copyright 2006-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -251,9 +251,6 @@ public void updateJobExecution(JobExecution jobExecution) {

validateJobExecution(jobExecution);

Assert.notNull(jobExecution.getId(),
"JobExecution ID cannot be null. JobExecution must be saved before it can be updated");

Assert.notNull(jobExecution.getVersion(),
"JobExecution version cannot be null. JobExecution must be saved before it can be updated");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2025 the original author or authors.
* Copyright 2006-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -215,8 +215,6 @@ private void validateStepExecution(StepExecution stepExecution) {
public void updateStepExecution(StepExecution stepExecution) {

validateStepExecution(stepExecution);
Assert.notNull(stepExecution.getId(),
"StepExecution Id cannot be null. StepExecution must saved" + " before it can be updated.");

// Do not check for existence of step execution considering
// it is saved at every commit point.
Expand Down