You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the JVM's default locale is Turkish BeanPropertyRowMapper and deprecated ParameterizedBeanPropertyRowMapper as well, try to initialize themselves by obtaining PropertyDescriptors from given mappedClass, and then process given resultset within mapRow() method by trying to match database column names against identified mapped Fields.
However, PropertyDescriptor name and database column name lowercase conversions with toLowerCase() method cause problems when JVM default locale is Turkish. For example, a field such as item is expected to match with ITEM database column. However, due to column.replaceAll(" ", "").toLowerCase() call in mapRow() method column ITEM is converted into "ıtem" (i without dotted) and it won't match with "item" field. Similarly, "myItem" property is converted into "myıtem" within initialize() method, and it won't match against a database column name like "my_item" which is already lowercase.
Obvious solution for such Turkish character problems is to call toLowerCase() with Locale.US encoding.
As of 4.2, BeanPropertyRowMapper uses the US locale for lower-case conversions by default and also allows for overriding the name adaptation step through protected lowerCaseName and underscoreName template methods.
Kenan Sevindik opened SPR-13216 and commented
When the JVM's default locale is Turkish BeanPropertyRowMapper and deprecated ParameterizedBeanPropertyRowMapper as well, try to initialize themselves by obtaining PropertyDescriptors from given mappedClass, and then process given resultset within mapRow() method by trying to match database column names against identified mapped Fields.
However, PropertyDescriptor name and database column name lowercase conversions with toLowerCase() method cause problems when JVM default locale is Turkish. For example, a field such as item is expected to match with ITEM database column. However, due to column.replaceAll(" ", "").toLowerCase() call in mapRow() method column ITEM is converted into "ıtem" (i without dotted) and it won't match with "item" field. Similarly, "myItem" property is converted into "myıtem" within initialize() method, and it won't match against a database column name like "my_item" which is already lowercase.
Obvious solution for such Turkish character problems is to call toLowerCase() with Locale.US encoding.
Affects: 4.1.7
Issue Links:
Referenced from: commits 41b5858
The text was updated successfully, but these errors were encountered: