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.
I am using automatic code-folding (auto-fold everything except nested classes). I was manually refactoring a class by extracting some methods to separate classes (subclasses). At one moment, I got an IndexOutOfBoundsException ("Invalid line index=1791 >= lineCount=1791") and since then, the editor became unusable. I wanted to Cut (Ctrl-X) two methods from one source file and paste it to the second file. But whenever I marked the block of two methods and pressed Ctrl-X, I got the IOOBE. I found that I could Cut bodies of the methods (leaving the method bodies empty) without getting the exception. But then, when I tried to delete some of the method's curly braces (the goal was to replace 'methodSignature(){...}' with 'abstract methodSignature();'), I got other exceptions of the same sort and the editor became visually totally broken - e.g. it displayed several dozens duplicates of a single line across the whole screen. I rather shut down the IDE and decided to finish the refactoring in ViM. Here is the begginning of the first exception: SEVERE [global] java.lang.IndexOutOfBoundsException: Invalid line index=1791 >= lineCount=1791 at o.netbeans.editor.LineRootElement.getElement(:92) at o.n.editor.DrawEngineDocView.createCustomView(:216) at o.n.lib.editor.view.GapBoxView.customReloadChildren(:1838) at o.n.editor.DrawEngineDocView.customReloadChildren(:197) at o.n.lib.editor.view.GapBoxView.reloadChildren(:1747) at o.n.lib.editor.view.GapBoxView.rebuild(:586) at o.n.lib.editor.view.GapBoxView.offsetRebuild(:609) at o.n.editor.DrawEngineDocView.foldHierarchyChanged(:294) ... -- NetBeans IDE Dev (Build 070223) 1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105 Linux version 2.6.14-1.1656_FC4 running on i386 en_US (nb); UTF-8
Created attachment 38955 [details] the exceptions
Thanks for the report. Was it just a random failure or can you reproduce it?
It was random but I was not brave enough to try to reproduce it. Now I tried to reproduce it (with sources of other modules) but (un)fortunately I was not able to break it. When I encountered the exceptions, I was cutting methods from quite a long class (about 2000 lines) and the CPU usage was high with every cut-and-paste operation. I guess it is a threading issue.
Generally this is an error of the views building mechanism but it may be hard to find out what's exactly wrong. I do not think that it's a threading problem - all seems to be done in the AWT. Anyway for 6.0 I may at least try to make the code more robust so that it notifies a problem but does not fail with an exception.
*** Issue 112109 has been marked as a duplicate of this issue. ***
*** Issue 120031 has been marked as a duplicate of this issue. ***
moving opened issues from TM <= 6.1 to TM=Dev
Played for a while with the scenario w/o any 'success' in reproducing it. Also no duplicated reports in IZ since 6.0. Closing as WORKSFORME.