I have run into an issue when sorting my data grids by Category in Cuba version 6.7.9. I’ve tracked the issue down to the getSortPropertiesForPersistentAttribute method in the AbstractCollectionDatasource.java file (com.haulmont.cuba.gui.data.impl).
The issue seems to be related to the LocaleName property of the Category record. Looking at my database the Locale_Name field is null for all of my Category records. Manually setting this field in the database did not seem to have an effect. I’ve included a screen shot of my debugging window below:
For some reason this only seems to happen when I have a large number of records in my data grid.
Any help is appreciated. Thank you,
Could you describe steps to reproduce the problem or attach a sample project?
The only steps are to create a browse screen consisting of a group table containing a column for the category field. Create some test data and sort the grid by the Category column.
I’ve noticed that when only a few records exist I do not experience this issue because the DataServiceQueryBuilder located in the com.haulmont.cuba.core.app package is never invoked. I would guess this is because all of the data is present in the one page and no new query is necessary. However when there is enough data that the grid is paged and the DataServiceQueryBuilder is invoked this in turn invokes the getSortPropertiesForPersistentAttribute which seems to have trouble building the sort properties for the Category.
The code here:
sortProperties = properties.stream()
.filter(metaProperty -> metadata.getTools().isPersistent(metaProperty))
.map(propName -> propertyPath.toString().concat(".").concat(propName))
causes the java.lang.IndexOutOfBounds.Exception shown in my screen shot above.
We reproduced this problem. Yes, it seems that something wrong with the
localeName field. We have created an issue in our GitHub repository. See the link.