Skip to content
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

Deprecate StreamUtils.emptyInput() #29125

Closed
bclozel opened this issue Sep 9, 2022 · 0 comments
Closed

Deprecate StreamUtils.emptyInput() #29125

bclozel opened this issue Sep 9, 2022 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Sep 9, 2022

Since #28961 and since Spring Framework 6.0 requires Java 17, it doesn't make much sense to maintain this method. This should be deprecated in favor of InputStream.nullInputStream().

@bclozel bclozel added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Sep 9, 2022
@bclozel bclozel added this to the 6.0.0-M6 milestone Sep 9, 2022
@bclozel bclozel self-assigned this Sep 9, 2022
christophstrobl pushed a commit to spring-projects/spring-data-mongodb that referenced this issue Sep 14, 2022
As of spring-projects/spring-framework#29125,
`StreamUtils..emptyInput()` is deprecated in favor of
`InputStream.nullInputStream()` from the JDK.

Closes: #4160
bclozel added a commit that referenced this issue Jan 31, 2023
Prior to this commit, a recent change applied in gh-29125 changed the
behavior of `MockHttpServletRequest` instances. In case of an empty
request body, the returned `InputStream` would be static and could not
be reused across requests.
This could result in `java.io.IOException: Stream closed` exceptions if
a previous request was read.

This commit ensures that a new instance of an empty stream is returned
for each request instance.

Fixes gh-29901
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant