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 121033 - [60cat] Wrong Syntax error parsing JSP
Summary: [60cat] Wrong Syntax error parsing JSP
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Marek Fukala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-02 22:48 UTC by Jan Jancura
Modified: 2008-09-18 16:20 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
css_inlined patch (1001 bytes, patch)
2007-11-04 09:00 UTC, Jan Jancura
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Jancura 2007-11-02 22:48:01 UTC
<div style="float: left; width: ${param.width}px; height: 18px; background-color: #eee; padding: 3px; padding-left:
10px; padding-top: 8px; font-size: 0.8em; border-bottom: 2px solid rgb(167,163,126);">
    Last Updated: <span id="lastUpdated" style="font-size: 1.0em; font-weight: bold;">${param.lastUpdated}</span>
    Modified By: <span id="modifiedBy" style="font-size: 1.0em; font-weight: bold;">${param.modifiedBy}</span>
    <div id="messages" style="font-size: 1.0em; display: none; margin-left: 10px;">
      <div id="message" style="display: inline; font-size: 1.0em;"></div>
      <div id="moreDetails" style="display: none;"></div>
    </div>
  </div>
  <div style="clear: both;"></div>
Comment 1 Jan Jancura 2007-11-02 22:52:50 UTC
There are two issues:

1) JSP breaks css-internal "css_number" token in: "${param.width}px"

- we can change tokenizer (split number and "px") and change grammar
It is not a big problem, but I am not sure if this change in grammar is acceptable for your semantic analyser based on
Schliemann parser.

2) there is some error token <error,"""> generated for " on the end of html VALUE token that is broken by EL.
- looks like some error in html lexer.
Comment 2 Jan Jancura 2007-11-02 22:55:53 UTC
and...

3) el token replaces whole content between start and end tag in "<span >${param.modifiedBy}</span>". Looks like html
grammar is not able to parse it?
Comment 3 Marek Fukala 2007-11-03 10:20:08 UTC
Re #1 - splitting css_number into two tokens - shouldn't be a probme for the CssModel. I am currently not introspecting
the content of the value, just using declarationNode.getNode("expr").getAsText(). But I would be grateful if you attach
a patch to this issue for review before commiting.

Re #2 - " error token - there is a bug in lexer, that the TokenHierarchy.tokenSequenceList(languagePath, startOffset,
endOffset) returns token sequences outside of the limited area. I have added a workaround for that and file issue
#121045 so the embedding is not created where is shouldn't. However the workaround revealed another problem - the HTML
syntax parser doesn't properly handle tag attributes if there is a higher language token inside, so just a part of the
attribute is marked as css. I have filed new issue #121046 (HTML SyntaxParser doesn't properly parse if there are higher
language tokens inside) and I am going to fix it to 6.0, it is also related to some fix-in-60 issues.

Re #3 - I do not understand what you mean, the EL in the mentioned case should be created for the "${param.modifiedBy}"
part. Please try to update the EmbeddingUpdater and revalidate, it may be fixed

Since I have the issue #121046 I am reassigning this back to you Hanzi to fix #1. Please be aware that if you update the
commited fix, you won't be able to work on the #1 since I won't created the embedding behind the EL in the html tag
attribute value. 

Btw, after my fix, I am getting IOOBE on each document parse, please fix that as well.

java.lang.IndexOutOfBoundsException: Index: 0
	at java.util.Collections$EmptyList.get(Collections.java:2970)
	at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.join(LLSyntaxAnalyser.java:522)
	at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.skipEmbedding(LLSyntaxAnalyser.java:499)
	at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.readEmbeddings(LLSyntaxAnalyser.java:417)
	at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.read2(LLSyntaxAnalyser.java:336)
	at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.read(LLSyntaxAnalyser.java:153)
	at org.netbeans.modules.languages.ParserManagerImpl.parse(ParserManagerImpl.java:359)
	at org.netbeans.modules.languages.ParserManagerImpl.parseAST(ParserManagerImpl.java:309)
	at org.netbeans.modules.languages.ParserManagerImpl.access$100(ParserManagerImpl.java:84)
	at org.netbeans.modules.languages.ParserManagerImpl$1.run(ParserManagerImpl.java:181)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)


Checking in EmbeddingUpdater.java;
/cvs/html/editor/src/org/netbeans/modules/html/editor/coloring/EmbeddingUpdater.java,v  <--  EmbeddingUpdater.java
new revision: 1.17; previous revision: 1.16
done
Comment 4 Jan Jancura 2007-11-04 09:00:59 UTC
Created attachment 52467 [details]
css_inlined patch
Comment 5 Jan Jancura 2007-11-04 09:03:37 UTC
java.lang.IndexOutOfBoundsException fixed,
patch for #1 attached
reassigning to Marek
#3 fixed by EmbeddingUpdater
Comment 6 Marek Fukala 2007-11-04 10:51:15 UTC
I) IOOBE fix verified

II) patch for #1 verified, althought I cannot verify in the original place - in the inlined css bacause of bug #121046.
I have commited the same change also to normal text/x-css so I can verify on following example:
        <style>
            h1 {
                width: ${"2px"};
                height: ${"4"}px;
                }
        </style>

One new problem, or maybe not now, I am not sure, I found during playing with the example is filled as new P2 to you
Hanzi as issue #121093.

So the last remaining problem is the incomplete embedding creation in the tag's attributes if they contain EL or JSP
tags. This fully depends on #121046 thought may be hacked. I have filled a separated issue #121095 so I am closing this
one as fixed.

Comment 7 Marek Fukala 2007-11-04 17:37:01 UTC
forgot to commit the #1 problem patches

Checking in CSS_inlined.nbs;
/cvs/languages/css/src/org/netbeans/modules/languages/css/CSS_inlined.nbs,v  <--  CSS_inlined.nbs
new revision: 1.7; previous revision: 1.6
done
Checking in CSS.nbs;
/cvs/languages/css/src/org/netbeans/modules/languages/css/CSS.nbs,v  <--  CSS.nbs
new revision: 1.34; previous revision: 1.33
done
Comment 8 josin 2008-09-18 16:20:23 UTC
Verified.

Product Version: NetBeans IDE Dev (Build 200809180201)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Linux version 2.6.24-19-generic running on i386; UTF-8; en_US (nb)