Bug 49998

Summary: ParserController.hasJspRoot() does not detect JSP as using XML syntax if <jsp:root> namespace declaration uses ' delimiters instead of "
Product: Tomcat 6 Reporter: kmoon
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: brian.weisleder
Priority: P2    
Version: 6.0.24   
Target Milestone: default   
Hardware: PC   
OS: Windows XP   
Attachments: Patch to allow single quotes to be used in jsp namespace declarations

Description kmoon 2010-09-24 16:25:42 UTC
I have a simple JSP in XML syntax that looks like this:

  <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
    content goes here
  </jsp:root>

This works fine. However, if I use ' instead of " for the namespace declaration, it fails to detect that XML syntax is being used, giving a "no such action" error instead:

  <jsp:root xmlns:jsp='http://java.sun.com/JSP/Page' version='2.0'>
    content goes here
  </jsp:root>

Note that the check is skipped and the bug isn't exposed if external information on the JSP syntax is available (for example, from the web.xml, or because the file ends in .jspx).

The problem seems to be on line 615 of org.apache.jasper.compiler.ParserController (in hasJspRoot). When trying to find the namespace declaration, the code only looks for a " character, and does not consider ' characters.
Comment 1 brian.weisleder 2010-10-01 00:30:53 UTC
Created attachment 26109 [details]
Patch to allow single quotes to be used in jsp namespace declarations

This patch allows users to use single quotes rather than, or in addition to, double quotes when declaring JSP namespaces with XML syntax
Comment 2 Tim Whittington 2010-10-03 03:20:05 UTC
Fixed in trunk (will be in 7.0.3+) and proposed for 6.0.x.
Comment 3 Mark Thomas 2010-10-03 06:06:27 UTC
(In reply to comment #2)
> Fixed in trunk (will be in 7.0.3+) and proposed for 6.0.x.

Actually, this will be in 7.0.4 onwards. 7.0.3 was tagged approx 8 hours before this commit.
Comment 4 Tim Whittington 2010-10-03 16:31:10 UTC
Fixed in 6.0.x (will be in 6.0.30+). Thanks for the report.
Comment 5 kmoon 2010-10-04 12:21:21 UTC
Thanks for the quick turnaround!