-
Type:
Sub-task
-
Resolution: Withdrawn
-
Priority:
P4
-
None
-
Affects Version/s: 26
-
Component/s: core-libs
A behavioral change to the duplicate value handling of `Locale.Builder` has been introduced.
`Locale.Builder.setExtension(char, String)` and `Locale.Builder.setLanguageTag(String)` now throw `llformedLocaleException` when passed a duplicate extension singleton, U Extension keyword, or U Extension attribute. Previously, they used to accept and silently ignore duplicates. This behavioral change is made so that the strict `Locale.Builder` better aligns with [RFC 5646: Tags for Identifying Languages](https://www.rfc-editor.org/info/rfc5646) and [RFC 6067: BCP 47 Extension U](https://www.rfc-editor.org/info/rfc6067) which convey that the aforementioned duplicates do not carry meaning.
As a workaround, users who require the previous behavior may use the more lenient `Locale.forLanguageTag(String)`, which accepts duplicates.
`Locale.Builder.setExtension(char, String)` and `Locale.Builder.setLanguageTag(String)` now throw `llformedLocaleException` when passed a duplicate extension singleton, U Extension keyword, or U Extension attribute. Previously, they used to accept and silently ignore duplicates. This behavioral change is made so that the strict `Locale.Builder` better aligns with [RFC 5646: Tags for Identifying Languages](https://www.rfc-editor.org/info/rfc5646) and [RFC 6067: BCP 47 Extension U](https://www.rfc-editor.org/info/rfc6067) which convey that the aforementioned duplicates do not carry meaning.
As a workaround, users who require the previous behavior may use the more lenient `Locale.forLanguageTag(String)`, which accepts duplicates.