Uploaded image for project: 'Tiles'
  1. Tiles
  2. TILES-519

tiles:getAsString is not cleaning tiles context when attribute is not present and ignore=true

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.2
    • 2.2.3
    • tiles-template
    • None
    • Patch

    Description

      After putting this line in the template:
      <tiles:getAsString name="subtitle" ignore="true"/>
      <tiles:insertAttribute name="body" />

      And if "subtitle" attribute is not defined. The page will fail on rendering the "body" attribute, because getAsString failed to cleanup it's tiles context (endContext() is not executed).

      SOLUTION:
      The problem is in GetAsStringModel class, in the last method - renderAttribute():

      The first three lines that check for null attribute and ignore flag should be inside the try caluse:
      try {
      if (attribute == null && ignore)

      { return; }

      writer.write(...

      This way the finally clause will be executed even in attribute is null and should be ignored. The finally clause is ending the tiles context.

      This is the same as the code inside: InsertAttributeModel.renderAttribute()

      Attachments

        1. TILES-519-fix.patch
          0.8 kB
          Vitaly Polonetsky
        2. TILES-519-tests.patch
          3 kB
          Vitaly Polonetsky

        Activity

          People

            brenmcguire Antonio Petrelli
            m_vitaly Vitaly Polonetsky
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: