RFC7950 states that:
A "length" statement restricts the number of Unicode characters in the string.
This is distinct diffrent what java.lang.String.length() provides:
Returns the length of this string. The length is equal to the number of Unicode code units in the string.
with the following (from java.lang.Character):
In the Java SE API documentation, Unicode code point is used for character values in the range between U+0000 and U+10FFFF, and Unicode code unit is used for 16-bit char values that are code units of the UTF-16 encoding.
We should not be checking the String.length(), but rather String.codePointCount(). Audit all enforcement points for correct checks.
- relates to
-
MDSAL-661 Generated enforcers fail to intepret length restriction
- Resolved