On Sat, 4 Sep 2021 01:43:57 GMT, Naoto Sato <[email protected]> wrote:
>> Current implementation looks like this:
>>
>> public byte[] getBytes(String charsetName)
>> throws UnsupportedEncodingException {
>> if (charsetName == null) throw new NullPointerException();
>> return encode(lookupCharset(charsetName), coder(), value);
>> }
>>
>> Null check seems to be redundant here because the same check of
>> `charsetName` is done within `String.lookupCharset(String)`:
>>
>> private static Charset lookupCharset(String csn) throws
>> UnsupportedEncodingException {
>> Objects.requireNonNull(csn);
>> try {
>> return Charset.forName(csn);
>> } catch (UnsupportedCharsetException | IllegalCharsetNameException x) {
>> throw new UnsupportedEncodingException(csn);
>> }
>> }
>
> Looks good. Please add some `noreg` keyword to the JIRA issue.
@naotoj done, added `noreg-cleanup` tag
-------------
PR: https://git.openjdk.java.net/jdk/pull/5361