arguments not passed to rendered template
Consider the following template definitions:
define main() {
includeCSS(“eelcovisser.css”)
includeHead(rendertemplate(rssLink()))
// …
}define rssLink() { }
define bloglayout(b: Blog) {
define pageheader() {link(b){ output(b.title) }
}
define rssLink() {
<link rel=“alternate” type=“application/rss+xml” title=“RSS” href=navigate(feed(“wiki”)) />
}
main{
elements
}
}
The code generated for the local redefinition of rssLink expects to be passed the ‘b’ variable. However, at run-time we get:
Submitted by Eelco Visser on 12 April 2011 at 23:49
Problem occurred in template call: main()
java.lang.ArrayIndexOutOfBoundsException: 0
at webdsl.generated.templates.bloglayoutBlog_rssLink0Blog_Template.storeArguments(bloglayoutBlog_rssLink0Blog_Template.java:25)
at utils.TemplateServlet.tryInitializeTemplate(TemplateServlet.java:163)
at utils.TemplateServlet.render(TemplateServlet.java:81)
at utils.AbstractPageServlet.renderTemplate(AbstractPageServlet.java:156)
at webdsl.generated.templates.main_Template.renderInternal(main_Template.java:349)
at utils.TemplateServlet.render(TemplateServlet.java:89)
at webdsl.generated.templates.bloglayoutBlog_Template.renderInternal(bloglayoutBlog_Template.java:178)
at utils.TemplateServlet.render(TemplateServlet.java:89)
at webdsl.generated.templates.blogBlogInt_Template.renderInternal(blogBlogInt_Template.java:392)
at utils.TemplateServlet.render(TemplateServlet.java:89)
at webdsl.generated.templates.blog_Template.renderInternal(blog_Template.java:166)
at utils.TemplateServlet.render(TemplateServlet.java:89)
at webdsl.generated.templates.BlogPage.render(BlogPage.java:237)
at webdsl.generated.templates.BlogPage.serve(BlogPage.java:161)
at utils.DispatchServletHelper.handlePage(DispatchServletHelper.java:583)
at utils.DispatchServletHelper.doServe(DispatchServletHelper.java:542)
at utils.DispatchServlet.doGet(DispatchServlet.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:680)
Issue Log
Workaround: manually lift the local redefinition (since it does not depend on b anyway):
define bloglayoutAux() {
define rssLink() {
<link rel=“alternate” type=“application/rss+xml” title=“RSS” href=navigate(feed(“wiki”)) />
}
main{
elements
}
}define bloglayout(b: Blog) {
define pageheader() {link(b){ output(b.title) }
}
bloglayoutAux{
elements
}
}
fixed in r5816
Log in to post comments