Skip to content

HtmlUnitRequestBuilder doesn't handle query parameters without equals sign [SPR-13524] #18101

@spring-projects-issues

Description

@spring-projects-issues

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:

Referenced from: commits 283fc94, 61a46db

Metadata

Metadata

Assignees

Labels

in: testIssues in the test moduletype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions