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

@RequestParam throws java.lang.NullPointerException: The mapper returned a null value. [SPR-17050] #21588

Closed
spring-projects-issues opened this issue Jul 17, 2018 · 1 comment
Assignees
Labels
in: web type: bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jul 17, 2018

Kamil Bar opened SPR-17050 and commented

The reactive controller method with request parameter fails with 

java.lang.NullPointerException: The mapper returned a null value.

and returns HTTP 500 instead of the HTTP 400 with some conversion error message when called with empty parameter value, i.e. 

integer?parameter=

or

boolean?parameter=

 

I've pushed sample project using spring-boot 2.0.3.RELEASE with failing JUnit 5 tests for integer and boolean types of parameter and one successful test with string type parameter.

I've posted this bug also on spring-boot issue tracker spring-projects/spring-boot#13786 but was redirected here.


Affects: 5.0.7

Reference URL: https://github.com/NeveHanter/spring_boot_request_param_bug

3 votes, 3 watchers

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jul 18, 2018

Brian Clozel commented

NeveHanter,

Thanks a lot for this issue and the repro case (this is always very useful and it's worth many comments).

I've just pushed a fix which should be available shortly with Spring Framework 5.0.8 and 5.1.0 snapshots (i.e. Spring Boot 2.0.4 and 2.1.0 snapshots).

Note that in your sample, not providing a @RequestParam annotation on the arguments is the equivalent of not requiring the request param - in that case, the handler won't respond with a HTTP 400, but a 200 OK.

I've added the @RequestParam annotation on the various parameters and tested your sample with Spring Boot 2.1.0 and things are working as expected.

@spring-projects-issues spring-projects-issues added type: bug in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.0.8 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web type: bug
Projects
None yet
Development

No branches or pull requests

2 participants