Skip to content

Commit 17c3b6d

Browse files
committed
Use ExecutionContext map constructor
Use ExecutionContext map constructor to simplify ExecutionContextRowMapper.mapRow.
1 parent 656e3f8 commit 17c3b6d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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)