Bug 40913 - JasperException raised against valid attribute
Summary: JasperException raised against valid attribute
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 6.0.0
Hardware: Other other
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-06 16:24 UTC by Scott Johnson
Modified: 2006-11-07 02:56 UTC (History)
0 users



Attachments
Testcase for 40913 (1.95 KB, application/x-zip-compressed)
2006-11-06 16:25 UTC, Scott Johnson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Johnson 2006-11-06 16:24:05 UTC
In org.apache.jasper.compiler.Validator.checkXmlAttributes(), the validation 
for deferred values and methods is raising an exception when an rtexprvalue 
attribute is legitimate.

------Stacktrace------
org.apache.jasper.JasperException: 
org.apache.jasper.JasperException: /index.jsp(83,0)
      According to TLD or attribute directive in tag file, attribute items 
does not accept any expressions
    org.apache.jasper.servlet.JspServletWrapper.handleJspException
(JspServletWrapper.java:565)
    org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:354)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



------relevant code in checkXmlAttributes()------
 if (!deferred && (tldAttrs[j].isDeferredMethod() || tldAttrs
[j].isDeferredValue())) {
     // Only deferred expressions are allowed for this attribute
     err.jspError(n, "jsp.error.attribute.custom.non_rt_with_expr",
             tldAttrs[j].getName());
 }

------testcase------
<c:forEach var="k" items="${colors}">
  <li><font color="${k}">This line is ${k}</font>.
</c:forEach>

The TLD for JSTL 1.2 says items can be an rtexprvalue and also a deferred-
value.  So the above usage is correct.
Attaching a testcase WAR.

------summary------
I don't think this code is really necessary; at least, it needs to be relaxed 
to allow tai.canBeRequestTime() values.
Comment 1 Scott Johnson 2006-11-06 16:25:28 UTC
Created attachment 19094 [details]
Testcase for 40913
Comment 2 Remy Maucherat 2006-11-07 02:56:48 UTC
Ok, I have adjusted the check.