JDK-8276137 : Release Note: Charset.forName() Taking fallback Default Value
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.nio.charsets
  • Affected Version: 18
  • Priority: P4
  • Status: Closed
  • Resolution: Delivered
  • OS: generic
  • CPU: generic
  • Submitted: 2021-10-28
  • Updated: 2022-03-24
  • Resolved: 2022-02-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 18
18Resolved
Description
A new method `Charset.forName()` that takes `fallback` charset object has been introduced in `java.nio.charset` package. The new method returns `fallback` if `charsetName` is illegal or the charset object is not available for the name. If `fallback` is passed as `null` the caller can check if the named charset was available without having to catch the exceptions thrown by the `Charset.forName(name)` method.