Skip to content

Commit 41517ea

Browse files
marschallfmbenhassine
authored andcommitted
Use ExecutionContext map constructor
Use ExecutionContext map constructor to simplify ExecutionContextRowMapper.mapRow. Issue #3985
1 parent b38226e commit 41517ea

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2022 the original author or authors.
2+
* Copyright 2006-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -351,7 +351,6 @@ private class ExecutionContextRowMapper implements RowMapper<ExecutionContext> {
351351

352352
@Override
353353
public ExecutionContext mapRow(ResultSet rs, int i) throws SQLException {
354-
ExecutionContext executionContext = new ExecutionContext();
355354
String serializedContext = rs.getString("SERIALIZED_CONTEXT");
356355
if (serializedContext == null) {
357356
serializedContext = rs.getString("SHORT_CONTEXT");
@@ -365,10 +364,7 @@ public ExecutionContext mapRow(ResultSet rs, int i) throws SQLException {
365364
catch (IOException ioe) {
366365
throw new IllegalArgumentException("Unable to deserialize the execution context", ioe);
367366
}
368-
for (Map.Entry<String, Object> entry : map.entrySet()) {
369-
executionContext.put(entry.getKey(), entry.getValue());
370-
}
371-
return executionContext;
367+
return new ExecutionContext(map);
372368
}
373369

374370
}

0 commit comments

Comments
 (0)