dataverse
dataverse copied to clipboard
Use StandardCharsets instead of charset names
What this PR does / why we need it:
This fixes a (potential) resource leak as described in #10053 and it replaces all uses of "utf-8"
, "us-ascii"
and "iso-8859-1"
(mostly in upper case though) to get a charset with StandardCharsets.X
.
The constants in StandardCharsets
are supported on all Java implementations (since its introduction), so using them in String.getBytes(..)
will not throw an UnsupportedEncodingException
. This may simplify the code.
Which issue(s) this PR closes:
Closes #10076 Closes #10053
Special notes for your reviewer: Apologies for mixing these two issues in one PR.
Suggestions on how to test this: See that the test suites pass.
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: Also linked from #10076, Sonarcloud's explanation for using StandardCharsets may be helpful.