Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 98258 - [hotbug] JSP comments embedded within tags are not recognized
Summary: [hotbug] JSP comments embedded within tags are not recognized
Status: CLOSED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 1.5 RC3   Edit
Assignee: Nitin Dahyabhai CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 140533 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-03 07:54 EDT by Tim Adler CLA
Modified: 2006-11-28 15:39 EST (History)
4 users (show)

See Also:


Attachments
A jsp with the comment problem! (8.73 KB, application/octet-stream)
2005-06-05 10:10 EDT, Tim Adler CLA
no flags Details
proposed (workspace) patch (232.04 KB, patch)
2006-05-09 20:35 EDT, Nitin Dahyabhai CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Adler CLA 2005-06-03 07:54:05 EDT
If you use <%-- --%> as a JSP code comment to avoid evaluation, this is not
recognized. It is treated as a normal <% %>.
Comment 1 Nitin Dahyabhai CLA 2005-06-03 17:23:02 EDT
Can you be more specific?  Where is it being treated as a normal scriptlet?
Comment 2 Tim Adler CLA 2005-06-03 17:57:20 EDT
I'm sorry, I though this was I general problem. I back checked on that. Seems
like it has something to do with dots and spaces somewhere in the comment.

I have attached you some file, which shows the problem!	
Comment 3 Tim Adler CLA 2005-06-05 10:10:18 EDT
Created attachment 22388 [details]
A jsp with the comment problem!

Where did the attachment go the first time I tried?
Comment 4 David Williams CLA 2005-06-05 12:41:51 EDT
I think you also attached same file to bug 95091 ... I assume that one was an
error attachement? (I think you can mark an attachment 'deleted', or something,
if invalid). 
Comment 5 Nitin Dahyabhai CLA 2005-06-05 23:10:02 EDT
The comment on line 199 is interpreted as a scriptlet--we don't support a
comment in there just yet, only expressions and scriptlets.  What you're seeing
is your comment being parsed and highlighted as a scriptlet.
Comment 6 Tim deBoer CLA 2005-10-25 00:07:31 EDT
Hi. Any progress on this bug? I have a tester on my team that has been hitting
it for several months and is wondering if/when this is going to be fixed.
Comment 7 David Williams CLA 2006-01-11 17:42:37 EST
Nitin, I assume this would take a major fix to parser to fix correctly? 

Phil, can you think of any "context" you could take advantage of to at least 
not flag this as an error? (for 101 stream) (e.g. if a is embedded in an embedded region in an embedded region in a custom tag's attribute ... or something?) 

Comment 8 Tim deBoer CLA 2006-04-22 12:19:38 EDT
The fact that the JSP parser in WTP is not spec compliant is getting harder and harder to explain, and I've heard several reports of this. Raising as a hot bug request for IBM for WTP 1.5.
Comment 9 David Williams CLA 2006-04-27 14:40:08 EDT
I agree this this is a hot bug. I'm still not sure we can safely fix it for 1.5, but it does deserve some focused investigation to map out alternatives. 

Comment 10 Nitin Dahyabhai CLA 2006-05-09 18:08:59 EDT
*** Bug 140533 has been marked as a duplicate of this bug. ***
Comment 11 Nitin Dahyabhai CLA 2006-05-09 20:35:54 EDT
Created attachment 40895 [details]
proposed (workspace) patch

Attaching a patch to modify the JSPTokenizer and unit tests.

The only visible change in behavior is that JSP comments in XML tags are parsed as embedded region containers of type JSP_COMMENT_TEXT.  The change consists mostly of a new grammar rules and corresponding JFlex action. It allows for the comments to show up anywhere just like JSP Expressions, and starts with the same expression handling JFlex action code, but alters its copy so that it doesn't transition to the next state while returning a comment embedded region.  The comment is special in that it's not supposed to take the place of an attribute name, value, etc., that's why it's not an exact duplicate of the expression-handling JFlex action.  It doesn't touch any of the custom buffer/array handling code, which is what would have made this an especially risky fix.

The patch also introduced a new unit test for this case specifically and additional test for some edge cases.  _Existing tests were not functionally modified since this was previously untested behavior and is not allowed to break existing tests._
Comment 12 David Williams CLA 2006-05-09 21:10:09 EDT
Looks good Nitin. 
Approved. 
Comment 13 Nitin Dahyabhai CLA 2006-05-09 23:09:18 EDT
Committing to HEAD and releasing for RC3.
Comment 14 Tim Adler CLA 2006-05-10 02:54:59 EDT
Thx for fixing! Looking forward to the new release :)!
Comment 15 John Lanuti CLA 2006-11-28 15:39:37 EST
This is part of a mass update to close out all stale WTP defects already verified by the reporter but awaiting closure by the assignee.  If you feel this defect was closed inappropriately, please reopen.

Thanks, John Lanuti