Bug 49998 - ParserController.hasJspRoot() does not detect JSP as using XML syntax if <jsp:root> namespace declaration uses ' delimiters instead of "
ParserController.hasJspRoot() does not detect JSP as using XML syntax if <jsp...
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Jasper
6.0.24
PC Windows XP
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-09-24 16:25 UTC by kmoon
Modified: 2010-10-04 12:21 UTC (History)
1 user (show)



Attachments
Patch to allow single quotes to be used in jsp namespace declarations (1.38 KB, patch)
2010-10-01 00:30 UTC, brian.weisleder
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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!