You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@RequestMapping(method = { POST, GET }, value = "/myFiles/{fileId}/filterFiles")
publicList<FileDto> findFilterFiles(
@PathVariable("fileId") finalLongfileId,
@RequestParam(name = "fileType") finalLongfileType,
@RequestBody(required = false) finalFileFilterDtofilter) { … }
In Spring 2.6.4, it used to work. Now, I've tried upgrading to 2.7.4, and it does not work anymore. I've tracked the issue down, and it seems like the required request parameter must not be null anymore.
I'm getting a null pointer exception with text like this: Illegal character in query at index 93: http://localhost:8080/files/10013/filterFiles?fileType={fileType}
with the index pointing to '=' of fileType={fileType} .
Is it a bug? If yes - how can I fix it? Passing a constant number fixes the null-pointer exception:
The text was updated successfully, but these errors were encountered:
csigmanek
changed the title
Links with variable parameters cannot be created
RepresentationModelProcessor nullpointer having mandatory field in controller spring 2.7.4
Nov 11, 2022
The exception you show here seems to indicate that some code is trying to turn that String into a URI, which won't work as the curly braces demarcating the template variables are not valid characters in a URI. You will need to properly expand the URI template by providing a value for fileType to end up with a valid URI. Note that you won't be able to expand the template without a value for fileType as your controller method declares the parameter required which renders the template variable in non-optional syntax (?fileType} would be the optional one, but you'd have to set the required attribute on @RequestParam to false or turn the parameter type into an Optional<Long>.
Hello,
I have a ResourceProcessor that's adding links to a resource:
The controller looks like this:
In Spring 2.6.4, it used to work. Now, I've tried upgrading to 2.7.4, and it does not work anymore. I've tracked the issue down, and it seems like the required request parameter must not be null anymore.
I'm getting a null pointer exception with text like this:
Illegal character in query at index 93: http://localhost:8080/files/10013/filterFiles?fileType={fileType}
with the index pointing to '=' of
fileType={fileType}
.Is it a bug? If yes - how can I fix it? Passing a constant number fixes the null-pointer exception:
but it leads to incorrect code.
The text was updated successfully, but these errors were encountered: