Tapestry 5
  1. Tapestry 5
  2. TAP5-1642

A mixin parameter that is required but also provides a default property results in an "unbound parameter" exception, starting in Tapestry 5.3

    Details

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

      Description

      In our Tapestry 5 library (exanpe-t5-lib), we provide some mixins containing some parameters declared as "required=true" AND with a default value.
      These parameters are required for the operation of the mixin.

      For example, in a Dialog mixin, we have :

      @Parameter(value = "confirm", required = true, allowNull = false, defaultPrefix = BindingConstants.LITERAL)
      private DialogRenderModeEnum renderMode;

      If this required parameter is not explicity bound in the TML :

      • In 5.2.6, everything is ok : the default value is used
      • In 5.3-beta-5, we get the following Exception :
        Parameter(s) 'Dialog.renderMode' are required for org.apache.tapestry5.corelib.components.ActionLink, but have not been bound.

      The TML example looks like this :
      <t:actionlink t:id="link1" t:mixins="exanpe/dialog">link1</t:actionlink>

      With a simple type for mixin parameter (Integer or String), the same error occurs.
      This behavior is only for mixins, not for components.

      A simplified project that duplicates the issue has been attached : the mixin Emphasis used into Index.tml is ok in 5.2.6 and ko in 5.3.

      1. test-mixin.zip
        43 kB
        Laurent Guerin

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        This has been discussed to death on the mailing list. "required" means it must be bound, but the binding may be a default binding ... it doesn't mean that the parameter must be bound each time (when an appropriate default is possible).

        Show
        Howard M. Lewis Ship added a comment - This has been discussed to death on the mailing list. "required" means it must be bound, but the binding may be a default binding ... it doesn't mean that the parameter must be bound each time (when an appropriate default is possible).
        Hide
        Robert Zeigler added a comment -

        That's the poster's point; the parameter is required, but a sensible default is provided and Tapestry is complaining that the parameter isn't bound, despite a sensible default being provided. I've verified that this behavior is still present in T5.3-beta-24

        Show
        Robert Zeigler added a comment - That's the poster's point; the parameter is required, but a sensible default is provided and Tapestry is complaining that the parameter isn't bound, despite a sensible default being provided. I've verified that this behavior is still present in T5.3-beta-24
        Hide
        Howard M. Lewis Ship added a comment -

        Thanks! I misunderstood this!

        Show
        Howard M. Lewis Ship added a comment - Thanks! I misunderstood this!
        Hide
        Howard M. Lewis Ship added a comment -

        Some work with the debugger confirms that its an order-of-operations problem. The component is checking to see if mixin parameters have been bound before the mixins' containingPageDidLoad() method has had a chance to do the final binding to the default value.

        Show
        Howard M. Lewis Ship added a comment - Some work with the debugger confirms that its an order-of-operations problem. The component is checking to see if mixin parameters have been bound before the mixins' containingPageDidLoad() method has had a chance to do the final binding to the default value.
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #604 (See https://builds.apache.org/job/tapestry-trunk-freestyle/604/)
        TAP5-1642: A mixin parameter that is required but also provides a default property results in an "unbound parameter" exception, starting in Tapestry 5.3

        hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1188272
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ParameterWorker.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/ParameterTests.groovy
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/mixins/AltTitleDefault.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/MixinParameterDefault.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/MixinParameterDefault.tml
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #604 (See https://builds.apache.org/job/tapestry-trunk-freestyle/604/ ) TAP5-1642 : A mixin parameter that is required but also provides a default property results in an "unbound parameter" exception, starting in Tapestry 5.3 hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1188272 Files : /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ParameterWorker.java /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/ParameterTests.groovy /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/mixins/AltTitleDefault.java /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/MixinParameterDefault.java /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/MixinParameterDefault.tml

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Laurent Guerin
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development