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 92940

Summary: No syntax coloring and BadLocationException after opening java file
Product: editor Reporter: Marian Mirilovic <mmirilovic>
Component: Painting & PrintingAssignee: Vitezslav Stejskal <vstejskal>
Status: VERIFIED FIXED    
Severity: blocker Keywords: RANDOM, REGRESSION
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Java file
exception stack-trace
screenshot of broken syntax coloring

Description Marian Mirilovic 2007-01-22 09:50:36 UTC
NetBeans IDE Dev (Build 200701211900)
1.5.0_11; Java HotSpot(TM) Client VM 1.5.0_11-b03
Linux version 2.6.12-10-686 running on i386
en_US (nb); UTF-8

I opened attached file. No syntax coloring presented (see attached screenthot)
and I got BadLocationException (see attached stack-trace)
WARNING
[org.netbeans.modules.editor.lib2.highlighting.CompoundHighlightsContainer]:
Can't create document position: offset = 166, document.lenght = 0
javax.swing.text.BadLocationException: Invalid offset=166, docLength=0
        at org.netbeans.editor.DocumentContent.checkOffset(DocumentContent.java:281)
Comment 1 Marian Mirilovic 2007-01-22 09:51:36 UTC
Created attachment 37559 [details]
Java file
Comment 2 Marian Mirilovic 2007-01-22 09:52:02 UTC
Created attachment 37560 [details]
exception stack-trace
Comment 3 Marian Mirilovic 2007-01-22 09:52:41 UTC
Created attachment 37561 [details]
screenshot of broken syntax coloring
Comment 4 Marian Mirilovic 2007-01-22 09:55:21 UTC
I am getting this exception every-time I move cursor into Editor area ;( 

After a while closing and reopening file helped - now the syntax coloring works
and no exception rises.
Comment 5 Vitezslav Stejskal 2007-01-22 10:05:49 UTC
I'll have a look. Once you get the exception, the safest thing to do is to close
and reopen the file, otherwise the exception is very likely to be triggered
again by any repaint operation.
Comment 6 Vitezslav Stejskal 2007-01-22 10:19:48 UTC
Actually, have you got a reproducible usecase or was it just a random failure?
It's some sort of a synchronization problem and I can't reliably reproduce it.
Thanks.
Comment 7 Marian Mirilovic 2007-01-22 10:29:10 UTC
Vita,
I haven't found reproducible scenario, it happened to me just with this file and
only once.
Comment 8 Vitezslav Stejskal 2007-01-23 00:14:21 UTC
*** Issue 92978 has been marked as a duplicate of this issue. ***
Comment 9 Vitezslav Stejskal 2007-01-23 05:10:50 UTC
Hopefully fixed now. I was quite successfull in reproducing the problem with
ehucka's steps from issue #92978. It also helped to have several java sources
ready in the project and keep opening one after each other until one of them
wasn't highlighted properly. After that when moving a cursor in this file the
exceptions occured. The essential thing was to have the IDE under a load (eg. by
parsing rt.jar) when opening the files.

Checking in
lib/bridge/src/org/netbeans/modules/editor/oldlibbridge/HighlightingDrawLayer.java;
/cvs/editor/lib/bridge/src/org/netbeans/modules/editor/oldlibbridge/HighlightingDrawLayer.java,v
 <--  HighlightingDrawLayer.java
new revision: 1.4; previous revision: 1.3
done
Checking in libsrc/org/netbeans/editor/BaseTextUI.java;
/cvs/editor/libsrc/org/netbeans/editor/BaseTextUI.java,v  <--  BaseTextUI.java
new revision: 1.83; previous revision: 1.82
done
Comment 10 Vitezslav Stejskal 2007-01-23 20:25:30 UTC
*** Issue 93067 has been marked as a duplicate of this issue. ***
Comment 11 Marian Mirilovic 2007-02-15 08:53:57 UTC
verified in NB Dev(200702141900)