spring-projects / spring-projects/spring-batch

Can't run job a second time if empty list is passed as parameter the first time (Oracle)

Open
#4,427 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

has: minimal-example status: need-help-to-reproduce type: bug
Dominant language
Java
Stars
3k
Forks
2.5k
Avg merge
6d 53m
Merged PRs (30d)
3

Description

Bug description
When a job has a parameter of type java.util.List and the job is run with an empty list and the database is Oracle, it is not possible to run the job a second time.

The exception java.lang.IllegalArgumentException: value must not be null will be thrown by JobParameter because it is trying to convert null into a List. The null values comes from the fact that empty strings are the same thing as null for Oracle database (the empty string being the serialised empty list).

Environment

  • Spring Batch 5.0.2
  • Java 17
  • Oracle database

Steps to reproduce

  1. Create a job with a parameter of type List
  2. Run the job with an empty list as argument
  3. Run the job a second time (with any value as argument)

Expected behavior
It should be possible to run such a job an infinite number of times.

Minimal Complete Reproducible example
https://github.com/nyg/example-spring-batch-bug

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal complete reproducible example and trace how JobParameter converts the serialized empty list when the job parameters are read from Oracle. Confirm the failure after the first empty-list run, then verify that subsequent runs with another list value succeed repeatedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.