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.
This bug was originally marked as duplicate of bug 172978, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related. Build: NetBeans IDE 6.9 Beta (Build 201004200117) VM: Java HotSpot(TM) 64-Bit Server VM, 14.3-b01-101, Java(TM) SE Runtime Environment, 1.6.0_17-b04-248-10M3025 OS: Mac OS X User Comments: big_al: Invoking autocomplete while implementing a BundleActivator/ServiceListener (OSGi) GUEST: I did nothing Stacktrace: javax.swing.text.BadLocationException: Invalid offset=773 not within <0, 772> at org.netbeans.editor.Utilities.checkOffsetValid(Utilities.java:1415) at org.netbeans.editor.Utilities.checkOffsetValid(Utilities.java:1410) at org.netbeans.editor.Utilities.getRowStart(Utilities.java:178) at org.netbeans.editor.Utilities.getRowStart(Utilities.java:161) at org.netbeans.editor.CodeFoldingSideBar.traverseForward(CodeFoldingSideBar.java:332) at org.netbeans.editor.CodeFoldingSideBar.getPaintInfo(CodeFoldingSideBar.java:299)
Created attachment 98329 [details] stacktrace
Code fold reaching out of the document. Passing to code folding category ...
Strange - there seem to be inconsistencies between view model and the document content itself. For example, exception http://statistics.netbeans.org/analytics/exception.do?id=526107 is caused by baseTextUI.getPosFromY(clip.y) returning -1. That may mean incomplete view hierarchy, though. This situation *could* be possibly handled by code folding, e.g. by scheduling a repaint a little later when the view hierarchy settles. Other class of exceptions, http://statistics.netbeans.org/analytics/exception.do?id=506853 show an inconsistency between Document and its Position: Utilities.getRowStart(doc, f.getStartOffset()), where f.getStartOffset() delegates to j.s.t.Position for the offset value. I was under impression that Position update synchronously to document content updates and the whole getPaintInfo() executes under read-lock of the Document, so no changes should be allowed during the computation.
*** Bug 154991 has been marked as a duplicate of this bug. ***
OK, most cases are covered by jet-main #9502a92fe28f, which fixed offset checking. Cases with offset = -1 remain; the rest of reported exceptions seem unrelated to code folding.
Changeset: d29ee36105fc Author: Svata Dedic <sdedic@netbeans.org> Date: 2011-10-04 12:36 Message: When start/end offsets is -1, do not paint any folds. The editor will change size eventually and the sidebar repaints again Issue #185313 - [69cat] javax.swing.text.BadLocationException: Invalid offset=773 not within <0, 772>
Note - the other exceptions (hyperlink, ...) seem to originate from the already fixed position check.
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/d29ee36105fc User: Svata Dedic <sdedic@netbeans.org> Log: When start/end offsets is -1, do not paint any folds. The editor will change size eventually and the sidebar repaints again Issue #185313 - [69cat] javax.swing.text.BadLocationException: Invalid offset=773 not within <0, 772>