Bug 48827 - Error validating empty tag that contains jsp:attribute in JSP documents in XML syntax
Error validating empty tag that contains jsp:attribute in JSP documents in XM...
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Jasper
6.0.24
PC Windows XP
: P2 regression (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-02-27 13:10 UTC by Konstantin Kolinko
Modified: 2010-09-27 19:01 UTC (History)
0 users



Attachments
emptyTagWithAttribute_Xml.jspx (556 bytes, application/octet-stream)
2010-02-27 13:10 UTC, Konstantin Kolinko
Details
emptyTagWithAttribute_Jsp.jsp (451 bytes, text/plain)
2010-02-27 13:11 UTC, Konstantin Kolinko
Details
emptyTagWithSpaceAndComment_Xml.jspx (326 bytes, text/plain)
2010-07-09 07:52 UTC, Konstantin Kolinko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2010-02-27 13:10:11 UTC
Created attachment 25065 [details]
emptyTagWithAttribute_Xml.jspx

Steps to reproduce:
1. Place the attached emptyTagWithAttribute_Xml.jspx into webapps/examples
2. Open http://localhost:8080/examples/emptyTagWithAttribute_Xml.jspx
3. Observe error 500:

org.apache.jasper.JasperException: /emptyTagWithAttribute_Xml.jspx(6,18) According to TLD, tag my:shuffle must be empty, but is not
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
	org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:216)
	org.apache.jasper.compiler.ParserController.doParse(ParserController.java:239)
	org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:170)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


The above stack trace is with 6.0.25 release candidate. IIRC, I observed the same with 6.0.24 recently. It works correctly with TC 6.0.20.

This issue affects JSP Documents (XML syntax) only. The pages in plain JSP syntax (e.g. shuffle.jsp in our examples) work correctly.
Comment 1 Konstantin Kolinko 2010-02-27 13:11:12 UTC
Created attachment 25066 [details]
emptyTagWithAttribute_Jsp.jsp

The same page in plain JSP syntax. It works.
Comment 2 Mark Thomas 2010-03-03 20:25:55 UTC
It is a regression in the fix for bug47977. Looking at a fix now...
Comment 3 Mark Thomas 2010-03-03 21:05:22 UTC
Fixed in trunk (with a couple of test cases) and proposed for 6.0.x
Comment 4 Konstantin Kolinko 2010-03-05 18:38:41 UTC
Fixed in 6.0 in r919354 and will be in 6.0.26 onwards.

I tested the current 5.5 (that will be 5.5.29) and it is not affected by this issue.
Comment 5 Konstantin Kolinko 2010-07-09 07:52:16 UTC
Created attachment 25736 [details]
emptyTagWithSpaceAndComment_Xml.jspx

One more regression due to bug47977 fix:
If the empty tag contains a comment, Tomcat barks that "tag .. must be empty but is not".

I am attaching a JSPX document that reproduces this issue. The steps to reproduce are the same as in Description of this issue.

Reproducible in 6.0.28 and in the current trunk (thus released 7.0.0-beta is also affected).

I tested 5.5.30 as well and it works correctly.
Comment 6 Mark Thomas 2010-09-27 19:01:17 UTC
I have review the EBNF in the JSP 2.2 spec and I can't see anything that would permit comments in a tag that should have an empty body.