Tapestry 5
  1. Tapestry 5
  2. TAP5-328

Exception when checking BeanEditor Field required in ValidationDecorator

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.15
    • Fix Version/s: 5.0.16
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      You get the following error when marking a field "required" and using it in a beaneditor and creating a modified ValidationDecorator asking for required (like HLS suggested in http://www.nabble.com/How-to-create-my-ValidationDecorator-in-T5--td11533833.html).

      "Render queue error in AfterRender[Index:form.editor.loop]: Failure reading parameter 'validate' of component core/PropertyEditBlocks:textfield: No object of type org.apache.tapestry5.services.PropertyEditContext is available from the Environment."

      The problem is also described here by Rolf Wagner: http://www.nabble.com/-T5--Custom-ValidationDecorator-causing-Exception-in-BeanEditor-td20084804.html

      1. beaneditortest.zip
        9 kB
        Christian Köberl
      2. PropertyEditor_cleanupEnvironment.patch
        0.7 kB
        Christian Köberl

        Activity

        Hide
        Serge Eby added a comment -

        This issue is still present in 5.3.3

        Show
        Serge Eby added a comment - This issue is still present in 5.3.3
        Hide
        Paudi Moriarty added a comment -

        Also tried 5.2.0-SNAPSHOT and still seeing the behaviour. Can seem to re-open this one, should I create a new one?

        Show
        Paudi Moriarty added a comment - Also tried 5.2.0-SNAPSHOT and still seeing the behaviour. Can seem to re-open this one, should I create a new one?
        Hide
        Paudi Moriarty added a comment -

        I'm seeing this behaviour in 5.0.16 and 5.1.0.5 in my own code and even with the beaneditortest project attached here. Am I missing something?

        Show
        Paudi Moriarty added a comment - I'm seeing this behaviour in 5.0.16 and 5.1.0.5 in my own code and even with the beaneditortest project attached here. Am I missing something?
        Hide
        Howard M. Lewis Ship added a comment -

        I have not applied the patch, but this bug is fixed; other changes related to validation (TAP5-22) have eliminated the exception ... I was able to verify your problem exists under 5.0.15, but it is not present in 5.0.16-SNAPSHOT.

        I was not happy with the patch, since I feel strongly that whatever is put into the environment in a begin/before method (or equivalent) should be cleaned up immediately inside the matching after method (or equivalent). There is the risk that the pops may occur in the wrong order, leading to very difficult to diagnose incorrect behavior.

        Show
        Howard M. Lewis Ship added a comment - I have not applied the patch, but this bug is fixed; other changes related to validation ( TAP5-22 ) have eliminated the exception ... I was able to verify your problem exists under 5.0.15, but it is not present in 5.0.16-SNAPSHOT. I was not happy with the patch, since I feel strongly that whatever is put into the environment in a begin/before method (or equivalent) should be cleaned up immediately inside the matching after method (or equivalent). There is the risk that the pops may occur in the wrong order, leading to very difficult to diagnose incorrect behavior.
        Hide
        Christian Köberl added a comment - - edited

        [PropertyEditor_cleanupEnvironment.patch] This is the patch for the PropertyEditor. We already included it in our own BeanEditor - seems to work fine.

        Please apply before releasing 5.0

        Show
        Christian Köberl added a comment - - edited [PropertyEditor_cleanupEnvironment.patch] This is the patch for the PropertyEditor. We already included it in our own BeanEditor - seems to work fine. Please apply before releasing 5.0
        Hide
        Christian Köberl added a comment -

        The problem here is that the field already cleaned up the Environment and the Label is rendered with Heartbeat at the end of the loop.

        A possible fix is to cleanup the environment later (e.g. also in Hearbeat).

        Show
        Christian Köberl added a comment - The problem here is that the field already cleaned up the Environment and the Label is rendered with Heartbeat at the end of the loop. A possible fix is to cleanup the environment later (e.g. also in Hearbeat).
        Hide
        Christian Köberl added a comment - - edited

        [beaneditortest.zip] This project demonstrates the error. It is a simple beaneditor with a bean person and a modified ValidationDecorator.

        Show
        Christian Köberl added a comment - - edited [beaneditortest.zip] This project demonstrates the error. It is a simple beaneditor with a bean person and a modified ValidationDecorator.

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Christian Köberl
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development