[YANGTOOLS-1224] Data codecs may mis-enforce String length constraints Created: 07/Feb/21  Updated: 24/Feb/21  Resolved: 24/Feb/21

Status: Resolved
Project: yangtools
Component/s: codecs, data-util
Affects Version/s: None
Fix Version/s: 7.0.0, 5.0.9, 6.0.5

Type: Bug Priority: High
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MDSAL-661 Generated enforcers fail to intepret ... Resolved

 Description   

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.


Generated at Wed Feb 07 20:55:32 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.