[hibernate-dev] Memory consumption

Andrej Golovnin golovnin at gmx.net
Wed May 16 16:32:14 EDT 2012


Hi Hardy,

>> 1. Consider avoiding usage of String#toLowerCase() and String#toUpperCase()
>>   without specifying a Locale. Users running Hibernate on systems with Turkish as default
>>   locale may see unexpected results. In Turkish there are two lowercase letters 
>>   \u0069 ‘i’ and \u0131 ‘ı’ (dotless ‘I’). And they are totally unrelated. Their uppercase
>>   versions are \u0130 ‘İ’ (capital letter ‘I’ with dot above it) and \u0049 ‘I’.
>>   So if you convert \u0049 ‘I’ to lower case and the system uses Turkish as default
>>   locale, you will get \u0131 ‘ı’ (dotless ‘I’) and not 'i', e.g. 'MY_COLUMN_I' would be converted
>>   to 'my_column_ı' and not 'my_column_i'. If you run Hibernate tests with Turkish as default locale
>>   some tests fail. I have for now no idea, what locale should be used instead of the default
>>   one. :-(
> 
> I am not sure whether this is a problem in Hibernate as such. A lot of tests are just written without
> Locale in mind. They just makes assertions based on English. Obviously the tests could be written
> more carefully in this respect. Or do you think there is an actual bug in the runtime code caused
> by using the default Locale?

Please take look at InterbaseDialect#getDropSequenceString(String) line 79.
If the sequence name contains the lowercase letter ‘i’ and you have Turkish as default
locale, the upper case version of the sequence name would contain ‘İ’ (capital letter ‘I’
with dot above it). And now the question is, what letter was used to create the sequence
in the database. If it was ‘İ’, it is OK. But if it was 'I', you will see an error message, when
the statement is executed. I personally don't think, that someone would use non ASCII
letters for names of database objects. But who knows.

Best regards,
Andrej Golovnin





More information about the hibernate-dev mailing list