8378992: Case folding cache should not look up code point U+0000

Reviewed-by: sherman, rriggs
This commit is contained in:
Naoto Sato 2026-03-04 17:16:32 +00:00
parent 3531c78dea
commit 4d2c537189

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -188,6 +188,12 @@ public final class CaseFolding {
}
private static long getDefined(int cp) {
// Exclude code point U+0000, which is guaranteed to have no
// case-folding mapping.
if (cp == 0) {
return -1;
}
var hashes = CASE_FOLDING_HASHES;
var length = CASE_FOLDING_CPS.length; // hashed based on total defined.
var hash = cp % length;