You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tiles.apache.org by "Greg Arakelian (JIRA)" <ji...@apache.org> on 2012/07/17 03:38:33 UTC

[jira] [Created] (TILES-555) The method used to generate anonymousDefinition names may break template inheritance.

Greg Arakelian created TILES-555:
------------------------------------

             Summary: The method used to generate anonymousDefinition names may break template inheritance.
                 Key: TILES-555
                 URL: https://issues.apache.org/jira/browse/TILES-555
             Project: Tiles
          Issue Type: Bug
          Components: tiles-core
    Affects Versions: 2.2.3
            Reporter: Greg Arakelian


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.





--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira