We're updating the issue view to help you get more done. 

Column not found in Turkish locale because of toLowerCase()

Description

Because of the call to String.toLowerCase() without a locale in TableMetadata.addColumn(ResultSet), the name of a column can be incorrectly set when the default locale is Turkish.

Example:

  • the original column name is "id",

  • in addColumn(ResultSet), the name becomes ıd (note the first character is 'ı' (U+0131) instead of 'i' (U+0069) because of the String.toLowerCase() in line 154),

  • as a result, the construction of the SessionFactory fails with a HibernateException:

    1 org.hibernate.HibernateException: Missing column: id in ELEMENT

Attached is a test case for the problem:

  • test case:

  • ;

  • build file:

  • .

Owing the fix to in 4.2.7, it might be possible to fix the problem by switching the direct call to String.toLowerCase() by StringHelper.toLowerCase(String); i.e. from:

1 2 3 4 if ( getColumnMetadata(column) == null ) { ColumnMetadata info = new ColumnMetadata(rs); columns.put( info.getName().toLowerCase(), info ); }

to:

1 2 3 4 if ( getColumnMetadata(column) == null ) { ColumnMetadata info = new ColumnMetadata(rs); columns.put( StringHelper.toLowerCase(info.getName()), info ); }

Environment

Turkish Locale (tr_TR), HSQLDB 2.2.4

Status

Assignee

Brett Meyer

Reporter

Pierre-Etienne Poirot

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

4.2.7.SP1

Priority

Minor