Use JsonUtil.getJsonObject to prevent resource leaks #9980
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
This is more or less a follow-up to #9923 and #9320, fixing additional instances of potentially unclosed
StringReader
s and/orJsonReader
s.Which issue(s) this PR closes:
Closes #10033
None; I did not create a separate issue for these files. They would have been copies of #9314.Special notes for your reviewer:
#9314 includes the context for the problem.
I added new TODOs, because the flow of the code (before and after these changes) may cause
NullPointerException
s. I have asked others not to do this in PRs, but I needed to get out of the rabbit hole. I may open a separate issue pointing to the TODOs and refer back to this PR.Suggestions on how to test this:
The same way as #9923.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
No
Is there a release notes update needed for this change?:
No
Additional documentation:
https://sonarcloud.io/organizations/bencomp/rules?open=java%3AS2095&rule_key=java%3AS2095 is the SonarCloud rule that triggered me to start this PR. I look forward to seeing #9846 resolved 😃