Closed
Description
When the constructor of JsonItemReader is called directly and open(ExectionConext)
is called, it makes exceptions at ExecutionContextUserSupport.getKey(..)
JsonItemReader<AccessLog> reader = new JsonItemReader<AccessLog>(resource, jsonObjectReader);
reader.open(new ExecutionContext());
AccessLog item = reader.read();
reader.close();
java.lang.IllegalArgumentException: Name must be assigned for the sake of defining the execution context keys prefix.
at org.springframework.util.Assert.hasText(Assert.java:284)
at org.springframework.batch.item.util.ExecutionContextUserSupport.getKey(ExecutionContextUserSupport.java:62)
at org.springframework.batch.item.ItemStreamSupport.getExecutionContextKey(ItemStreamSupport.java:71)
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:159)
The constructor of JsonItemReader should call setExecutionContextName(String)
similar to JsonFileItemWriter.java#L71