Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When an parameter with empty value is provided, DefaultJobParametersConverter fails with not user-friendly message. #4622

Open
hanqyu opened this issue Jun 19, 2024 · 0 comments
Labels
status: waiting-for-triage Issues that we did not analyse yet type: bug

Comments

@hanqyu
Copy link

hanqyu commented Jun 19, 2024

Please do a quick search on Github issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description
If the job parameter given like

param1= ,param2=foo

org.springframework.batch.core.converter.DefaultJobParametersConverter#parseValue fails with ArrayIndexOutOfBoundsException.

Environment
Spring Batch 5.1.0

Steps to reproduce
pass args to the runner like

param1= ,param2=foo

Expected behavior
If the intention is not to allow empty values, the error message should be more user-friendly.
If not, the system should create and bind a JobParameter even for empty values.

Minimal Complete Reproducible example
replacing with attachment of stacktrace

java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at org.springframework.batch.core.converter.DefaultJobParametersConverter.parseValue(DefaultJobParametersConverter.java:172)
	at org.springframework.batch.core.converter.DefaultJobParametersConverter.decode(DefaultJobParametersConverter.java:158)
	at org.springframework.batch.core.converter.DefaultJobParametersConverter.getJobParameters(DefaultJobParametersConverter.java:104)
	at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.launchJobFromProperties(JobLauncherApplicationRunner.java:173)
	at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.run(JobLauncherApplicationRunner.java:169)
	at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.run(JobLauncherApplicationRunner.java:164)

@hanqyu hanqyu added status: waiting-for-triage Issues that we did not analyse yet type: bug labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage Issues that we did not analyse yet type: bug
Projects
None yet
Development

No branches or pull requests

1 participant