ICEfaces
  1. ICEfaces
  2. ICE-5969

Transient fields break with MyFaces 2

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Beta1
    • Fix Version/s: 3.0.RC2, 3.0
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      MyFaces 2 and possibly any of Spring or Portlets.

      Description

      We ran into an issue with MyFaces 2 integration, where MyFaces was doing state saving and restoration of the component tree, several times per lifecycle. When we made the component fields use transient fields, to only hold state throughout a lifecycle, we assumed that state saving only occurred between lifecycles, not throughout them. What happens is that transient state is then lost within the lifecycle, which causes NPE or other problems.

      Apparently, with Spring, they do state saving between every single phase in the lifecycle. Also, in Portlets, the lifecycle is separated into two parts, between which state saving occurs. So this problem may well exist with Spring, and with Portlets, and also with MyFaces 2.

      1. We need to come up with a MyFaces 2 test case, with more than one compat component in it, which uses transient fields, and which is currently broken with MyFaces 2, but not Mojarra 2. ICE-5868 is an umbrella jira for some issues that have already been found with the compat component showcase. So, instead of building a test app from the ground up, it's recommended to leverage a MyFaces build of compat component-showcase.

      2. Once the error has been duplicated, refactor that component to not use transient fields, and instead state save that field. There may be two classes of scenarios (A) straight-forward uses of transient fields, holding primitive data types, where it's just data being cached, and we can refactor the code to handle the caching going away, and regetting the value, or instead having it state saved. (B) complex data type being referenced, which is non-serializable, and cannot be state saved, which maybe is being cached, and can be regotten if null, but might require extensive refactoring. I recommend we start with panelCollapsible ( ICE-5965 ), since it's likely in the easier A scenario.

      3. Retest that component in the test application.

      If this hypothesis turns out correct, of what the problem and solution is, then proceed to text search for the transient keyword in the source code, to find all transient usage in the component code.

        Issue Links

          Activity

          Hide
          Deryk Sinotte added a comment -

          Linking to umbrella MyFaces 2 Compatibility JIRA.

          Show
          Deryk Sinotte added a comment - Linking to umbrella MyFaces 2 Compatibility JIRA.
          Hide
          Deryk Sinotte added a comment -

          Assigning back to Ken for further investigation by the component team.

          At this point, the Compat Component Showcase pretty much works the same with MyFaces as it does with Mojarra. The state saving and serialization issues have been tackled from both core and component perspectives as required.

          A search for the use of "transient" keyword in the compat components does show it is used quite extensively, however. So while everything appears to work, the component team may need to audit the use transient to endure that it has been properly applied in all cases as per Mark's final comment in the original description.

          Show
          Deryk Sinotte added a comment - Assigning back to Ken for further investigation by the component team. At this point, the Compat Component Showcase pretty much works the same with MyFaces as it does with Mojarra. The state saving and serialization issues have been tackled from both core and component perspectives as required. A search for the use of "transient" keyword in the compat components does show it is used quite extensively, however. So while everything appears to work, the component team may need to audit the use transient to endure that it has been properly applied in all cases as per Mark's final comment in the original description.
          Hide
          Ken Fyten added a comment -

          Resolving this issue based on positive results using MyFaces with regression tests and samples tests.

          Show
          Ken Fyten added a comment - Resolving this issue based on positive results using MyFaces with regression tests and samples tests.

            People

            • Assignee:
              Ken Fyten
              Reporter:
              Mark Collette
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: