-
Notifications
You must be signed in to change notification settings - Fork 38
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
Close IO streams after the plugin has finished reading and writing #126
Conversation
FileWriter writer = null | ||
|
||
try { | ||
writer = new FileWriter(manifestPath) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
ah I see 👍
} catch (Exception e) { | ||
project.logger.warn("Failed to write Bugsnag ProGuard settings", e) | ||
} finally { | ||
fr.close() |
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.
Shouldn't there be a null check here, in case the writer was not initialized?
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.
Good catch, I've updated this to include a null check.
Should we also close this reader https://github.com/bugsnag/bugsnag-android-gradle-plugin/pull/126/files#diff-ff274d12fbfb73a5d6888d7dc318c167R72 |
Thanks, good catch! I've updated the PR to close the additional reader. |
Goal
Closes IO streams after the plugin has finished reading and writing, in a
finally
block, which is guaranteed to be executed last.Changeset
Closeable
values so thatclose
is called in a try-finally block.Tests
Ran mazerunner scenarios.
Review
For the submitter, initial self-review:
For the pull request reviewer(s), this changeset has been reviewed for: