Tapestry 5
  1. Tapestry 5
  2. TAP5-1088

Bean editor model for <class name> already contains a property model for property <property name> when combining model parameter with add parameter of BeanEditor or BeanEditForm

    Details

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

      Description

      I'm getting exception in my app:

      Render queue error in SetupRender[Details:itemeditor]: Bean editor model for org.apache.tapestry5.integration.app7.data.Item already contains a property model for property 'displayName'.

      Not sure if this is a bug or my misunderstanding of some T5 concepts.

      Here is my use case:

      I have 'Index' page displaying a list of items in a grid. Every row in the grid has an 'Edit' link (pagelink) that leads to 'Details' page where I can edit selected item using BeanEditor component. After clicking Submit application should redirect me back to 'Index' page where I can see the list with updated item. I may want to click 'Edit' once again and repeat the use case, but now at this place I get an exception I noted above.

      Here's my 'Item' class:

      package org.apache.tapestry5.integration.app7.data;

      public class Item {

      private int id;

      public Item(int id)

      { this.id = id; }

      public int getId() { return id; }

      public void setId(int id) { this.id = id; }

      public String getDisplayName()

      { return "Item #" + id; }

      }

      and a part of beaneditor markup on Details page:

      <t:beaneditor t:id="itemEditor" object="item" add="displayName"
      submitLabel="Apply Edit">

      You can see I declare new property (displayName) for the Item bean model. This works fine the first time I navigate to the Details page, but fails on the second time.

      To illustrate the exception I wrote a simple test case (see attachment). I took app6 integration test of tapestry-core tests as a reference (from trunk version on github) and implemented the test case in a new test application (app7).

      Hope this will help to understand the issue.

        Activity

        Howard M. Lewis Ship made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Fix Version/s 5.2.0 [ 12314122 ]
        Resolution Fixed [ 1 ]
        Howard M. Lewis Ship made changes -
        Summary Bean editor model for <class name> already contains a property model for property <property name> Bean editor model for <class name> already contains a property model for property <property name> when combining model parameter with add parameter of BeanEditor or BeanEditForm
        Hide
        Howard M. Lewis Ship added a comment - - edited

        So much for my theory about parameters; I have verified with the debugger that they are working correctly.

        However, that makes me wonder what's going on in your situation? It seems that the combination of the model parameter and the other parameters is what's toxic. However, the test case in the patch isn't for that scenario (its the default generate model, without explicitly binding the model parameter).

        I think the correct solution here is that add, reorder, include, remove are applied ONLY if the model parameter is not bound. This applies to BeanEditor, BeanEditForm, BeanDisplay and Grid.

        Show
        Howard M. Lewis Ship added a comment - - edited So much for my theory about parameters; I have verified with the debugger that they are working correctly. However, that makes me wonder what's going on in your situation? It seems that the combination of the model parameter and the other parameters is what's toxic. However, the test case in the patch isn't for that scenario (its the default generate model, without explicitly binding the model parameter). I think the correct solution here is that add, reorder, include, remove are applied ONLY if the model parameter is not bound. This applies to BeanEditor, BeanEditForm, BeanDisplay and Grid.
        Hide
        Howard M. Lewis Ship added a comment -

        I think the big problem here is that the behavior of parameters, in particular unbound parameters, changed with the other changes to the class transformation pipeline. I need to verify that and, if so, fix it (and any number of other potential bugs).

        Show
        Howard M. Lewis Ship added a comment - I think the big problem here is that the behavior of parameters, in particular unbound parameters, changed with the other changes to the class transformation pipeline. I need to verify that and, if so, fix it (and any number of other potential bugs).
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Howard M. Lewis Ship made changes -
        Assignee Howard M. Lewis Ship [ hlship ]
        Hide
        Joe Klecko added a comment -

        I hope your patch works as this bug has been preventing us from using t5.2 for months. I'm pretty surprised this has gone so long without being fixed. This bug has also been reported here TAP5-1051 and a small thread here: http://old.nabble.com/T5.2.0-SNAPHOT%3A-newbie-exceptions-submitting-form-with-BeanEditor-ts27947909.html#a27950914 .

        Show
        Joe Klecko added a comment - I hope your patch works as this bug has been preventing us from using t5.2 for months. I'm pretty surprised this has gone so long without being fixed. This bug has also been reported here TAP5-1051 and a small thread here: http://old.nabble.com/T5.2.0-SNAPHOT%3A-newbie-exceptions-submitting-form-with-BeanEditor-ts27947909.html#a27950914 .
        Dmitry Gusev made changes -
        Attachment 0001-Test-and-fix-for-TAP5-1088.diff [ 12440227 ]
        Hide
        Dmitry Gusev added a comment -

        Test and fix in unified diff format

        Show
        Dmitry Gusev added a comment - Test and fix in unified diff format
        Dmitry Gusev made changes -
        Attachment 0001-Test-and-fix-for-TAP5-1088.patch [ 12440225 ]
        Hide
        Dmitry Gusev added a comment -

        Unified diff for both test and the fix

        Show
        Dmitry Gusev added a comment - Unified diff for both test and the fix
        Dmitry Gusev made changes -
        Attachment 0001-TestCase-illustrating-bug-with-bean-editor-model.patch [ 12440021 ]
        Dmitry Gusev made changes -
        Attachment 0001-Fix-for-TAP5-1088.patch [ 12440210 ]
        Dmitry Gusev made changes -
        Issue Type Test [ 6 ] Bug [ 1 ]
        Hide
        Dmitry Gusev added a comment -

        I consider this is a bug. Could somebody verify and apply the patch?

        Show
        Dmitry Gusev added a comment - I consider this is a bug. Could somebody verify and apply the patch?
        Dmitry Gusev made changes -
        Attachment 0001-Fix-for-TAP5-1088.patch [ 12440210 ]
        Hide
        Dmitry Gusev added a comment -

        Patch that fixes the issue.

        Applying this fix make test I attached before to pass.
        Also I checked other tests in tapestry-core project and they all passed too.

        Show
        Dmitry Gusev added a comment - Patch that fixes the issue. Applying this fix make test I attached before to pass. Also I checked other tests in tapestry-core project and they all passed too.
        Dmitry Gusev made changes -
        Field Original Value New Value
        Attachment 0001-TestCase-illustrating-bug-with-bean-editor-model.patch [ 12440021 ]
        Hide
        Dmitry Gusev added a comment -

        Test case to reproduce the exception

        Show
        Dmitry Gusev added a comment - Test case to reproduce the exception
        Dmitry Gusev created issue -

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Dmitry Gusev
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development