Skip to content
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

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

Closed
spring-issuemaster opened this issue Jul 10, 2015 · 1 comment
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster 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:

  • #21476 The BeanPropertyRowMapper does not work for field names ending with "numbers" which worked for 3.1
  • #18461 BeanPropertyRowMapper should use ConversionService for date-time support

Referenced from: commits 41b5858

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 13, 2015

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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.