Skip to content

BeanPropertyRowMapper should always call toLowerCase with US encoding [SPR-13216] #17807

Closed
@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions