-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
Milestone
Description
Christopher Smith opened SPR-13524 and commented
Blank request parameters are used occasionally to conditionally turn on messages inside templates. For example, Spring Security uses /login?error
to indicate that a username/password pair was incorrect. However, HtmlUnitRequestBuilder
currently attempts to decode null
values for query parameters which results in a NullPointerException
. See the following stack trace for details.
Caused by: java.lang.NullPointerException
at java.net.URLDecoder.decode(URLDecoder.java:136)
at org.springframework.test.web.servlet.htmlunit.HtmlUnitRequestBuilder.params(HtmlUnitRequestBuilder.java:365)
at org.springframework.test.web.servlet.htmlunit.HtmlUnitRequestBuilder.buildRequest(HtmlUnitRequestBuilder.java:121)
at org.springframework.test.web.servlet.MockMvc.perform(MockMvc.java:140)
at org.springframework.test.web.servlet.htmlunit.MockMvcWebConnection.getResponse(MockMvcWebConnection.java:122)
Adding an equals sign with no content prevents the exception but shouldn't be required, especially since other Spring components generate redirects with this form.
Affects: 4.2 GA
Issue Links:
- UriComponentsBuilder interprets empty request parameters as null [SPR-13537] #18113 UriComponentsBuilder interprets empty request parameters as null