-
Notifications
You must be signed in to change notification settings - Fork 26.5k
fix: Fix the issue of triple bzip2 compressor close ByteArrayOutputStream #15356
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
base: 3.3
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 3.3 #15356 +/- ##
============================================
- Coverage 60.77% 60.74% -0.03%
+ Complexity 10920 10913 -7
============================================
Files 1886 1886
Lines 86122 86144 +22
Branches 12902 12906 +4
============================================
- Hits 52337 52331 -6
- Misses 28331 28350 +19
- Partials 5454 5463 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
BZip2CompressorOutputStream cos; | ||
try { | ||
cos = new BZip2CompressorOutputStream(out); | ||
try (BZip2CompressorOutputStream cos = new BZip2CompressorOutputStream(out)) { |
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.
'Out' should also be fixed.
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.
As a FilterOutputStream, the underlying output stream should be closed together with it.
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.
commons-io ByteArrayOutputStream directly operates on memory, not network IO, and does not manipulate file handles, it's close() method is also an empty implementation, and it is not necessary to close。Just like a regular Java object.
org.apache.commons.io.output.ByteArrayOutputStream#close:
public void close() throws IOException {
}
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.
So I think we needn't do any change.
fix issue #15355
What is the purpose of the change?
Correctly close BZip2CompressorOutputStream using try with sources
Checklist