I have opened issue ADFFACES-382 and submitted patches as proposed fix (The second patch is my latest version and the first patch is not useful any more).
Here is the description of the issue: In SortableModel class, getRowKey() returns sorted index of the current row. For the same row object, different sorting can change its sorted index and hence change its rowKey. getRowKey() should return base index, because base index of a row object will not be changed by sorting. If we change getRowKey(), we need to change setRowKey() too. Here are the description of my proposed changes: 1. In SortableModel, getRowKey() now returns Integer with base index value (originally it returns string with sorted index value). 2. In SortableModel, setRowKey() accepts Object parameter (originally it accepts String) with base index Integer type value. Other object type will be treated as -1 and error will be logged. 3. The original SortableModel has two lines of code calling new Integer(). They are changed to directly use int. 4. RowKeySetImplTest and RowKeySetTreeImplTest was changed to adapt to the changes above. rowKey type changed to Integer and serialization size limit was increased (due to the rowKey type changed from String to Integer). 5. Removed Integer.valueOf() call, leave the convertion to jdk autoboxing. 6. Added comment to test classes saying the test depends on SortableModel class. Thanks. John Fan
