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

Closed
hanqyu opened this issue Jun 19, 2024 · 1 comment
Labels
status: duplicate Issues that are duplicates of other issues

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
@GGHDMS
Copy link

GGHDMS commented Oct 27, 2024

This issue seems to be the same as #4505 and appears to have been resolved with commit d8d76ab, so it should be okay to close this.

@fmbenhassine fmbenhassine closed this as not planned Won't fix, can't repro, duplicate, stale Oct 28, 2024
@fmbenhassine fmbenhassine added status: duplicate Issues that are duplicates of other issues and removed status: waiting-for-triage Issues that we did not analyse yet type: bug labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate Issues that are duplicates of other issues
Projects
None yet
Development

No branches or pull requests

3 participants