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 225341 - Syntax highlighting in JSP occasionally stops working
Summary: Syntax highlighting in JSP occasionally stops working
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
: 227082 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-01-25 11:51 UTC by Vladimir Riha
Modified: 2013-03-20 13:31 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (61.02 KB, text/x-log)
2013-01-25 11:51 UTC, Vladimir Riha
Details
sample file (930 bytes, application/octet-stream)
2013-01-25 11:51 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2013-01-25 11:51:33 UTC
Created attachment 130637 [details]
IDE log

This is hard to reproduce, but I've seen it couple of times. In the attached file, I copied <jsp:useBean.../>, pasted it to line 28 and quickly changed id attribute (as it was already used), suddenly all syntax highlighting after this line 28 stopped working and all below was just plain black (including HTML tags). When I move cursor to some "black" line, it became colored again (but not the jsp:useBean tag, still black). The best way to fix it is to reopen file.

It seems that it could happen when I use other than std HTML tags in JSP (jsp, EL...). I'm attaching ide log and sample file.
Comment 1 Vladimir Riha 2013-01-25 11:51:55 UTC
Created attachment 130638 [details]
sample file

Product Version: NetBeans IDE 7.3 RC1 (Build 201301240957)
Java: 1.7.0_11; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_11-b21
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)
Comment 2 Miloslav Metelka 2013-01-25 15:31:47 UTC
Yes, there's a message in the log:

Disabled an invalid highlighting layer: hlStartOffset=769 > hlEndOffset=757 for layer=org.netbeans.modules.editor.lib2.highlighting.SyntaxHighlighting@1183a4a

If it's hard to reproduce then it's likely a race condition. There's a message in the log that a write-lock is missing during embedding creation. This problem should be eliminated first.
 If it does not help then I will search for the problem in the SyntaxHighlighting class itself.
Comment 3 Marek Fukala 2013-01-31 16:13:54 UTC
web-main#a5f9f2b8175b
summary:     #225341 - missing document write lock when creating embeddings on TokenHierarchy

passing back to Mila.
Comment 4 Quality Engineering 2013-02-01 03:04:59 UTC
Integrated into 'main-golden', will be available in build *201302010001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/a5f9f2b8175b
User: Marek Fukala <mfukala@netbeans.org>
Log: #225341 - missing document write lock when creating embeddings on TokenHierarchy
Comment 5 Vladimir Riha 2013-02-20 09:01:23 UTC
if possible I think it would be good to fix it for patch
Comment 6 Miloslav Metelka 2013-02-20 09:03:17 UTC
Is it still reproducible with the Marek's fix?
Comment 7 Vladimir Riha 2013-02-20 09:04:31 UTC
yes, still reproducible after Marek's write lock fix


Product Version: NetBeans IDE Dev (Build web-main-9941-on-20130220)
Java: 1.7.0_15; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b03
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)
Comment 8 Vladimir Riha 2013-03-01 14:00:59 UTC
The same could happen in certain css files as well:
 - create new css and paste following:


audio:not([controls]) {
  display: none;
}

div{
    color:red;
}

 - place cursor around on line 5 with "div{" and try to repeat click in source code few times => part of the css becomes black 


In this case, it is caused by "audio:not([controls])" and I'd say it is 100% reproducible. IDE log contains a lot of

INFO [org.netbeans.modules.editor.lib2.highlighting.DirectMergeContainer]: Disabled an invalid highlighting layer: hlStartOffset=11 < previous hlEndOffset=21 for layer=org.netbeans.modules.csl.editor.semantic.GsfSemanticLayer@1a82bf8




Reproducible in 7.3 and latest trunk build
Java: 1.7.0_15; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b03
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)
Comment 9 Vladimir Riha 2013-03-06 10:04:12 UTC
*** Bug 227082 has been marked as a duplicate of this bug. ***
Comment 10 Miloslav Metelka 2013-03-12 16:17:13 UTC
Fixed in GsfHighlightSequence by possibly ending a current highlight (SequenceElement) on next SequenceElement's start offset.
http://hg.netbeans.org/jet-main/rev/2df3fc16a103
Comment 11 Vladimir Riha 2013-03-13 09:36:34 UTC
The CSS issue is fixed, thanks. But JSP issue is still valid, the issue is with SyntaxHighlighting (unlike CSS and Semantic) - please check attached IDE log

To reproduce:
- paste text of attached JSP file to JSP file in IDE couple of times


Product Version: NetBeans IDE Dev (Build jet-main-7697-on-20130313)
Java: 1.7.0_17; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
System: Linux version 3.2.0-38-generic-pae running on i386; UTF-8; en_US (nb)
Comment 12 Miloslav Metelka 2013-03-13 13:41:30 UTC
I've entered a separate issue 227419 for SyntaxHighlighting reporting invalid offsets and leave this fixed.
Comment 13 Miloslav Metelka 2013-03-13 16:39:40 UTC
In release73 (for patch1):
a5f9f2b8175b transplanted to d8b37ddd7266
2df3fc16a103 transplanted to 60d3c3c3407b
Comment 14 Quality Engineering 2013-03-14 02:09:13 UTC
Integrated into 'main-golden', will be available in build *201303132300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2df3fc16a103
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #225341 - Syntax highlighting in JSP occasionally stops working.
Comment 15 Quality Engineering 2013-03-14 21:10:06 UTC
Integrated into 'releases', will be available in build *201303141828* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/d8b37ddd7266
User: Marek Fukala <mfukala@netbeans.org>
Log: #225341 - missing document write lock when creating embeddings on TokenHierarchy
(transplanted from a5f9f2b8175b6e9d1293336a07da54e25478d736)
Comment 16 Vladimir Riha 2013-03-18 10:46:00 UTC
verified in patch

Product Version: NetBeans IDE 7.3 (Build 201302132200)
Java: 1.7.0_17; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
System: Linux version 3.2.0-38-generic-pae running on i386; UTF-8; en_US (nb)