Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-1035

preserveDataModel=true throws ClassCastException (with Trinidad)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.1.7
    • Extended Datatable
    • None
    • jboss-4.2.0.GA, windows XP

    Description

      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.

      Attachments

        1. patch3.patch
          0.6 kB
          Leonardo Uribe

        Activity

          People

            grantsmith Grant Smith
            lu4242 Leonardo Uribe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: