-
Notifications
You must be signed in to change notification settings - Fork 38k
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
Ensure HttpMessageConverter classes don't close the response stream [SPR-10095] #14728
Comments
Rossen Stoyanchev commented It's broken in 3.2 or has it been broken since 3.0.5 (since both versions are in the report)? Can you provide the signature and annotations for the controller method? |
Florian Hackenberger commented It is broken in 3.0.5 (that's what I'm using). I have checked the code from 3.2 and the relevant pieces are still the same, so the bug is present in 3.2 as well. Here is the controller method:
|
Rossen Stoyanchev commented I've added a test project but haven't been able to reproduce the issue: The response is generated without any errors. It would be great if you could help demonstrate it. Thanks. |
Dmytro Polivenok commented In my case response was generated without errors, but only one part of the content is present, for example if we add to map
in response body we will get only
And it causes errors on client side (for example if you try to use MultipartStream from commons-fileupload). You can check it using any rest client. Also it looks like Spring restTemplate doesn't allow to receive MultiValueMap response, but this a different story What is interesting that in Spring MVC test (mockMvc.perform(get("/documents/test")).andReturn().getResponse()) all parts of the response is returned Thanks, |
Rossen Stoyanchev commented Okay thanks for the additional feedback. That helps to confirm the issue. |
Florian Hackenberger opened SPR-10095 and commented
Trying to return a MultiValueMap from a ReSt service method results in an exception when calling writeNewLine on line 253 within writeParts after the first body part. The reason is that all the message converter added in the constructor of FormHttpMessageConverter (e.g. ByteArrayHttpMessageConverter), close the stream, by using the FileCopyUtils.copy method.
Affects: 3.0.5, 3.2 GA
Issue Links:
1 votes, 4 watchers
The text was updated successfully, but these errors were encountered: