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

Conversion not applied to @RequestParam default value if used for "null after conversion" case #31336

Closed
martin-mfg opened this issue Sep 29, 2023 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@martin-mfg
Copy link

martin-mfg commented Sep 29, 2023

Affects: 6.0.12 and older versions


When specifying a defaultValue for a request parameter, my understanding is that the request parameter should never be null. However, providing e.g. a whitespace character (%20) for a Boolean parameter results in a null value.

I've created a small reproducible example here.

When using the latest Spring version 6.1.0-M5, I don't get a null value anymore. Instead, Spring returns an HTTP status code 500. While this behaviour is different, I think it's still not what should happen. I would expect a status code 400 - or maybe a 200 with the Boolean parameter set to its default value.

I also found this similar issue from 2013: #14813

Looking forward to a fix :)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 29, 2023
@rstoyanchev rstoyanchev self-assigned this Oct 20, 2023
@rstoyanchev
Copy link
Contributor

There was a fix for this in #29550, and the default value is used but we need to apply conversion still on the default value.

@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 20, 2023
@rstoyanchev rstoyanchev added this to the 6.1.0-RC2 milestone Oct 20, 2023
@rstoyanchev rstoyanchev changed the title whitespace input for Boolean/Float/... request parameters handled unexpectedly Conversion not applied to default value if used for null after conversion case Oct 20, 2023
@rstoyanchev rstoyanchev changed the title Conversion not applied to default value if used for null after conversion case Conversion not applied to default value if used for "null after conversion" case Oct 20, 2023
@rstoyanchev rstoyanchev changed the title Conversion not applied to default value if used for "null after conversion" case Conversion not applied to @RequestParam default value if used for "null after conversion" case Oct 20, 2023
@sbrannen sbrannen changed the title Conversion not applied to @RequestParam default value if used for "null after conversion" case Conversion not applied to @RequestParam default value if used for "null after conversion" case Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants