Skip to content

Incorrect job restart with null parameters of type long/double #4087

@cnlin

Description

@cnlin

Bug description
In SpringBatch 1.x~4.x , JobParameter supports null value , so save in database will be null. While java.sql.ResultSet#getLong or java.sql.ResultSet#getDouble return primitive type, a round trip from database will finally get 0 or 0.0. It work uncorrectly in jobOperator.restart.
That may cause:

  1. jobOperator.restart will create new JobInstance, not act like restart.
  2. If null is meaningful in user project, that could cause the different result, because it restart an JobParameter with 0 or 0.0 value, not null anymore.

Environment
Spring Batch version: 1.x ~ 4.x, using JdbcJobExecutionDao (JobParameter unsupported null value in 5.x )

Steps to reproduce

  1. Creating an JobParameter with null value that in java.lang.Long or java.lang.Double type.
  2. Creating an job will failed in process.
  3. Using jobOperator.restart to restart that JobInstance.
  4. Check the count of JobInstance

Expected behavior
The jobOperator.restart should work right.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions