MyFaces Core
  1. MyFaces Core
  2. MYFACES-3200

All values of self-defined composite-component attributes disappear unexpected.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.2-SNAPSHOT
    • Fix Version/s: 2.0.8, 2.1.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Java 6, Tomcat 6, latest SNAPSHOT of myfaces-2.1.2 (30.06.2011)

      Description

      A testcase to reproduce this issue is attached.

      Steps to reproduce this issue:

      1. http://localhost:8080/jsf2testcase/components.jsf
      2. you can see the value of one of the attributes of the self-defined composite component at 'Panel1'
      2. click 'Panel2'
      3. click 'Panel1'
      4. value at 'Panel1' is not shown anymore. (if you refresh the page with 'F5' after that, the value is there again)

      Note:
      This behaviour occurs with the latest myfaces-2.1.2-SNAPSHOT (30.06.2011)
      With an older version of myfaces-2.1.2-SNAPSHOT (22.06.2011) and with myfaces-2.1.1 everything works as expected.

      1. jsftest.war
        3.64 MB
        Rene O
      2. jsf2testcasewithoutrichfaces.war
        3.29 MB
        Rene O
      3. jsf2testcase.war
        6.36 MB
        Rene O

        Activity

        Hide
        Rene O added a comment -

        Now everything works as excpected. Thanks for fixing this so fast.

        Show
        Rene O added a comment - Now everything works as excpected. Thanks for fixing this so fast.
        Hide
        Leonardo Uribe added a comment -

        I checked it again and it is true. Some days ago we did a fix over PostAddToViewEvent publishing code that call pushComponentToEL. The effect of this code is call UIComponent.isCompositeComponent(), that call getAttributes().containsKey(), but since only the tree structure is being restored, it returns false. The solution is be sure the events can be propagates before publish/traverse and add another var that checks if the composite component has been set, to ensure this is called after the component is completely restored. Now it works, but please feel free to reopen it as many times as necessary until get this one solved.

        Show
        Leonardo Uribe added a comment - I checked it again and it is true. Some days ago we did a fix over PostAddToViewEvent publishing code that call pushComponentToEL. The effect of this code is call UIComponent.isCompositeComponent(), that call getAttributes().containsKey(), but since only the tree structure is being restored, it returns false. The solution is be sure the events can be propagates before publish/traverse and add another var that checks if the composite component has been set, to ensure this is called after the component is completely restored. Now it works, but please feel free to reopen it as many times as necessary until get this one solved.
        Hide
        Rene O added a comment -

        The issue is still not solved entirely.
        With "javax.faces.PARTIAL_STATE_SAVING" set to "false" in web.xml, the value still disappear (the only good thing is, that there are no further exceptions like in my comment before). Only with the parameter set to "true" it will now work as expected.
        But with myfaces-2.1.1 it works in both cases.

        Show
        Rene O added a comment - The issue is still not solved entirely. With "javax.faces.PARTIAL_STATE_SAVING" set to "false" in web.xml, the value still disappear (the only good thing is, that there are no further exceptions like in my comment before). Only with the parameter set to "true" it will now work as expected. But with myfaces-2.1.1 it works in both cases.
        Hide
        Rene O added a comment -

        The fix raises a new issue:
        If you expicit define
        <context-param>
        <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
        <param-value>false</param-value>
        </context-param>
        in web.xml an exception occurs if you use the ajax-button:
        01.07.2011 11:59:15 org.apache.myfaces.renderkit.ServerSideStateCacheImpl deserializeView
        SCHWERWIEGEND: Exiting deserializeView - Could not deserialize state: org.apache.myfaces.view.facelets.el.LocationValueExpressionUEL; org.apache.myfaces.view.facelets.el.LocationValueExpressionUEL; no valid constructor
        java.io.InvalidClassException: org.apache.myfaces.view.facelets.el.LocationValueExpressionUEL; org.apache.myfaces.view.facelets.el.LocationValueExpressionUEL; no valid constructor
        ...

        A new testcase with the todays (01.07.2011) SNAPSHOT of myfaces is attached.
        http://localhost:8080/jsftest/test.jsf

        Show
        Rene O added a comment - The fix raises a new issue: If you expicit define <context-param> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name> <param-value>false</param-value> </context-param> in web.xml an exception occurs if you use the ajax-button: 01.07.2011 11:59:15 org.apache.myfaces.renderkit.ServerSideStateCacheImpl deserializeView SCHWERWIEGEND: Exiting deserializeView - Could not deserialize state: org.apache.myfaces.view.facelets.el.LocationValueExpressionUEL; org.apache.myfaces.view.facelets.el.LocationValueExpressionUEL; no valid constructor java.io.InvalidClassException: org.apache.myfaces.view.facelets.el.LocationValueExpressionUEL; org.apache.myfaces.view.facelets.el.LocationValueExpressionUEL; no valid constructor ... A new testcase with the todays (01.07.2011) SNAPSHOT of myfaces is attached. http://localhost:8080/jsftest/test.jsf
        Hide
        Leonardo Uribe added a comment - - edited

        Thanks for the example. It helped a lot to find out the problem

        To reproduce it properly it is necessary to set this param:

        <context-param>
        <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
        <param-value>-1</param-value>
        </context-param>

        and PSS should be disabled.

        There are two small bugs:

        1. We don't enable PSS when faces-config version is 2.1, only when 2.0 is set. We need to add that check too.

        2. There are some wrappers for ValueExpression/MethodExpression that requires to implement Externalizable, to be saved and restored correctly.

        The good news are if you add this on your web.xml:

        <context-param>
        <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
        <param-value>true</param-value>
        </context-param>

        PSS will be enabled and everything will work well. Thanks a lot for the examples, they were very useful solving this issue.

        Show
        Leonardo Uribe added a comment - - edited Thanks for the example. It helped a lot to find out the problem To reproduce it properly it is necessary to set this param: <context-param> <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name> <param-value>-1</param-value> </context-param> and PSS should be disabled. There are two small bugs: 1. We don't enable PSS when faces-config version is 2.1, only when 2.0 is set. We need to add that check too. 2. There are some wrappers for ValueExpression/MethodExpression that requires to implement Externalizable, to be saved and restored correctly. The good news are if you add this on your web.xml: <context-param> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name> <param-value>true</param-value> </context-param> PSS will be enabled and everything will work well. Thanks a lot for the examples, they were very useful solving this issue.
        Hide
        Matt Benson added a comment -

        Great! I was also going to say that yes, it has to do with ajax updates.

        Show
        Matt Benson added a comment - Great! I was also going to say that yes, it has to do with ajax updates.
        Hide
        Rene O added a comment -

        Here is a second testcase without richfaces.

        Steps to reproduce:

        1. http://loclahost:8080/jsf2testcasewithoutrichfaces/components.jsf

        2. click the button

        3. value is not shown anymore

        Show
        Rene O added a comment - Here is a second testcase without richfaces. Steps to reproduce: 1. http://loclahost:8080/jsf2testcasewithoutrichfaces/components.jsf 2. click the button 3. value is not shown anymore
        Hide
        Leonardo Uribe added a comment -

        Maybe this is caused by the commit done on MYFACES-3182. It could be good to have a test without richfaces jars, just to keep things simple, and create a junit test case for this one.

        Show
        Leonardo Uribe added a comment - Maybe this is caused by the commit done on MYFACES-3182 . It could be good to have a test without richfaces jars, just to keep things simple, and create a junit test case for this one.
        Hide
        Matt Benson added a comment -

        Not sure what if anything richfaces is contributing to the mix here, but I'd like to note that I have seen this behavior for composite component attributes when PSS is disabled on a JSF app with only core components in use. I simply hadn't put together the sample yet to submit the issue myself.

        Show
        Matt Benson added a comment - Not sure what if anything richfaces is contributing to the mix here, but I'd like to note that I have seen this behavior for composite component attributes when PSS is disabled on a JSF app with only core components in use. I simply hadn't put together the sample yet to submit the issue myself.

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Rene O
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development