Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 345999

Summary: JSP Editor shows false error when <h:commandButton> has value="<"
Product: [WebTools] WTP Source Editing Reporter: Nick Sandonato <nsand.dev>
Component: jst.jspAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nick Sandonato <nsand.dev>
Severity: normal    
Priority: P3 CC: carlin.rogers, jim, nsand.dev, raghunathan.srinivasan, thatnitind
Version: 3.2.3Flags: nsand.dev: pmc_approved? (david_williams)
raghunathan.srinivasan: pmc_approved+
nsand.dev: pmc_approved? (naci.dai)
nsand.dev: pmc_approved? (deboer)
nsand.dev: pmc_approved? (neil.hauge)
nsand.dev: pmc_approved? (kaloyan)
nsand.dev: pmc_approved? (cbridgha)
Target Milestone: 3.3 RC2   
Hardware: PC   
OS: Windows XP   
Whiteboard: PMC_approved
Attachments:
Description Flags
patch none

Description Nick Sandonato CLA 2011-05-16 16:36:39 EDT
+++ This bug was initially created as a clone of Bug #343387 for 3.3 +++

Build Identifier: 20110218-0911

My project is using JSF inside JSPs. I just added an <h:commandButton> element to an existing page and I want the button text to be << (two less-than symbols). The code snippet from the page looks like this:

<h:commandButton action="#{myBean.actionMethodName} value="<<">

The JSP Editor is now complaining of "No end tag (</h:commandButton>)" and "Start tag (<h:commandButton>) not closed".

If I just ignore that JSP Editor errors, the page executes just fine. It should not be an error since quoted angle brackets are valid in this position. This is a problem for me, since now I have unfixable false errors in the JSP Editor for this page and I won't see real errors.

Reproducible: Always

Steps to Reproduce:
1. Open a JSP page with JSF content in the JSP Editor
2. Add an element similar to <h:commandButton action="#{myBean.actionMethodName} value="<<"> somewhere inside the <h:form> for this page
Comment 1 Nick Sandonato CLA 2011-05-16 16:41:52 EDT
Created attachment 195791 [details]
patch
Comment 2 Nick Sandonato CLA 2011-05-16 16:53:35 EDT
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such.

Valid characters in HTML markup are causing tokenizer problems that result in an improperly formed DOM and confusing validation messages despite the JSP executing properly on the server.
 
* Is there a work-around? If so, why do you believe the work-around is insufficient?

Yes. Characters inserted after a < (e.g., "<&lt;" or "<&nbsp;"). Either way, we'd be dictating how a developer writes his/her markup when the original form was perfectly valid. In the case of adding text afterwards, we're changing the actual value (unless of course &lt; is used).

* How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added?

Ad hoc testing and a new JUnit test.

* Give a brief technical overview. Who has reviewed this fix?

The token being returned for the end quote was not of the same type as the start quote (these differ based on if it's a JSP tag or not). To correct this, the end quote type is determined based on the same rules we use to determine the start quote type.

What is the risk associated with this fix?

Minor.
Comment 3 Raghunathan Srinivasan CLA 2011-05-16 16:56:26 EDT
Thanks for addressing this issue.
Comment 4 Nick Sandonato CLA 2011-05-16 17:18:54 EDT
Thanks, Raghu. Changes released.
Comment 5 Nitin Dahyabhai CLA 2011-05-19 02:05:26 EDT
Resolving.