-
-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No longer close OutputStream that is passed into JsonSerializer #2029
Conversation
Codecov Report
@@ Coverage Diff @@
## 6.x.x #2029 +/- ##
=========================================
Coverage 80.79% 80.80%
- Complexity 3146 3147 +1
=========================================
Files 228 228
Lines 11645 11645
Branches 1565 1565
=========================================
+ Hits 9409 9410 +1
+ Misses 1649 1648 -1
Partials 587 587
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Just one idea maybe - not sure if it'd make sense to introduce another method overload, which accepts a boolean like autoClose
? Probably not needed though
} | ||
writer.flush(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be likely in the finally
block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only moved the code around. There's a catch block that only logs but doesn't throw out right before though.
I think that this is actually needed, since the streams will be open or will wait to be GCed, we could rather make it closable by default, and the |
I've checked the usages of this method - basically everywhere we use try-with-resources around it, so we are safe internally. But yeah, if we expose this to the consumers, this may come as a surprise. |
We also don't have an option to close the writer that is passed into Also the |
@marandaneto @romtsn do you still want me to implement a flag for autoClose after my explanation above? |
I'm good without it, since the |
📜 Description
No longer (auto) close the
OutputStream
that is passed intoJsonSerializer
. This caused problems when passing inSystem.out
fromStdoutTransport
as it closed the stream.💡 Motivation and Context
Fixes #2027 for
6.x
💚 How did you test it?
📝 Checklist
🔮 Next steps