Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-10019

Replace ?default(value) by !value in Freemarker templates

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • Trunk, Upcoming Branch
    • None
    • ALL COMPONENTS
    • None

    Description

      I want to replace

      ?default(value)

      by

      !value

      in Freemarker templates, that's 1394 cases!

      But before doing so I prefer to wait for a 2.4 Freemarker version because we already experienced an issue at OFBIZ-4902, see http://svn.apache.org/viewvc?view=revision&revision=r1624876

      Actually I know now that it was not a bug of ours but one of Freemarker:

      Warning! If you have a composite expression after the !, like 1 + x, always use parenthesses, like ${x!(1 + y)} or ${(x!1) + y)}, depending on which interpretation you meant. That's needed because due to a programming mistake in FreeMarker 2.3.x, the precedence of ! (when it's used as default value operator) is very low at its right side. This means that, for example, ${x!1 + y} is misinterpreted by FreeMarker as ${x!(1 + y)} while it should mean ${(x!1) + y}. This programming error will be fixed in FreeMarker 2.4, so you should not utilize this wrong behavior, or else your templates will break with FreeMarker 2.4!

      Attachments

        Activity

          People

            jleroux Jacques Le Roux
            jleroux Jacques Le Roux
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: