Use try-with-resources to guarantee closing of JsonReader in .../api/DataSets.java #10033
Labels
D: SonarQubeCleanup
Issues related to cleanup based on Sonar Cube tool
hacktoberfest
It's Hacktoberfest! https://groups.google.com/g/dataverse-community/c/n_Nn_T2yA-w/m/BcoXO4tEAQAJ
Size: 3
A percentage of a sprint. 2.1 hours.
Milestone
What steps does it take to reproduce the issue?
This issue is reported by running static analysis with SonarQube or SonarCloud
There are 7 occurrences of this code:
JsonObject json = Json.createReader(rdr).readObject();
in DataSets.java in the following methods -
public Response updateDraftVersion(...)
private Response processDatasetFieldDataDelete(...)
private Response processDatasetUpdate(...)
public Response createFileEmbargo(...)
public Response removeFileEmbargo(...)
public Response returnToAuthor(...)
public Response completeMPUpload(...)
This can prevent JsonReader objects from properly closing and being Garbage Collected and thus prevent referenced objects from being GCed as well.
The text was updated successfully, but these errors were encountered: