I ran into an infinite loop (stack overflow) using the REGEXP in my tiles definition (see http://stackoverflow.com/q/19598873/827480). Luckily, I ran
across a similar thread in StackOverflow (http://stackoverflow.com/a/6617343/827480) that pointed me in the right direction, or I would never have
caught on.
Basing myself on the example from the
http://tech.finn.no/2012/07/25/the-ultimate-view-tiles-3/ site, I tried to
create a REGEXP deinition as follows:
Given the following tiles.xml definition file:
<definition name="REGEXP:(.+)"
template="/WEB-INF/views/tiles/layouts/default.jsp">
<put-attribute name="meta" value="/WEB-INF/views/tiles/{1}/meta.jsp"/>
<put-attribute name="head" value="/WEB-INF/views/tiles/{1}/head.jsp"/>
<put-attribute name="body" value="/WEB-INF/views/tiles/{1}/body.jsp"/>
</definition>
I would never have expected to run into an infinite loop. But what seems to be happening, is that the attribute value is being checked against the
regexp as well. And given that it matches, it tries to retrieve the value and check that against the regexp ad nauseum.
Although I can theoretically understand the reasoning behind this (allows for recursive template name matching), I'm not entirely sure of the use case
that it is trying to resolve.
Additionally, I find that the RegexpDefinitionPatternMatcher should be smart enough to detect that it has encountered an infinite loop and throw its
own error, rather than be stuck in an infinite recursive loop.
Should I be raising this as a bug in Jira, or is this planned/expected
behaviour?
Thanks,
Eric