jakartaee / jakartaee/rest

Auto-closing InputStream in Response.readEntity can break the client code reading DOM Document or JAXP Source

Open
#429 6 comments 0 reactions 0 assignees View on GitHub
Component: model api
Dominant language
Java
Stars
400
Forks
143
PR merge metrics
No merged PRs in 30d

Description

Hi, after we implemented an auto-closing of InputStream in Response.readEntity we started seeing random failures. For example, CXF tests where we had Response.readEntity(StreamSource.class) was passing OK on two branches but was failing on the 3rd one. One DOM-based tests started failing as well.
Took a bit of time to figure out it was to do with closing the stream too early in those cases.

Proposal: either completely disallow the auto-closing of InputStream or make it conditional (example, based on some property, etc)
#### Affected Versions
[2.0]

Contributor guide

Open the contributing guide

Research direction

Start with the Response.readEntity behavior that closes the InputStream, then reproduce the reported StreamSource and DOM-based failures from the CXF tests. Determine whether the supported fix is to remove or conditionally control auto-closing; done means those entity reads no longer fail under the chosen policy and regression coverage is added.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.