Skip to content

MustacheTemplateRenderer doesn't close the reader - #1822

Merged
mhalbritter merged 1 commit into
spring-io:mainfrom
YangSiJun528:mustache-reader-leak
Aug 28, 2026
Merged

mhalbritter merged 1 commit into
spring-io:mainfrom
YangSiJun528:mustache-reader-leak

Conversation

@YangSiJun528

Copy link
Copy Markdown
Contributor

The TemplateLoader contract states that the returned Reader will be closed. MustacheTemplateRenderer currently calls getTemplate and compile separately, leaving it open.

Use Compiler.loadTemplate(String), which performs both operations and closes the reader in a finally block.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 28, 2026
See spring-iogh-1822

Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
@mhalbritter mhalbritter changed the title Close the reader when loading a Mustache template MustacheTemplateRenderer doesn't close the reader Aug 28, 2026
@mhalbritter mhalbritter added type: bug and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 28, 2026
@mhalbritter mhalbritter self-assigned this Aug 28, 2026
@mhalbritter mhalbritter added this to the 0.25.0 milestone Aug 28, 2026
@mhalbritter
mhalbritter force-pushed the mustache-reader-leak branch from 588915e to 460bebf Compare August 28, 2026 08:18
@mhalbritter
mhalbritter merged commit a340d4f into spring-io:main Aug 28, 2026
3 checks passed
@mhalbritter

Copy link
Copy Markdown
Contributor

Thanks @YangSiJun528 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants