xhtml-macro boolean parameters with actual value = default value are not contained in the parameter map passed to the macro

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Low
    • None
    • Affects Version/s: 4.0.3
    • Component/s: None

      The behavior of boolean parameters in xhtml macros seems quite strange.

      If one adds a default value then the parameter is only inside the parameter map passed to the macro when the value is not the default value. If the actual value matches the default value, the parameter is missing from the map.
      The same is true for the parameter "withoutDefault" which has the implicit default value "false" according to your documentation.

      I attached a small demo project showing this. Just "atlas-debug" it, edit a page and add the "test-macro" to it. Check the preview, the macro just calls toString() on the parameter map and returns it. Check what parameters are inside the map when toggling the checkboxes for the different parameters.

      Shouldn't the parameter be always inside the map with the proper value "true" or "false" regardless of the default value ?

      Here is the module description of the macro:

          <xhtml-macro key="xhtml-test-macro" name="test-macro"
                       class="com.k15t.bug.demo.macro.TestMacro">
              <category name="confluence-content" />
              <parameters>
                  <parameter name="trueByDefault" type="boolean" default="true" />
                  <parameter name="falseByDefault" type="boolean" default="false" />
                  <parameter name="withoutDefault" type="boolean" />
              </parameters>
          </xhtml-macro>
      

        1. boolean-parameter-bug.zip
          3 kB
          Jens Rutschmann [K15t]

            Assignee:
            Steve Haffenden (Inactive)
            Reporter:
            Jens Rutschmann [K15t]
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: