Bug 21753 - Custom tags within multiline comments generate compile error
Summary: Custom tags within multiline comments generate compile error
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Jasper (show other bugs)
Version: Nightly Build
Hardware: All All
: P3 minor (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2003-07-21 00:20 UTC by Eric Carmichael
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
Proposed patch (1.35 KB, patch)
2003-07-21 00:22 UTC, Eric Carmichael
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carmichael 2003-07-21 00:20:54 UTC
Jasper generates incorrect Java code when compiling a JSP page which contains 
a custom tag inside a multiline comment, such as the following:

<%@ taglib uri="/test" prefix="test" %>

Hello World
<%
/*
%>

<test:test/>

<%
*/
%>

This is the error message return by the Java compiler:

Generated servlet error:
    [javac] Compiling 1 source file

C:\jakarta-tomcat-5
\build\work\Catalina\localhost\webapp\org\apache\jsp\test_jsp.java:76: illegal 
start of expression
*/
^

The problem is that generateCustomStartTag and generateCustomDoTag insert 
multiline comments of their own.  The Java compiler interprets the "*/" at the 
end of the inserted multiline comment as the end of the multiline comment from 
the JSP page, and returns an error when it finds the closing "*/" from the JSP 
page.

I will attach a patch that fixes this.
Comment 1 Eric Carmichael 2003-07-21 00:22:26 UTC
Created attachment 7411 [details]
Proposed patch
Comment 2 william.barker 2003-07-21 05:38:23 UTC
Now fixed in the CVS HEAD.