This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 26276 - Incorrect syntax highlighting for quoted text
Summary: Incorrect syntax highlighting for quoted text
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 3.x
Hardware: All All
: P4 blocker with 1 vote (vote)
Assignee: Marek Fukala
URL:
Keywords:
: 21908 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-08-05 09:32 UTC by _ gtzabari
Modified: 2009-11-02 11:13 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2002-08-05 09:32:57 UTC
dev build 200208020100

   It was recently 'revealed' to me <grumble>
<grumble> that JSP requires special quoting for <%
%>, quotes and slash characters. For example, the
following:

<jsp:setProperty name="counter" property="appBase"
value="<%= application.getRealPath(\"\") %>" />

   is correct but Netbeans flags the \" (escape
character) as being incorrect. Personally I wish
JSPs would work the way Netbeans seems to assume
it does, but unfortunately it does not. Please see
the JSP specification, section JSP.2.6
Comment 1 _ gtzabari 2002-08-05 09:36:19 UTC
Correction:

<jsp:setProperty name="counter" property="appBase"
value="<%= application.getRealPath(\"\") %>" />

   was incorrect as <% and %> were not escaped properly. Let me
clarify the purpose of this bug report.. I want Netbeans' syntax
highlighting to point out to users that special escaping is required
inside quotes and if they don't escape those characters the syntax
highlighting will flag it as an error.
Comment 2 _ gtzabari 2002-08-05 09:47:59 UTC
Further correction:

  Aparently one only need to escape *nested* characters. For example
if you have:

<jsp:setProperty ... value="<something>"/>

   then you only need to escape any quotes found in <something>

if however you have:

    value="<%= \"<something>\" %>"

    then you only need to escape characters if <%, %> or quotes are
found inside something. <% becomes <\% and %> becomes %\> (but only if
nested inside a parent <% %> block).

    I for one am very confused as to the actual interpretation of the
specification. I wish quoting wasn't necessary at all (I see no real
reason for it anyway). Could someone please clarify the exact meaning
behind JSP.2.6? and/or reasoning :)

Thanks,
Gili
Comment 3 Marek Fukala 2004-10-08 13:17:14 UTC
This issue is still valid for Promo-D:

According to the JSP 2.0 spec the quotes in attributes must be quoted
even inside JSP scriptlets, declarations or expressions. So the
following valid code is marked as invalid - the first backslash is
colored as an error:

<x:tag value="<%= \"hi!\" %>" />

This is issue is caused because of we do use common java syntax parser
for the jsp scriptlets content. For java code the code _is_ really
invalid - but not for JSP scriptlet. Fixing this would require having
 a hacked own version of the java syntax parser for JSP parsing - it
is not so much elegant and IMO not worth of the result.

Comment 4 Marek Fukala 2004-10-08 14:09:46 UTC
*** Issue 21908 has been marked as a duplicate of this issue. ***
Comment 5 Marek Fukala 2005-02-18 06:46:33 UTC
Not easy fix (see my last comments) together with disputable asset -
will not be fixed now.
Comment 6 Marek Fukala 2008-11-18 15:52:55 UTC
not critical I think
Comment 7 Quality Engineering 2009-11-02 11:13:53 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX