On Thu, 21 Oct 2021 16:06:31 GMT, Ichiroh Takiguchi <itakigu...@openjdk.org> 
wrote:

> I'd like to write down following code without `try-catch`.

You don't *have to* try-catch those exceptions if you are not interested, as 
they are subclasses of `RuntimeException`.

> ```
> var cs = Charset.forName(charsetName, null);
> if (cs == null) cs = StandardCharsets.UTF_8;
> ```

This could be simplified to


var cs = Charset.forName(charsetName, StandardCharsets.UTF_8);

-------------

PR: https://git.openjdk.java.net/jdk/pull/6045

Reply via email to