Skip to content

Close BufferedReader in addProtocolLines#2981

Merged
chibenwa merged 1 commit into
apache:masterfrom
tejasae-afk:fix/close-bufferedreader-in-addpro
Mar 23, 2026
Merged

Close BufferedReader in addProtocolLines#2981
chibenwa merged 1 commit into
apache:masterfrom
tejasae-afk:fix/close-bufferedreader-in-addpro

Conversation

@tejasae-afk
Copy link
Copy Markdown
Contributor

Was reading through mpt/core/src/main/java/org/apache/james/mpt/protocol/ProtocolSessionBuilder.java and the resource opened there can leak if addProtocolLines exits on an error path. this patch moves the allocation into try-with-resources so cleanup happens on every exit path. Not sure if this is intentional, so feel free to ignore.

Happy to revise the approach or close this if it doesn’t fit — you know the codebase far better than I do.

Copy link
Copy Markdown
Contributor

@chibenwa chibenwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

Don t hesitate if you have other enhancements.

Best regards

Benoit

@chibenwa chibenwa merged commit fec352e into apache:master Mar 23, 2026
1 check passed
@tejasae-afk
Copy link
Copy Markdown
Contributor Author

Thanks!

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