Skip to content

The constructor of JsonItemReader should call setExecutionContextName() #3681

Closed
@benelog

Description

@benelog

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions