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

The method used to generate anonymousDefinition names may break template inheritance.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.2.3
    • None
    • tiles-core
    • None

    Description

      My company is using Apache Tiles 2.2.2 on a project that – until recently – was not localized. After adding Tiles configuration files for various languages, e.g. tiles_es.xml, tiles_fr.xml, and restarting, we began to experience the bug described in TILES-513.

      First, we tried the suggestion made by Jamie Goodfellow. That did not fix the problem. Then we tried the patch made by Antonio and checked in as part of the changeset for Tiles 2.2.3 (which was unreleased). We discovered that the problem did not go away.

      The reason for this is that DigesterDefinitionsReader uses an internal counter, anonymousDefinitionIndex, to generate a unique definition name as a source file is read in.

      When ResolvingLocaleUrlDefinitionDAO calls loadDefinitionsFromURL, first for the root file, then for the addition locale(s), the generated anonymous definition names do not match up, and therefore, inheritance is broken.

      The change I made to my code was to add a "reset" method to an overloaded DigesterDefinitionsReader, so that the internal counter could be reset prior to calling loadDefinitionsFromURL. Once that is done, the anonymous definition names to match up, and inheritance to work properly. I'm not sure about thread safety, but the hack did work for me so far.

      Perhaps it would be better to generate an anonymousDefinition name based upon something consistent between re-reads of the source file, (a hash of the file and line number, etc?) that would be consistent between reads.

      Thanks for all the hard work you guys do.

      Attachments

        Activity

          People

            Unassigned Unassigned
            garakelian Greg Arakelian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: