Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Jul 10, 2015 · 1 comment
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 10, 2015

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

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

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.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants