On Fri, 26 Jun 2026 17:53:06 GMT, Justin Lu <[email protected]> wrote:
> This PR addresses an edge case where the `Locale.LanguageRange(String, > double)` constructor accepts `Double.NaN` as a weight. A `LanguageRange` > weight is specified by > https://datatracker.ietf.org/doc/html/rfc2616#section-3.9 and must be between > 0.0 and 1.0, inclusive. The existing bounds checks do not handle this case. > This change adds an explicit `Double.isNaN(weight)` check. > > The issue does not affect parsed range strings in the same way, since the > input is normalized to lower case before parsing and `"nan"` is not accepted > by `Double.parseDouble`. However, I added a test for that case as well, since > one did not previously exist. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). This pull request has now been integrated. Changeset: 96737cf5 Author: Justin Lu <[email protected]> URL: https://git.openjdk.org/jdk/commit/96737cf5104d3ffc9a4c96e66e132d4b16a79c31 Stats: 29 lines in 3 files changed: 8 ins; 1 del; 20 mod 8387261: Locale.LanguageRange weight validation issues Reviewed-by: naoto ------------- PR: https://git.openjdk.org/jdk/pull/31697
