RFR: 8282279: Interpret case-insensitive string locale independently

Roger Riggs rriggs at openjdk.java.net
Wed Feb 23 14:54:48 UTC 2022


On Wed, 23 Feb 2022 00:05:58 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:

> The String.toUpperCase() or String.toLowerCase() method is locale sensitive, and may produce unexpected results if used for strings that are intended to be interpreted locale independently.  The use of the two methods had been cleaned before, but there are a few new introduced laterly.
> 
> See https://www.ivi.co/java/2011/07/07/4878.html for examples.

Locale.ROOT is preferred for locale independent uppercase and lowercase().

BTW, for the strings written to the SSLLogger, I would have kept the original case intact.
Yes, they are equivalent but it slightly obscures the original data and uses a bit of cpu.

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

Changes requested by rriggs (Reviewer).

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


More information about the security-dev mailing list