Skip to content

Do not close passed-in Writer (#604)#662

Merged
Verdent merged 1 commit intoeclipse-ee4j:masterfrom
greek1979:keep-writers-open
Mar 13, 2025
Merged

Do not close passed-in Writer (#604)#662
Verdent merged 1 commit intoeclipse-ee4j:masterfrom
greek1979:keep-writers-open

Conversation

@greek1979
Copy link
Copy Markdown
Contributor

Do not close the Writer resources that has been supplied to the JsonBinding methods by the caller. Let the latter manage the lifecycle of the output writer. This prevents java.io.IOException: Stream closed errors with Spring Native and Spring Boot when generating a JSON response from an HTTP method, for example, as Spring assumes the JSON-B implementation serializes the passed in POJO into JSON, writes it to a supplied Writer but does not close it yet. Flushing the output is perfectly fine and is acceptable, of course.

See #604 for details of the regression introduced in Yasson 3.0.3 and #389 for the description of the original bug.

@greek1979 greek1979 force-pushed the keep-writers-open branch 2 times, most recently from 860bd27 to 5688945 Compare February 12, 2025 10:56
@Verdent
Copy link
Copy Markdown
Member

Verdent commented Mar 13, 2025

Thank you for your contribution! It looks good.

@Verdent Verdent merged commit 9e9f43f into eclipse-ee4j:master Mar 13, 2025
3 checks passed
@greek1979 greek1979 deleted the keep-writers-open branch March 17, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants