spring-batch icon indicating copy to clipboard operation
spring-batch copied to clipboard

ExecutionContextDao API Clarification [BATCH-1858]

Open spring-projects-issues opened this issue 13 years ago • 1 comments

Robert Fischer opened BATCH-1858 and commented

What should the behavior be here?

assertTrue(jobExecution.getExecutionContext() != null); mapExecutionContextDao.updateExecutionContext(jobExecution); jobExecution.setExecutionContext(null); mapExecutionContextDao.updateExecutionContext(jobExecution); assert???(mapExecutionContextDao.getExecutionContext(jobExecution) == null);

As of now, it will return non-null.

I'm aware that jobExecutions should never have a null execution context, and hence the trivial priority on this. We should probably be intentional about what we want to do here. I'd be inclined to either throw an exception if we are told to update the execution context with a null execution context on the assumption that something has gone horribly awry, or to allow it to be updated to null on the assumption that the user should know what they're doing.


Affects: 2.2.0

spring-projects-issues avatar May 14 '12 11:05 spring-projects-issues

Dave Syer commented

Agree that it should never be null. We can throw an exception in the setter, but it does seem trivial, and there are plenty of other places where null checks are not done to reduce the volume of code where the probability of it happening is low.

spring-projects-issues avatar Jul 04 '12 00:07 spring-projects-issues