I've stumbled over a confounding bug in T5's error reporting. Let me
first say that I am extremely grateful for the detail that has gone in
to the reporting - and now for the issue.
The problem revolves around 2 pages and a component. Firstly, here is
the page where the actual error is:
*ViewPost.tml (page)*
<div t:type="layouts/General"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<t:viewpost post="post"/>
<form t:type="form">
<textarea t:type="textarea" value=""/> <-- *Error - this is
required* -->
</form>
</div>
And here are the other players:
*Start.tml (page)*
<div t:type="layouts/General"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<div t:type="viewpost" post="lastPost" class="gc-post"/>
</div>
*ViewPost.tml (component)*
<div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"
class="gc-post">
<a href="#" class="gc-post-title" t:type="pagelink"
page="blog/viewpost" context="post.id">${post.title}</a>
<div class="gc-post-body">${post.body}</div>
<div t:type="gc/dateformat" class="gc-post-created"
date="post.created" format="dd MMMM yyyy"></div>
<div class="gc-post-tags">${post.tags.size()}</div>
</div>
Note the error in the ViewPost page template - textarea is missing a
valid value for a parameter. This should trigger an error and highlight
offending section of the template, but it doesn't. I have found two
problems - the first seems fairly obvious:
When a required parameter is missing, or at least for this component
(maybe all), T5 throws:
org.apache.tapestry.ioc.internal.util.TapestryException: Parameter
expression was null or contained only whitespace. The message is
accurate but it is not accompanied with the offending section
highlighted in a template (as usual) - just a stack trace.
This happens when viewing the ViewPost page. The other problem which
appears to be directly connected to this, occurs when viewing the Start
page. First note that there are no problems in this page or the embedded
components, and particularly not in the ViewPost /component/ (also
embedded in the ViewPost /page/).
This is where things get screwy. When that offending line that I
highlighted in the ViewPost /page/ is removed, the start page works
fine. However when the line is present, viewing the start page throws an
incorrectly reported error. Not only that, but an error is triggered
even though there is no error in the page or its components! The error
report gives the same exception mentioned previously, and highlights a
section in the template of the ViewPost /component/ - in which there is
no error. I am sure the error is ultimately being triggered by the
offending line in the ViewPost /page/ because when I remove it all is fine.
*UPDATE*
Rereading what I just wrote, I think I see the connection. Start page
embeds ViewPage component, which embeds a PageLink to ViewPage page -
where the error is. The exception bubbles up and, for some erroneous
reason, reports as coming from the ViewPost component (it even
highlights the PageLink to the erroneous page). Maybe this is some kind
of off by one error - I'm not sure.
Is this known about? I haven't noticed anything on JIRA. This is 5.0.7, btw.
sincerely,
chris