Skip to content
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

Use JsonUtil.getJsonObject to prevent resource leaks #9980

Merged
merged 5 commits into from Oct 26, 2023

Conversation

bencomp
Copy link
Contributor

@bencomp bencomp commented Oct 5, 2023

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 StringReaders and/or JsonReaders.

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 NullPointerExceptions. 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 😃

@coveralls
Copy link

coveralls commented Oct 5, 2023

Coverage Status

coverage: 20.044% (+0.006%) from 20.038% when pulling e4d447e on bencomp:fix/jsonutil-objects into 7e0738e on IQSS:develop.

Copy link
Member

@qqmyers qqmyers left a comment

Choose a reason for hiding this comment

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

Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accepted for HF, see https://groups.google.com/g/dataverse-community/c/n_Nn_T2yA-w/m/BcoXO4tEAQAJ Size: 3 A percentage of a sprint. 2.1 hours.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Use try-with-resources to guarantee closing of JsonReader in .../api/DataSets.java
5 participants