Uploaded image for project: 'Hibernate ORM'
  1. HHH-8765

Column not found in Turkish locale because of toLowerCase()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.2.7.SP1
    • Fix Version/s: 4.2.9, 4.3.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Turkish Locale (tr_TR), HSQLDB 2.2.4
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      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:
        org.hibernate.HibernateException: Missing column: id in ELEMENT
        

      Attached is a test case for the problem:

      Owing the fix to HHH-8579 Closed 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:

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

      to:

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

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: