Skip to content

Document InputStream ownership#1361

Merged
mkurz merged 1 commit into
playframework:mainfrom
mkurz:document-input-stream-ownership
Jul 15, 2026
Merged

Document InputStream ownership#1361
mkurz merged 1 commit into
playframework:mainfrom
mkurz:document-input-stream-ownership

Conversation

@mkurz

@mkurz mkurz commented Jul 15, 2026

Copy link
Copy Markdown
Member

Document that Json.parse(InputStream) and Json.tryParse(InputStream) close the supplied stream, including when parsing fails.

Add close-tracking JVM tests covering successful and failed parsing.

Background Context

#1277 lets Jackson create the parser internally. Jackson closes that parser after every outcome and, with its default configuration, also closes the underlying input stream.

The previous test used ByteArrayInputStream, whose close() method has no observable effect. A close-tracking stream now verifies the documented lifecycle explicitly.

This also aligns the documented JVM behavior with the existing Scala.js and Scala Native implementations.

Clarify that JSON parsing closes input streams.

Test closure after successful and failed parsing.
@mkurz
mkurz merged commit e60fdbc into playframework:main Jul 15, 2026
15 checks passed
@mkurz
mkurz deleted the document-input-stream-ownership branch July 15, 2026 09:52
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.

1 participant