preserveDataModel=true throws ClassCastException (with Trinidad)
----------------------------------------------------------------

                 Key: TOMAHAWK-1035
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1035
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: Extended Datatable
         Environment: jboss-4.2.0.GA, windows XP
            Reporter: Leonardo Uribe


When you have a datatable with preserveDataModel=true, it throws 
ClassClastException when you use commandSortHeader and try to sort
the data (click it twice).

I believe that the problem is that trinidad use a cache mechanism in its 
StateManager implementation. When you load first, it works well, but
when I click the sort header, throws the error, In the navigator, if I click 
back, and try again the error is not thrown.

The component assume that the method restoreState is called(and the Serialized 
model is restored) when there is a request, but this is not 
true for trinidad StateManager Impl (If the tree exists trinidad takes it). 

Solution: instead this line in method saveState of class 
org.apache.myfaces.component.html.ext.HtmlDataTable
        
        if (isPreserveDataModel())
        {
               values[2] = saveAttachedState(context, 
getSerializableDataModel());
        }

add these lines

        if (isPreserveDataModel())
        {
                _preservedDataModel = getSerializableDataModel();
            values[2] = saveAttachedState(context, _preservedDataModel);
        }

It's the same but note that when the method getDataModel() is called again, it 
checks _preservedDataModel, and
the model is restored. 

I have probe this with and without trinidad (using myfaces tomahawk examples 
simple project) and works 
without problems

I found a similar issue to this in TOMAHAWK-241, but in this issue I have not 
found anything about the environment
when the error is thrown.





-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to