Skip to content

DefaultJobParametersExtractor no longer copies keys from JobParameters when not contained in ExecutionContext #4458

Closed
@jwillebrands

Description

@jwillebrands

Bug description
In Spring Batch 4.x DefaultJobParametersExtractor used to copy its configured keys from JobParameters when not contained in the ExecutionContext. In 5.x, this broke. It will now only consider JobParameters keys when useAllParentParameters is set to true. In that case it will copy JobParameters indiscriminately.

Judging by the javadoc and parameter names, I reckon this is a bug and behavior should be reverted to its 4.x behavior.

Environment
Spring Batch 5.0.3 and also present in main branch.

Steps to reproduce

  1. Use a DefaultJobParametersExtractor with useAllParentParameters = false and keys = ["jobParamKey"]
  2. Run getJobParameters for an ExecutionContext without jobParamKey set, and with parent JobParameters containing a value for jobParamKey
  3. Observe that the created JobParameters does not have a value for jobParamKey

Expected behavior
I expected same behavior as in 4.x: jobParamKey propagated to new JobParameters.

Minimal Complete Reproducible example
I will attach create a MR containing test case shortly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions