ServletServerHttpRequest.getURI() may throw a java.net.URISyntaxException [SPR-16414] #20960
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Oliver Becker opened SPR-16414 and commented
We just encountered an error in our Spring Boot application that came from the innocent looking call
which uses internally
The URL of this request was indeed illegal since it had an illegal escape sequence in its query part, something like
http://app.org/request?query=foo%
orhttp://app.org/request?query=foo%xx
. Typing this URL into a browser will cause normal request processing (the controller will handle thequery
parameter as not present, the corresponding@RequestParam
is null), however using theServletUriComponentsBuilder
as mentioned above will cause ajava.net.URISyntaxException
. (In our case this exception occurred during the rendering of the view, which is even worse.)I wonder if the framework (i.e.
ServletUriComponentsBuilder
orServletUriComponentsBuilder
) should handle this illegal URI. Or is it the job of the application using the framework? Either way, the user shouldn't see an error 500.Affects: 4.3.13
Referenced from: commits 0e6f8df, 04f9549
Backported to: 4.3.15
The text was updated successfully, but these errors were encountered: